jwtclaims

package
v0.0.0-...-5f71cfe Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: BSD-3-Clause Imports: 2 Imported by: 0

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

Jump to

Keyboard shortcuts

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