Documentation ¶
Index ¶
- func GetAccessClaims(encodedToken string, keys []JWKey, claims *AccessTokenClaims) error
- func GetBaseClaims(encodedToken string, keys []JWKey, claims *BaseTokenClaims) error
- func GetIDClaims(encodedToken string, keys []JWKey, claims *IDTokenClaims) error
- type AccessTokenClaims
- type BaseTokenClaims
- type Context
- type ContextBuilder
- type IDTokenClaims
- type JWKey
- type PolicyBuilder
- type ResponseBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAccessClaims ¶
func GetAccessClaims(encodedToken string, keys []JWKey, claims *AccessTokenClaims) error
GetAccessClaims fills claims with Access type token data.
func GetBaseClaims ¶
func GetBaseClaims(encodedToken string, keys []JWKey, claims *BaseTokenClaims) error
GetStandardClaims fills claims with standard token type data.
func GetIDClaims ¶
func GetIDClaims(encodedToken string, keys []JWKey, claims *IDTokenClaims) error
GetIDClaims fills claims with ID type token data.
Types ¶
type AccessTokenClaims ¶
type AccessTokenClaims struct { AuthTime int64 `json:"auth_time"` Scope string `json:"scope"` Username string `json:"username"` BaseTokenClaims }
AccessTokenClaims represents claims stored in Access type JW token.
type BaseTokenClaims ¶
type BaseTokenClaims struct { TokenUse string `json:"token_use"` jwt.StandardClaims }
BaseTokenClaims is a common structure for token data.
type Context ¶
type Context struct { Region string ApplicationID string Stage string AllowedUserPoolID string CognitoClients []string DecryptionKeys []JWKey }
Context is a preset of data needed to build a response.
type ContextBuilder ¶
ContextBuilder interface for building context passed to resource server.
type IDTokenClaims ¶
type IDTokenClaims struct { EmailVerified bool `json:"email_verified"` AuthTime int64 `json:"auth_time"` CognitoUsername string `json:"cognito:username"` GivenName string `json:"given_name"` Email string `json:"email"` BaseTokenClaims }
IDTokenClaims represents claims stored in ID type JW token
type JWKey ¶
type JWKey struct { Algorithm string `json:"alg"` Exponent string `json:"e"` KeyID string `json:"kid"` KeyType string `json:"kty"` N string `json:"n"` Use string `json:"use"` }
JWKey struct holds information about JSON web key.
func GetDecryptionKeys ¶
GetDecryptionKeys gets JW token description keys from AWS Cognito service.
func RequestKeys ¶
RequestKeys retrieves decryption keys from external service.
type PolicyBuilder ¶
type PolicyBuilder interface {
BuildPolicy(encodedToken string) (events.APIGatewayCustomAuthorizerPolicy, error)
}
PolicyBuilder interface for building API GW custom authorizer policy.
type ResponseBuilder ¶
type ResponseBuilder struct { Context *Context PolicyBuilder PolicyBuilder ContextBuilder ContextBuilder }
ResponseBuilder struct for building proper custom authorizer response.
func (ResponseBuilder) BuildResponse ¶
func (b ResponseBuilder) BuildResponse(encodedToken string) (events.APIGatewayCustomAuthorizerResponse, error)
BuildResponse builds a proper custom authorizer response based on context, policy and context builders.