jwt

package
v0.0.0-...-48b1b68 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetTimeFunc

func SetTimeFunc(f func() time.Time) (restore func())

Types

type Claims

type Claims struct {
	ClientID string      `json:"client_id"`
	Email    string      `json:"email"`
	Scope    interface{} `json:"scope"`
	StandardClaims
}

func (Claims) GetScope

func (c Claims) GetScope() []string

type KeyCache

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

func NewKeyCache

func NewKeyCache(url string, tls *tls.Config) *KeyCache

func (*KeyCache) FetchKeys

func (c *KeyCache) FetchKeys() error

func (*KeyCache) GetKey

func (c *KeyCache) GetKey(token *jwt.Token) (interface{}, error)

func (*KeyCache) GetOrFetchKey

func (c *KeyCache) GetOrFetchKey(token *jwt.Token) (interface{}, error)

func (*KeyCache) LookupKey

func (c *KeyCache) LookupKey(token *jwt.Token) (jwk.Key, error)

type ScopeClaims

type ScopeClaims struct {
	Claims
	// contains filtered or unexported fields
}

func NewRegexpScopeClaims

func NewRegexpScopeClaims(scope ...*regexp.Regexp) *ScopeClaims

func NewScopeClaims

func NewScopeClaims(scope ...string) *ScopeClaims

func (*ScopeClaims) Valid

func (c *ScopeClaims) Valid() error

type StandardClaims

type StandardClaims struct {
	Audience  interface{} `json:"aud,omitempty"`
	ExpiresAt int64       `json:"exp,omitempty"`
	Id        string      `json:"jti,omitempty"`
	IssuedAt  int64       `json:"iat,omitempty"`
	Issuer    string      `json:"iss,omitempty"`
	NotBefore int64       `json:"nbf,omitempty"`
	Subject   string      `json:"sub,omitempty"`
}

https://tools.ietf.org/html/rfc7519#section-4.1

func (StandardClaims) GetAudience

func (c StandardClaims) GetAudience() []string

func (StandardClaims) Valid

func (c StandardClaims) Valid() error

type Validator

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

func NewValidator

func NewValidator(jwksURL string, tls *tls.Config) *Validator

func (*Validator) Parse

func (v *Validator) Parse(token string) (jwt.MapClaims, error)

func (*Validator) ParseWithClaims

func (v *Validator) ParseWithClaims(token string, claims jwt.Claims) error

Jump to

Keyboard shortcuts

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