constraint

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTokenExpired   = errors.New("token is expired")
	ErrTokenNotBefore = errors.New("token cannot be used yet")
	ErrTokenNotIssued = errors.New("token was issued in the future")
)

Block represents ValidAt constraint errors.

View Source
var (
	ErrTokenInvalidID = errors.New("token is not identified with the expected ID")
)

Block represents IdentifiedBy constraint errors.

View Source
var (
	ErrTokenInvalidIssuer = errors.New("token was not issued by the given issuers")
)

Block represents IssuedBy constraint errors.

View Source
var (
	ErrTokenInvalidRelation = errors.New("token is not related to the expected subject")
)

Block represents RelatedTo constraint errors.

View Source
var (
	ErrTokenNotPermitted = errors.New("token is not allowed to be used by this audience")
)

Block represents PermittedFor constraint errors.

Functions

This section is empty.

Types

type IdentifiedBy

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

IdentifiedBy checks if audience is valid.

func NewIdentifiedBy

func NewIdentifiedBy(id string) *IdentifiedBy

NewIdentifiedBy returns new instance of IdentifiedBy.

func (*IdentifiedBy) Validate

func (c *IdentifiedBy) Validate(claims jwtee.RegisteredClaims) (err error)

Validate implements Constraint.

type IssuedBy

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

IssuedBy checks if audience is valid.

func NewIssuedBy

func NewIssuedBy(issuers []string) *IssuedBy

NewIssuedBy returns new instance of IssuedBy.

func (*IssuedBy) Validate

func (c *IssuedBy) Validate(claims jwtee.RegisteredClaims) (err error)

Validate implements Constraint.

type PermittedFor

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

PermittedFor checks if audience is valid.

func NewPermittedFor

func NewPermittedFor(audience string) *PermittedFor

NewPermittedFor returns new instance of PermittedFor.

func (*PermittedFor) Validate

func (c *PermittedFor) Validate(claims jwtee.RegisteredClaims) (err error)

Validate implements Constraint.

type RelatedTo

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

RelatedTo checks if subject is valid.

func NewRelatedTo

func NewRelatedTo(subject string) *RelatedTo

NewRelatedTo returns new instance of RelatedTo.

func (*RelatedTo) Validate

func (c *RelatedTo) Validate(claims jwtee.RegisteredClaims) (err error)

Validate implements Constraint.

type ValidAt

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

ValidAt checks if Claims is valid on current time.

func NewValidAt

func NewValidAt() *ValidAt

NewValidAt returns new instance of ValidAt.

func (*ValidAt) Validate

func (c *ValidAt) Validate(claims jwtee.RegisteredClaims) (err error)

Validate implements Constraint.

func (*ValidAt) WithLeeway

func (c *ValidAt) WithLeeway(leeway time.Duration) *ValidAt

WithLeeway setup leeway for ValidAt Constraint

Jump to

Keyboard shortcuts

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