Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IdentifiedCallback ¶
type TokenGenerator ¶
type TokenGenerator interface { // Generate fetch new token and return expire time as well. Generate(ctx context.Context) (token string, expireAt time.Time, err error) // Equal compares two generator Equal(tg TokenGenerator) bool // ID for identity to where the token belongs. ID() string }
func NewTokenGenerator ¶
func NewTokenGenerator(authUrl, username, password string, defaultExpire time.Duration) TokenGenerator
type TokenManager ¶
type TokenManager interface { // AddToken add new token to manager AddToken(TokenGenerator, IdentifiedCallback) // RemoveToken stops maintaining process of given token and remove it from cache. RemoveToken(tg TokenGenerator, ic IdentifiedCallback) // Stop stops all token maintaining and clean the cache, don't use this manager after call Stop. Stop() }
TokenManager provides cache and maintain token ability.
func NewTokenManager ¶
func NewTokenManager() TokenManager
NewTokenManager return an implement of TokenManager.
Click to show internal directories.
Click to hide internal directories.