token

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// JWKSURI is the URI for the JWKS endpoint.
	JWKSURI = "/.well-known/jwks.json"
)

Variables

This section is empty.

Functions

func NewJWKSHandler added in v0.8.5

func NewJWKSHandler(publicKeyPEM []byte) (http.HandlerFunc, error)

NewJWKSHandler creates a new HTTP handler that serves the JWK Set for the given public key.

Types

type InMemoryValidator added in v0.8.5

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

InMemoryValidator validates JWT tokens signed with an ECDSA public key

func NewInMemoryValidator added in v0.8.5

func NewInMemoryValidator(publicKeyPEM []byte) (*InMemoryValidator, error)

NewInMemoryValidator creates a new Validator with the public key.

func (*InMemoryValidator) Validate added in v0.8.5

func (v *InMemoryValidator) Validate(tokenStr, subject string) (jwt.Claims, error)

Validate validates the token is valid and was issued for the specified subject.

type Issuer added in v0.8.5

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

func NewIssuer added in v0.8.5

func NewIssuer(privateKeyPEM []byte) (*Issuer, error)

func (*Issuer) IssueToken added in v0.8.5

func (i *Issuer) IssueToken(subject string, ttl time.Duration) (string, jwt.Claims, error)

type JWTValidator added in v0.8.5

type JWTValidator interface {
	Validate(tokenStr, subject string) (jwt.Claims, error)
}

type RemoteValidator added in v0.8.5

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

func NewRemoteValidator added in v0.8.5

func NewRemoteValidator(ctx context.Context, urls []string) (*RemoteValidator, error)

NewRemoteValidator creates a new Validator with the public key.

func (*RemoteValidator) Validate added in v0.8.5

func (v *RemoteValidator) Validate(tokenStr, subject string) (jwt.Claims, error)

Validate validates the token is valid and was issued for the specified subject.

Jump to

Keyboard shortcuts

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