Documentation ¶
Index ¶
- Constants
- Variables
- func AdminCredential() mcclient.TokenCredential
- func AdminSession(ctx context.Context, region, zone, endpointType string) *mcclient.ClientSession
- func AdminSessionWithInternal(ctx context.Context, region, zone string) *mcclient.ClientSession
- func AdminSessionWithPublic(ctx context.Context, region, zone string) *mcclient.ClientSession
- func AsyncInit(info *AuthInfo, debug, insecure bool, certFile, keyFile string, ...)
- func Authenticate(f appsrv.FilterHandler) appsrv.FilterHandler
- func AuthenticateWithDelayDecision(f appsrv.FilterHandler, delayDecision bool) appsrv.FilterHandler
- func Client() *mcclient.Client
- func FetchMatchPolicies(ctx context.Context, token mcclient.TokenCredential) (*mcclient.SFetchMatchPoliciesOutput, error)
- func FetchUserCredential(ctx context.Context, ...) mcclient.TokenCredential
- func GetAdminSession(ctx context.Context, region string) *mcclient.ClientSession
- func GetAdminSessionWithInternal(ctx context.Context, region string) *mcclient.ClientSession
- func GetAdminSessionWithPublic(ctx context.Context, region string) *mcclient.ClientSession
- func GetCatalogData(serviceTypes []string, region string) jsonutils.JSONObject
- func GetDNSServers(region, zone string) ([]string, error)
- func GetNTPServers(region, zone string) ([]string, error)
- func GetPublicServiceURL(service, region, zone string) (string, error)
- func GetServiceURL(service, region, zone, endpointType string) (string, error)
- func GetServiceURLs(service, region, zone, endpointType string) ([]string, error)
- func GetSession(ctx context.Context, token mcclient.TokenCredential, region string) *mcclient.ClientSession
- func GetSessionWithInternal(ctx context.Context, token mcclient.TokenCredential, region string) *mcclient.ClientSession
- func GetSessionWithPublic(ctx context.Context, token mcclient.TokenCredential, region string) *mcclient.ClientSession
- func GetTokenString() string
- func Init(info *AuthInfo, debug, insecure bool, certFile, keyFile string)
- func InitFromClientSession(session *mcclient.ClientSession)
- func IsAuthed() bool
- func IsGuestToken(userCred rbacutils.IRbacIdentity) bool
- func ReAuth()
- func RegisterAuthHook(hook TAuthHook)
- func RegisterCatalogListener(listener mcclient.IServiceCatalogChangeListener)
- func SetEndpointType(epType string)
- func SetTimeout(t time.Duration)
- func Verify(ctx context.Context, tokenId string) (mcclient.TokenCredential, error)
- func VerifyRequest(req http.Request, virtualHost bool) (mcclient.TokenCredential, error)
- type AuthCompletedCallback
- type AuthInfo
- type SessionCache
- type TAuthHook
- 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(ctx context.Context, cli *mcclient.Client, adminToken, token string) (mcclient.TokenCredential, error)
- type TokenVerifyFunc
Constants ¶
View Source
const (
AUTH_TOKEN = appctx.APP_CONTEXT_KEY_AUTH_TOKEN
)
Variables ¶
View Source
var ( GUEST_USER = "guest" GUEST_TOKEN = "guest_token" GuestToken = mcclient.SSimpleToken{ User: GUEST_USER, Token: GUEST_TOKEN, } DefaultTokenVerifier = Verify )
Functions ¶
func AdminCredential ¶
func AdminCredential() mcclient.TokenCredential
func AdminSession ¶
func AdminSession(ctx context.Context, region, zone, endpointType string) *mcclient.ClientSession
Deprecated
func AdminSessionWithInternal ¶
func AdminSessionWithInternal(ctx context.Context, region, zone string) *mcclient.ClientSession
Deprecated
func AdminSessionWithPublic ¶
func AdminSessionWithPublic(ctx context.Context, region, zone string) *mcclient.ClientSession
Deprecated
func AsyncInit ¶
func AsyncInit(info *AuthInfo, debug, insecure bool, certFile, keyFile string, callback AuthCompletedCallback)
func Authenticate ¶
func Authenticate(f appsrv.FilterHandler) appsrv.FilterHandler
func AuthenticateWithDelayDecision ¶
func AuthenticateWithDelayDecision(f appsrv.FilterHandler, delayDecision bool) appsrv.FilterHandler
func FetchMatchPolicies ¶
func FetchMatchPolicies(ctx context.Context, token mcclient.TokenCredential) (*mcclient.SFetchMatchPoliciesOutput, error)
func FetchUserCredential ¶
func FetchUserCredential(ctx context.Context, filter func(mcclient.TokenCredential) mcclient.TokenCredential) mcclient.TokenCredential
func GetAdminSession ¶
func GetAdminSession(ctx context.Context, region string) *mcclient.ClientSession
func GetAdminSessionWithInternal ¶
func GetAdminSessionWithInternal(ctx context.Context, region string) *mcclient.ClientSession
func GetAdminSessionWithPublic ¶
func GetAdminSessionWithPublic(ctx context.Context, region string) *mcclient.ClientSession
func GetCatalogData ¶
func GetCatalogData(serviceTypes []string, region string) jsonutils.JSONObject
func GetDNSServers ¶
func GetNTPServers ¶
func GetPublicServiceURL ¶
func GetServiceURL ¶
func GetServiceURLs ¶
func GetSession ¶
func GetSession(ctx context.Context, token mcclient.TokenCredential, region string) *mcclient.ClientSession
func GetSessionWithInternal ¶
func GetSessionWithInternal(ctx context.Context, token mcclient.TokenCredential, region string) *mcclient.ClientSession
func GetSessionWithPublic ¶
func GetSessionWithPublic(ctx context.Context, token mcclient.TokenCredential, region string) *mcclient.ClientSession
func GetTokenString ¶
func GetTokenString() string
func InitFromClientSession ¶
func InitFromClientSession(session *mcclient.ClientSession)
use for climc test only
func IsGuestToken ¶
func IsGuestToken(userCred rbacutils.IRbacIdentity) bool
func RegisterAuthHook ¶
func RegisterAuthHook(hook TAuthHook)
func RegisterCatalogListener ¶
func RegisterCatalogListener(listener mcclient.IServiceCatalogChangeListener)
func SetEndpointType ¶
func SetEndpointType(epType string)
func SetTimeout ¶
func VerifyRequest ¶
Types ¶
type AuthCompletedCallback ¶
type AuthCompletedCallback func()
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 ProjectDomain string }
func NewAuthInfo ¶
func NewV2AuthInfo ¶
type SessionCache ¶
type SessionCache struct { Region string // EarlyRefresh tells the cache how early to fetch a new session before // actual expiration of the old EarlyRefresh time.Duration Token mcclient.TokenCredential UseAdminToken bool // contains filtered or unexported fields }
func (*SessionCache) Get ¶
func (sc *SessionCache) Get(ctx context.Context) *mcclient.ClientSession
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)
type TokenVerifyFunc ¶
type TokenVerifyFunc func(string) (mcclient.TokenCredential, error)
Click to show internal directories.
Click to hide internal directories.