Documentation ¶
Index ¶
- Variables
- func BuildURLValues(values url.Values, secret string) url.Values
- func CheckSign(raw string, sign string) error
- func Decrypt(decrypted string, secret string) string
- func Encrypt(raw string, secret string) string
- func GenSign(formData url.Values) string
- func GetOauthProviderTitle(list []*OauthProvider, name string) string
- func MakeSign(data url.Values, secret string) string
- func SignString(raw string) string
- func Submit(ctx echo.Context, apiURL string, formData url.Values, method ...string) (*echo.RawData, error)
- func SubmitWithRecv(ctx echo.Context, recv interface{}, apiURL string, formData url.Values, ...) (*resty.Response, error)
- func Submitx(ctx echo.Context, apiURL string, formData url.Values, method ...string) (echo.H, string, error)
- type AppInfo
- type OauthOption
- type OauthProvider
- type OauthProvidersResponse
- type Options
- func (o *Options) ApplySetting() (err error)
- func (o *Options) Context() echo.Context
- func (o *Options) GetAccountID() uint64
- func (o *Options) GetAppID() string
- func (o *Options) GetAppSecret() string
- func (o *Options) OauthProvierListURL(appID string) (string, error)
- func (o *Options) SetAppInfoGetter(...) *Options
- func (o *Options) SetGenerator(g URLValuesGenerator) *Options
- func (o *Options) SetSignaturer(fn func(url.Values) string) *Options
- func (o *Options) ToURL(urlPath string, strength ...bool) (uri string, formData url.Values, err error)
- type Type
- type URLValues
- type URLValuesGenerator
Constants ¶
This section is empty.
Variables ¶
View Source
var AppInfoDefaultGetter = func(ctx echo.Context, cond db.Compound) (appInfo AppInfo, err error) { err = ctx.NewError(code.Unsupported, `尚未设置App信息获取方式`) return }
View Source
var DefaultURLValuesGenerator = func(values url.Values) URLValuesGenerator { return URLValues(values) }
View Source
var OauthOptionsCreater = func(ctx echo.Context, typ Type, generators ...URLValuesGenerator) OauthOption { return NewOptions(ctx, TypeOauth, generators...) }
Functions ¶
func BuildURLValues ¶
BuildURLValues 构建API参数值
func GetOauthProviderTitle ¶
func GetOauthProviderTitle(list []*OauthProvider, name string) string
func MakeSign ¶
MakeSign 生成签名 规则说明:数据按照以键的字母顺序排列后进行url编码,然后拼接上`&secret=密钥` 等价的PHP代码: ```php <?php
function makeSign(array $data, string $secret): string{ ksort($data); return hash('sha256',http_build_query($data).'&secret='.$secret); }
```
func SubmitWithRecv ¶
Types ¶
type OauthOption ¶
type OauthProvider ¶
type OauthProvider struct { Name string `json:"name" xml:"name"` English string `json:"english" xml:"english"` IconClass string `json:"iconClass" xml:"iconClass"` IconImage string `json:"iconImage" xml:"iconImage"` WrapClass string `json:"wrapClass" xml:"wrapClass"` LoginURL string `json:"loginURL" xml:"loginURL"` }
func GetOauthProvider ¶
func GetOauthProvider(list []*OauthProvider, name string) *OauthProvider
func OauthProviders ¶
func OauthProviders(ctx echo.Context) ([]*OauthProvider, error)
func OauthProvidersFrom ¶
func OauthProvidersFrom(accounts []*oauth2.Account) []*OauthProvider
type OauthProvidersResponse ¶
type OauthProvidersResponse struct {
List []*OauthProvider `json:"list"`
}
type Options ¶
type Options struct { Account *dbschema.OfficialCommonApiAccount App AppInfo URLPrefix string Type Type // contains filtered or unexported fields }
func NewOptions ¶
func NewOptions(ctx echo.Context, typ Type, generators ...URLValuesGenerator) *Options
func (*Options) ApplySetting ¶
func (*Options) GetAccountID ¶
func (*Options) GetAppSecret ¶
func (*Options) OauthProvierListURL ¶
OauthProvierListURL 社区登录供应商列表
func (*Options) SetAppInfoGetter ¶
func (*Options) SetGenerator ¶
func (o *Options) SetGenerator(g URLValuesGenerator) *Options
func (*Options) SetSignaturer ¶
Click to show internal directories.
Click to hide internal directories.