jwt

package module
v0.0.0-...-38e17da Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWTAuthManager

type JWTAuthManager struct {
	// contains filtered or unexported fields
}

JWTAuthManager implements local authentication using JWT.

func Init

func Init() *JWTAuthManager

func NewJWTAuthManager

func NewJWTAuthManager(config JWTConfig) *JWTAuthManager

func (*JWTAuthManager) Authenticate

func (j *JWTAuthManager) Authenticate(ctx context.Context, token string) (auth.Principal, error)

Authenticate validates a JWT token and returns the corresponding Principal.

type JWTConfig

type JWTConfig struct {
	SigningKey string // JWT signing key

}

func LoadJWTConfig

func LoadJWTConfig(configName string, configPaths []string) JWTConfig

LoadJWTConfig loads the JWT configuration from YAML and environment variables.

type JWTPrincipal

type JWTPrincipal struct {
	// contains filtered or unexported fields
}

JWTPrincipal implements the Principal interface.

func (*JWTPrincipal) GetClaims

func (p *JWTPrincipal) GetClaims() map[string]interface{}

func (*JWTPrincipal) GetEmail

func (p *JWTPrincipal) GetEmail() string

func (*JWTPrincipal) GetID

func (p *JWTPrincipal) GetID() string

func (*JWTPrincipal) GetRoles

func (p *JWTPrincipal) GetRoles() []string

Jump to

Keyboard shortcuts

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