Documentation
¶
Overview ¶
Package claimrule implements checks for access tokens.
Index ¶
Constants ¶
View Source
const ( // In defines claim check if value is withing the slice. In operation = "in" // Equal defines claim check if value is equal. Equal operation = "eq" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClaimRule ¶
type ClaimRule struct {
// Values is used to compare with retrieved value from token claims.
Value interface{} `json:"value"`
// Op represents defined operation for the claim rule that should be used
// during checking of token claims. It can be "eq" or "in".
// - "eq" is used to compare single value from token claims.
// - "in" is used to look if defined value is in the list of values for
// defined token claim path.
Op operation `json:"op"`
// Path represent JSON path to specific key in the token claims. Nested
// fields are separated by '.'. i.e. "top_level.field.sub_field".
Path string `json:"path"`
}
ClaimRule represents the configuration for checking access token claims.
type ClaimRules ¶
type ClaimRules []ClaimRule
ClaimRules represents the collection of claim ruels that should be validated against an access token claims.
func (*ClaimRules) IsEmpty ¶
func (cos *ClaimRules) IsEmpty() bool
IsEmpty returns if claim rules are not defined.
func (*ClaimRules) Validate ¶
func (cos *ClaimRules) Validate(rawAccessToken string) error
Validate validates all defined claim rules for the access token.
Click to show internal directories.
Click to hide internal directories.