Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultTokenParserConfiguration ¶
type DefaultTokenParserConfiguration interface { GetAuthClientPublicKeysURL() string GetEnvironment() string }
DefaultTokenParserConfiguration represents a partition of the configuration that is used for configuring the default TokenParser.
type JSONKeys ¶
type JSONKeys struct {
Keys []interface{} `json:"keys"`
}
JSONKeys the remote keys encoded in a json document
type KeyManager ¶
type KeyManager struct {
// contains filtered or unexported fields
}
KeyManager manages the public keys for token validation.
func NewKeyManager ¶
func NewKeyManager() (*KeyManager, error)
NewKeyManager creates a new KeyManager and retrieves the public keys from the given URL.
type KeyManagerConfiguration ¶
type KeyManagerConfiguration interface { GetAuthClientPublicKeysURL() string GetEnvironment() string }
KeyManagerConfiguration represents a partition of the configuration that is used for configuring the KeyManager.
type TokenClaims ¶
type TokenClaims struct { Name string `json:"name"` PreferredUsername string `json:"preferred_username"` GivenName string `json:"given_name"` FamilyName string `json:"family_name"` Email string `json:"email"` EmailVerified bool `json:"email_verified"` Company string `json:"company"` OriginalSub string `json:"original_sub"` UserID string `json:"user_id"` AccountID string `json:"account_id"` jwt.RegisteredClaims }
TokenClaims represents access token claims
type TokenParser ¶
type TokenParser struct {
// contains filtered or unexported fields
}
TokenParser represents a parser for JWT tokens.
func DefaultTokenParser ¶
func DefaultTokenParser() (*TokenParser, error)
DefaultTokenParser returns the existing TokenManager instance.
func InitializeDefaultTokenParser ¶
func InitializeDefaultTokenParser() (*TokenParser, error)
InitializeDefaultTokenParser creates the default token parser if it has not created yet. This function must be called in main to make sure the default parser is created during service startup. It will try to create the default parser only once even if called multiple times.
func NewTokenParser ¶
func NewTokenParser(keyManager *KeyManager) (*TokenParser, error)
NewTokenParser creates a new TokenParser.
func (*TokenParser) FromString ¶
func (tp *TokenParser) FromString(jwtEncoded string) (*TokenClaims, error)
FromString parses a JWT, validates the signature and returns the claims struct.