auth

package
v0.6.13 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractBearerToken

func ExtractBearerToken(authHeader string) (string, error)

ExtractBearerToken extracts the bearer token from the Authorization header.

Types

type Config

type Config struct {
	PublicKeyJWK         string        // JWK format public key
	JWKSUrl              string        // URL to JWKS endpoint (mutually exclusive with PublicKeyJWK)
	Issuer               string        // Expected issuer
	Subject              string        // Expected subject (optional)
	Audience             string        // Expected audience (optional)
	Nonce                string        // Expected nonce (optional)
	MaxExpirationFromNow time.Duration // Maximum expiration time from now (optional, defaults to 24 hours)
}

Config holds the configuration for JWT validation.

type KeySet

type KeySet interface {
	Get() (*jose.JSONWebKeySet, error)
}

type Validator

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

Validator handles JWT validation with a specific configuration.

func NewValidator

func NewValidator(ctx context.Context, config Config) (*Validator, error)

NewValidator creates a new JWT validator with the given configuration.

func (*Validator) ValidateToken

func (v *Validator) ValidateToken(ctx context.Context, token string) (map[string]interface{}, error)

ValidateToken validates the JWT token string and returns the claims if valid.

Jump to

Keyboard shortcuts

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