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
Click to show internal directories.
Click to hide internal directories.