claimrule

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

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 rules 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.

Jump to

Keyboard shortcuts

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