Documentation ¶
Index ¶
- Variables
- func DecodeScopesMatcherHookFunc() mapstructure.DecodeHookFunc
- type Audience
- type Claims
- type ExactScopeStrategyMatcher
- type Expectation
- func (e *Expectation) AssertAlgorithm(alg string) error
- func (e *Expectation) AssertAudience(audience []string) error
- func (e *Expectation) AssertIssuanceTime(issuedAt time.Time) error
- func (e *Expectation) AssertIssuer(issuer string) error
- func (e *Expectation) AssertScopes(scopes []string) error
- func (e *Expectation) AssertValidity(notBefore, notAfter time.Time) error
- func (e *Expectation) Merge(other *Expectation) Expectation
- type HierarchicScopeStrategyMatcher
- type IntrospectionResponse
- type NoopMatcher
- type NumericDate
- type ScopeMatcherFactory
- type Scopes
- type ScopesMatcher
- type WildcardScopeStrategyMatcher
Constants ¶
This section is empty.
Variables ¶
var ErrAssertion = errors.New("assertion error")
var ErrConfiguration = errors.New("configuration error")
var ErrScopeMatch = errors.New("scope matching error")
var ErrTokenNotActive = errors.New("token is not active")
Functions ¶
func DecodeScopesMatcherHookFunc ¶
func DecodeScopesMatcherHookFunc() mapstructure.DecodeHookFunc
Types ¶
type Audience ¶
type Audience []string
Audience represents the recipients that the token is intended for.
func (*Audience) UnmarshalJSON ¶
UnmarshalJSON reads an audience from its JSON representation.
type Claims ¶
type Claims struct { Issuer string `json:"iss,omitempty"` Subject string `json:"sub,omitempty"` Audience Audience `json:"aud,omitempty"` Scp Scopes `json:"scp,omitempty"` Scope Scopes `json:"scope,omitempty"` Expiry *NumericDate `json:"exp,omitempty"` NotBefore *NumericDate `json:"nbf,omitempty"` IssuedAt *NumericDate `json:"iat,omitempty"` ID string `json:"jti,omitempty"` }
Claims represents public claim values (as specified in RFC 7519).
func (Claims) Validate ¶
func (c Claims) Validate(exp Expectation) error
type ExactScopeStrategyMatcher ¶
type ExactScopeStrategyMatcher []string
func (ExactScopeStrategyMatcher) Match ¶
func (m ExactScopeStrategyMatcher) Match(scopes []string) error
type Expectation ¶
type Expectation struct { TrustedIssuers []string `mapstructure:"issuers" validate:"required"` ScopesMatcher ScopesMatcher `mapstructure:"scopes"` TargetAudiences []string `mapstructure:"audience"` AllowedAlgorithms []string `mapstructure:"allowed_algorithms"` ValidityLeeway time.Duration `mapstructure:"validity_leeway"` }
func (*Expectation) AssertAlgorithm ¶
func (e *Expectation) AssertAlgorithm(alg string) error
func (*Expectation) AssertAudience ¶
func (e *Expectation) AssertAudience(audience []string) error
func (*Expectation) AssertIssuanceTime ¶
func (e *Expectation) AssertIssuanceTime(issuedAt time.Time) error
func (*Expectation) AssertIssuer ¶
func (e *Expectation) AssertIssuer(issuer string) error
func (*Expectation) AssertScopes ¶
func (e *Expectation) AssertScopes(scopes []string) error
func (*Expectation) AssertValidity ¶
func (e *Expectation) AssertValidity(notBefore, notAfter time.Time) error
func (*Expectation) Merge ¶
func (e *Expectation) Merge(other *Expectation) Expectation
type HierarchicScopeStrategyMatcher ¶
type HierarchicScopeStrategyMatcher []string
func (HierarchicScopeStrategyMatcher) Match ¶
func (m HierarchicScopeStrategyMatcher) Match(scopes []string) error
type IntrospectionResponse ¶
type IntrospectionResponse struct { Claims Active bool `json:"active,omitempty"` ClientID string `json:"client_id,omitempty"` TokenType string `json:"token_type,omitempty"` }
func (IntrospectionResponse) Validate ¶
func (c IntrospectionResponse) Validate(exp Expectation) error
type NoopMatcher ¶
type NoopMatcher struct{}
func (NoopMatcher) Match ¶
func (NoopMatcher) Match(_ []string) error
type NumericDate ¶
type NumericDate int64
NumericDate represents date and time as the number of seconds since the epoch, ignoring leap seconds. Non-integer values can be represented in the serialized format, but we round to the nearest second. See RFC7519 Section 2: https://tools.ietf.org/html/rfc7519#section-2
func (*NumericDate) Time ¶
func (n *NumericDate) Time() time.Time
Time returns time.Time representation of NumericDate.
func (*NumericDate) UnmarshalJSON ¶
func (n *NumericDate) UnmarshalJSON(b []byte) error
UnmarshalJSON reads a date from its JSON representation.
type ScopeMatcherFactory ¶
type ScopeMatcherFactory func(scopes []string) (ScopesMatcher, error)
type Scopes ¶
type Scopes []string
Scopes represents the scopes that the token is granted.
func (*Scopes) UnmarshalJSON ¶
UnmarshalJSON reads scopes from its JSON representation.
type ScopesMatcher ¶
type WildcardScopeStrategyMatcher ¶
type WildcardScopeStrategyMatcher []string
func (WildcardScopeStrategyMatcher) Match ¶
func (m WildcardScopeStrategyMatcher) Match(scopes []string) error