jwtclaims

package
v0.14.6 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: BSD-3-Clause Imports: 2 Imported by: 16

Documentation

Index

Constants

View Source
const (
	TokenUserProperty    = "user"
	AccountIDSuffix      = "wt_account_id"
	DomainIDSuffix       = "wt_account_domain"
	DomainCategorySuffix = "wt_account_domain_category"
	UserIDClaim          = "sub"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizationClaims

type AuthorizationClaims struct {
	UserId         string
	AccountId      string
	Domain         string
	DomainCategory string
}

AuthorizationClaims stores authorization information from JWTs

type ClaimsExtractor

type ClaimsExtractor struct {
	FromRequestContext ExtractClaims
	// contains filtered or unexported fields
}

ClaimsExtractor struct that holds the extract function

func NewClaimsExtractor

func NewClaimsExtractor(options ...ClaimsExtractorOption) *ClaimsExtractor

NewClaimsExtractor returns an extractor, and if provided with a function with ExtractClaims signature, then it will use that logic. Uses ExtractClaimsFromRequestContext by default

func (*ClaimsExtractor) FromToken added in v0.13.0

func (c *ClaimsExtractor) FromToken(token *jwt.Token) AuthorizationClaims

FromToken extracts claims from the token (after auth)

type ClaimsExtractorOption added in v0.13.0

type ClaimsExtractorOption func(*ClaimsExtractor)

ClaimsExtractorOption is a function that configures the ClaimsExtractor

func WithAudience added in v0.13.0

func WithAudience(audience string) ClaimsExtractorOption

WithAudience sets the audience for the extractor

func WithFromRequestContext added in v0.13.0

func WithFromRequestContext(ec ExtractClaims) ClaimsExtractorOption

WithFromRequestContext sets the function that extracts claims from the request context

func WithUserIDClaim added in v0.13.0

func WithUserIDClaim(userIDClaim string) ClaimsExtractorOption

WithUserIDClaim sets the user id claim for the extractor

type ExtractClaims

type ExtractClaims func(r *http.Request) AuthorizationClaims

Extract function type

Jump to

Keyboard shortcuts

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