auth

package
v0.0.0-...-9665ab3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2024 License: Apache-2.0, Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

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 AuthenticateWithDelayDecision

func AuthenticateWithDelayDecision(f appsrv.FilterHandler, delayDecision bool) appsrv.FilterHandler

func Client

func Client() *mcclient.Client

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 GetDNSServers(region, zone string) ([]string, error)

func GetDefaultAuthSource

func GetDefaultAuthSource() string

func GetNTPServers

func GetNTPServers(region, zone string) ([]string, error)

func GetPublicServiceURL

func GetPublicServiceURL(service, region, zone string) (string, error)

func GetServiceURL

func GetServiceURL(service, region, zone, endpointType string) (string, error)

func GetServiceURLs

func GetServiceURLs(service, region, zone, endpointType string) ([]string, error)

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 Init

func Init(info *AuthInfo, debug, insecure bool, certFile, keyFile string)

func InitFromClientSession

func InitFromClientSession(session *mcclient.ClientSession)

use for climc test only

func IsAuthed

func IsAuthed() bool

func IsGuestToken

func IsGuestToken(userCred rbacutils.IRbacIdentity) bool

func ReAuth

func ReAuth()

func RegisterAuthHook

func RegisterAuthHook(hook TAuthHook)

func RegisterCatalogListener

func RegisterCatalogListener(listener mcclient.IServiceCatalogChangeListener)

func Remove

func Remove(ctx context.Context, tokenId string) error

func SetDefaultAuthSource

func SetDefaultAuthSource(src string)

func SetEndpointType

func SetEndpointType(epType string)

func SetTimeout

func SetTimeout(t time.Duration)

func Verify

func Verify(ctx context.Context, tokenId string) (mcclient.TokenCredential, error)

func VerifyRequest

func VerifyRequest(req http.Request, virtualHost bool) (mcclient.TokenCredential, error)

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 NewAuthInfo(authUrl, domain, user, passwd, project, projectDomain string) *AuthInfo

func NewV2AuthInfo

func NewV2AuthInfo(authUrl, user, passwd, tenant string) *AuthInfo

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

type TAuthHook

type TAuthHook func(ctx context.Context, userCred mcclient.TokenCredential)

type TokenCacheVerify

type TokenCacheVerify struct {
	*cache.LRUCache
}

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) Remove

func (c *TokenCacheVerify) Remove(ctx context.Context, cli *mcclient.Client, adminToken, token string) error

func (*TokenCacheVerify) Verify

func (c *TokenCacheVerify) Verify(ctx context.Context, cli *mcclient.Client, adminToken, token string) (mcclient.TokenCredential, error)

type TokenVerifyFunc

type TokenVerifyFunc func(string) (mcclient.TokenCredential, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL