Documentation ¶
Index ¶
Constants ¶
View Source
const ( AccountLoginName = "account" DefaultLoginURL = "/token" TokenTypeJWT = "JWT" TokenTypeBasic = "BASIC" TokenTypePrivate = "PRIVATE-TOKEN" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountLoginUtil ¶
func (*AccountLoginUtil) GetUserInfo ¶
func (ut *AccountLoginUtil) GetUserInfo(ctx context.Context, cred *Credential) (*UserInfo, error)
func (*AccountLoginUtil) LoginAddr ¶
func (ut *AccountLoginUtil) LoginAddr() string
type AuthenticateIface ¶
type AuthenticateIface interface { // LoginAddr 获取登录地址 LoginAddr() string // 验证凭据, 获取用户信息 GetUserInfo(ctx context.Context, cred *Credential) (*UserInfo, error) }
AuthenticateIface 所有登录插件需要实现AuthenticateIface接口
type AuthenticateModule ¶
func NewAuthenticateModule ¶
func NewAuthenticateModule(db *gorm.DB) *AuthenticateModule
func (*AuthenticateModule) GetAuthenticateModule ¶
func (l *AuthenticateModule) GetAuthenticateModule(ctx context.Context, name string) AuthenticateIface
type AuthenticateModuleIface ¶
type AuthenticateModuleIface interface {
GetAuthenticateModule(name string) AuthenticateIface
}
type Credential ¶
type LdapLoginUtils ¶
type LdapLoginUtils struct { Name string `yaml:"name"` LdapAddr string `yaml:"addr"` BaseDN string `yaml:"basedn"` BindUsername string `yaml:"binduser"` BindPassword string `yaml:"bindpass"` }
func (*LdapLoginUtils) GetUserInfo ¶
func (ut *LdapLoginUtils) GetUserInfo(ctx context.Context, cred *Credential) (ret *UserInfo, err error)
func (*LdapLoginUtils) LoginAddr ¶
func (ut *LdapLoginUtils) LoginAddr() string
func (*LdapLoginUtils) ValidateCredential ¶
func (ut *LdapLoginUtils) ValidateCredential(cred *Credential) bool
type OauthLoginUtils ¶
type OauthLoginUtils struct { Name string Options *OauthOption OauthConfig *oauth2.Config // contains filtered or unexported fields }
func NewOauthUtils ¶
func NewOauthUtils(opts *OauthOption) *OauthLoginUtils
func (*OauthLoginUtils) GetUserInfo ¶
func (ot *OauthLoginUtils) GetUserInfo(ctx context.Context, cred *Credential) (*UserInfo, error)
func (*OauthLoginUtils) LoginAddr ¶
func (ot *OauthLoginUtils) LoginAddr() string
type OauthOption ¶
Click to show internal directories.
Click to hide internal directories.