Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add json mappings to default session and its contents #688

Merged
merged 1 commit into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions handler/openid/strategy_jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ type Session interface {

// IDTokenSession is a session container for the id token
type DefaultSession struct {
Claims *jwt.IDTokenClaims
Headers *jwt.Headers
ExpiresAt map[fosite.TokenType]time.Time
Username string
Subject string
Claims *jwt.IDTokenClaims `json:"id_token_claims"`
Headers *jwt.Headers `json:"headers"`
ExpiresAt map[fosite.TokenType]time.Time `json:"expires_at"`
Username string `json:"username"`
Subject string `json:"subject"`
}

func NewDefaultSession() *DefaultSession {
Expand Down
28 changes: 14 additions & 14 deletions token/jwt/claims_id_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ import (

// IDTokenClaims represent the claims used in open id connect requests
type IDTokenClaims struct {
JTI string
Issuer string
Subject string
Audience []string
Nonce string
ExpiresAt time.Time
IssuedAt time.Time
RequestedAt time.Time
AuthTime time.Time
AccessTokenHash string
AuthenticationContextClassReference string
AuthenticationMethodsReferences []string
CodeHash string
Extra map[string]interface{}
JTI string `json:"jti"`
Issuer string `json:"iss"`
Subject string `json:"sub"`
Audience []string `json:"aud"`
Nonce string `json:"nonce"`
ExpiresAt time.Time `json:"exp"`
IssuedAt time.Time `json:"iat"`
RequestedAt time.Time `json:"rat"`
AuthTime time.Time `json:"auth_time"`
AccessTokenHash string `json:"at_hash"`
AuthenticationContextClassReference string `json:"acr"`
AuthenticationMethodsReferences []string `json:"amr"`
CodeHash string `json:"c_hash"`
Extra map[string]interface{} `json:"ext"`
}

// ToMap will transform the headers to a map structure
Expand Down
2 changes: 1 addition & 1 deletion token/jwt/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ package jwt

// Headers is the jwt headers
type Headers struct {
Extra map[string]interface{}
Extra map[string]interface{} `json:"extra"`
}

func NewHeaders() *Headers {
Expand Down