Documentation
¶
Overview ¶
Package account 提供不同版本的用户认证后端
Index ¶
Constants ¶
View Source
const SpecialTokenForTest = "EverythingIsPermitted"
SpecialTokenForTest 允许特定用户凭证(测试用)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthBackend ¶
type AuthBackend interface {
// Name 获取认证后端名称
Name() string
// GetLoginUrl 获取登录地址,callbackUrl 为当前请求的地址,用于登录成功后跳转
GetLoginUrl(callbackUrl string) string
// GetUserToken 获取用户凭证
GetUserToken(c *gin.Context) (string, error)
// GetUserInfo 获取用户信息
GetUserInfo(c *gin.Context, token string) (*UserInfo, error)
}
AuthBackend 认证后端
func GetAuthBackends ¶
func GetAuthBackends(authTypes []string) []AuthBackend
GetAuthBackends 获取需要的 AuthBackend
type BkTicketAuthBackend ¶
type BkTicketAuthBackend struct{}
BkTicketAuthBackend 用于上云版本的用户登录 & 信息获取
func (*BkTicketAuthBackend) GetLoginUrl ¶
func (b *BkTicketAuthBackend) GetLoginUrl(callbackUrl string) string
GetLoginUrl 获取登录地址
func (*BkTicketAuthBackend) GetUserInfo ¶
GetUserInfo 获取用户信息
func (*BkTicketAuthBackend) GetUserToken ¶
func (b *BkTicketAuthBackend) GetUserToken(c *gin.Context) (string, error)
GetUserToken 获取用户凭证
type BkTokenAuthBackend ¶
type BkTokenAuthBackend struct{}
BkTokenAuthBackend 用于社区开源版本的用户登录 & 信息获取
func (*BkTokenAuthBackend) GetLoginUrl ¶
func (b *BkTokenAuthBackend) GetLoginUrl(callbackUrl string) string
GetLoginUrl 获取登录地址
func (*BkTokenAuthBackend) GetUserInfo ¶
GetUserInfo 获取用户信息
func (*BkTokenAuthBackend) GetUserToken ¶
func (b *BkTokenAuthBackend) GetUserToken(c *gin.Context) (string, error)
GetUserToken 获取用户凭证
type StubAuthBackend ¶
type StubAuthBackend struct {
// contains filtered or unexported fields
}
StubAuthBackend 测试用 AuthBackend
func (*StubAuthBackend) GetLoginUrl ¶
func (b *StubAuthBackend) GetLoginUrl(_ string) string
GetLoginUrl 获取登录地址
func (*StubAuthBackend) GetUserInfo ¶
GetUserInfo 获取用户信息
func (*StubAuthBackend) GetUserToken ¶
func (b *StubAuthBackend) GetUserToken(c *gin.Context) (string, error)
GetUserToken 获取用户凭证
Click to show internal directories.
Click to hide internal directories.