Documentation ¶
Index ¶
- Variables
- type Account
- func (f *Account) Add() (pk interface{}, err error)
- func (f *Account) Edit(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *Account) Exists(appId string) error
- func (f *Account) ExistsOther(appId string, id uint64) error
- func (f *Account) GetByAppID(appID string) (*dbschema.OfficialCommonApiAccount, error)
- func (f *Account) OauthLogin() echo.H
- func (f *Account) ParseExtra() echo.H
Constants ¶
This section is empty.
Variables ¶
View Source
var APIAccountAuthConfig = mwapp.NewAuthConfig().SetSecretGetter(func(ctx echo.Context, appID string) (string, error) { m := NewAccount(ctx) err := m.Get(nil, `app_id`, appID) if err != nil { if err == db.ErrNoMoreRows { err = ctx.NewError(code.DataNotFound, `API账号“%s”没找到`, appID).SetZone(`appId`) } return "", err } if m.Disabled != `N` { return "", ctx.NewError(code.DataUnavailable, `API账号“%s”已经停用`, appID).SetZone(`appId`) } ctx.Internal().Store(`ApiAccount`, m.OfficialCommonApiAccount) return m.AppSecret, nil })
APIAccountAuthConfig Api账号认证配置
View Source
var APIAuthMiddleware = mwapp.Auth(*APIAccountAuthConfig)
APIAuthMiddleware Api账号认证中间件
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
*dbschema.OfficialCommonApiAccount
}
func NewAccount ¶
func (*Account) GetByAppID ¶
func (f *Account) GetByAppID(appID string) (*dbschema.OfficialCommonApiAccount, error)
func (*Account) OauthLogin ¶
func (*Account) ParseExtra ¶
Click to show internal directories.
Click to hide internal directories.