validator

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TokenValidator

type TokenValidator struct {
	Token             string
	ExpectedIssuer    string
	ExpectedAudience  string   // Deprecated: use ExpectedAudiences instead (kept for backward compatibility)
	ExpectedAudiences []string // List of expected audiences
	Cache             cache.Cache
	Cfg               *config.Config
}

func NewTokenValidator

func NewTokenValidator(cfg *config.Config, cache cache.Cache) *TokenValidator

func (*TokenValidator) FetchJWKS

func (t *TokenValidator) FetchJWKS(issuer string) (*types.JWKS, error)

fetchJwKS fetches the JWKS from the GitHub OIDC JWKS endpoint (issuer + /.well-known/openid-configuration) TODO: Add caching for the JWKS to avoid fetching it on every request

func (*TokenValidator) GenKeyFunc

func (t *TokenValidator) GenKeyFunc(jwks *types.JWKS) jwt.Keyfunc

GenKeyFunc generates a jwt.Keyfunc that can be used to validate JWT tokens using the keys provided in the JWKS.

func (*TokenValidator) ParseToken

func (t *TokenValidator) ParseToken(tokenString string) (*types.GithubClaims, error)

func (*TokenValidator) Unmarshal

func (t *TokenValidator) Unmarshal(data []byte) (*types.GithubClaims, error)

func (*TokenValidator) Validate

func (t *TokenValidator) Validate(token string) (*types.GithubClaims, error)

type TokenValidatorInterface

type TokenValidatorInterface interface {
	Validate(string) (*types.GithubClaims, error)
	ParseToken(tokenString string) (*types.GithubClaims, error)
	FetchJWKS(issuer string) (*types.JWKS, error)
	GenKeyFunc(jwks *types.JWKS) jwt.Keyfunc
}

Jump to

Keyboard shortcuts

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