Documentation ¶
Index ¶
- Constants
- func AdminCredential() mcclient.TokenCredential
- func AdminSession(region, zone, endpointType, apiVersion string) *mcclient.ClientSession
- func AsyncInit(info *AuthInfo, debug, insecure bool, callback AuthCompletedCallback)
- func Authenticate(f appsrv.FilterHandler) appsrv.FilterHandler
- func Client() *mcclient.Client
- func FetchUserCredential(ctx context.Context) mcclient.TokenCredential
- func GetAdminSession(region string, apiVersion string) *mcclient.ClientSession
- func GetServiceURL(service, region, zone, endpointType string) (string, error)
- func GetSession(token mcclient.TokenCredential, region string, apiVersion string) *mcclient.ClientSession
- func GetTokenString() string
- func Init(info *AuthInfo, debug, insecure bool)
- func IsAuthed() bool
- func SetTimeout(t time.Duration)
- func Verify(tokenId string) (mcclient.TokenCredential, error)
- type AuthCompletedCallback
- type AuthInfo
- type TokenCacheVerify
- func (c *TokenCacheVerify) AddToken(cred mcclient.TokenCredential) error
- func (c *TokenCacheVerify) DeleteToken(token string) bool
- func (c *TokenCacheVerify) GetToken(token string) (mcclient.TokenCredential, bool)
- func (c *TokenCacheVerify) Verify(cli *mcclient.Client, adminToken, token string) (mcclient.TokenCredential, error)
Constants ¶
View Source
const (
AUTH_TOKEN = appctx.AppContextKey("X_AUTH_TOKEN")
)
Variables ¶
This section is empty.
Functions ¶
func AdminCredential ¶
func AdminCredential() mcclient.TokenCredential
func AdminSession ¶
func AdminSession(region, zone, endpointType, apiVersion string) *mcclient.ClientSession
func AsyncInit ¶
func AsyncInit(info *AuthInfo, debug, insecure bool, callback AuthCompletedCallback)
func Authenticate ¶
func Authenticate(f appsrv.FilterHandler) appsrv.FilterHandler
func FetchUserCredential ¶
func FetchUserCredential(ctx context.Context) mcclient.TokenCredential
func GetAdminSession ¶
func GetAdminSession(region string, apiVersion string) *mcclient.ClientSession
func GetServiceURL ¶
func GetSession ¶
func GetSession(token mcclient.TokenCredential, region string, apiVersion string) *mcclient.ClientSession
func GetTokenString ¶
func GetTokenString() string
func SetTimeout ¶
Types ¶
type AuthCompletedCallback ¶
type AuthCompletedCallback func()
func (*AuthCompletedCallback) Run ¶
func (callback *AuthCompletedCallback) Run()
type AuthInfo ¶
type AuthInfo struct { AuthUrl string // Domain not need when v2 auth Domain string Username string Passwd string // Project is tenant when v2 auth Project string }
func NewAuthInfo ¶
func NewV2AuthInfo ¶
type TokenCacheVerify ¶
func NewTokenCacheVerify ¶
func NewTokenCacheVerify() *TokenCacheVerify
func (*TokenCacheVerify) AddToken ¶
func (c *TokenCacheVerify) AddToken(cred mcclient.TokenCredential) error
func (*TokenCacheVerify) DeleteToken ¶
func (c *TokenCacheVerify) DeleteToken(token string) bool
func (*TokenCacheVerify) GetToken ¶
func (c *TokenCacheVerify) GetToken(token string) (mcclient.TokenCredential, bool)
func (*TokenCacheVerify) Verify ¶
func (c *TokenCacheVerify) Verify(cli *mcclient.Client, adminToken, token string) (mcclient.TokenCredential, error)
Click to show internal directories.
Click to hide internal directories.