auth

package
v0.0.0-...-c12a3d9 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

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.

func (*KeyManager) Key

func (km *KeyManager) Key(kid string) (*rsa.PublicKey, error)

Key retrieves the public key for a given kid.

type KeyManagerConfiguration

type KeyManagerConfiguration interface {
	GetAuthClientPublicKeysURL() string
	GetEnvironment() string
}

KeyManagerConfiguration represents a partition of the configuration that is used for configuring the KeyManager.

type PublicKey

type PublicKey struct {
	KeyID string
	Key   *rsa.PublicKey
}

PublicKey represents an RSA public key with a Key ID

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.

Jump to

Keyboard shortcuts

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