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
func ExtractClaimsFromRequestContext ¶
func ExtractClaimsFromRequestContext(r *http.Request, authAudience string) AuthorizationClaims
ExtractClaimsFromRequestContext extracts claims from the request context previously filled by the JWT token (after auth)
func ExtractClaimsWithToken ¶
func ExtractClaimsWithToken(token *jwt.Token, authAudience string) AuthorizationClaims
ExtractClaimsWithToken extracts claims from the token (after auth)
type ClaimsExtractor ¶
type ClaimsExtractor struct {
ExtractClaimsFromRequestContext ExtractClaims
}
ClaimsExtractor struct that holds the extract function
func NewClaimsExtractor ¶
func NewClaimsExtractor(e ExtractClaims) *ClaimsExtractor
NewClaimsExtractor returns an extractor, and if provided with a function with ExtractClaims signature, then it will use that logic. Uses ExtractClaimsFromRequestContext by default
type ExtractClaims ¶
type ExtractClaims func(r *http.Request, authAudiance string) AuthorizationClaims
Extract function type
Click to show internal directories.
Click to hide internal directories.