fix: set jwt ID for client assertion to prevent token replay

This commit is contained in:
Trong Huu Nguyen
2021-09-30 15:38:23 +02:00
parent 2ec1b7ace9
commit 8f9cb671c6
2 changed files with 3 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ package config
import (
"encoding/json"
"github.com/google/uuid"
"github.com/nais/wonderwall/pkg/token"
"gopkg.in/square/go-jose.v2"
"time"
@@ -31,6 +32,7 @@ func (cfg *IDPorten) SignedJWTProfileAssertion(expiration time.Duration) (string
Scopes: token.ScopeOpenID,
ExpiresAt: exp.Unix(),
IssuedAt: iat.Unix(),
JwtID: uuid.New().String(),
}
payload, err := json.Marshal(jwtRequest)

View File

@@ -20,6 +20,7 @@ type JWTTokenRequest struct {
Audience string `json:"aud"`
IssuedAt int64 `json:"iat"`
ExpiresAt int64 `json:"exp"`
JwtID string `json:"jti"`
}
type IDToken struct {