Documentation
¶
Index ¶
- type TokenValidator
- func (t *TokenValidator) FetchJWKS(issuer string) (*types.JWKS, error)
- func (t *TokenValidator) GenKeyFunc(jwks *types.JWKS) jwt.Keyfunc
- func (t *TokenValidator) ParseToken(tokenString string) (*types.GithubClaims, error)
- func (t *TokenValidator) Unmarshal(data []byte) (*types.GithubClaims, error)
- func (t *TokenValidator) Validate(token string) (*types.GithubClaims, error)
- type TokenValidatorInterface
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)
Click to show internal directories.
Click to hide internal directories.