fix: unmarshalling of scopes in access token (#327)

The Scopes field in accessTokenClaims should be a  SpaceDelimitedArray,
in order to allow for correct unmarshalling.

Fixes #318

* adjust test data
This commit is contained in:
Tim Möhlmann 2023-03-15 15:44:49 +02:00 committed by GitHub
parent 0f3d4f4828
commit c6820ba88a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View file

@ -13,10 +13,7 @@
"some",
"methods"
],
"scope": [
"email",
"phone"
],
"scope": "email phone",
"client_id": "777",
"exp": 12345,
"iat": 12000,

View file

@ -97,8 +97,8 @@ func (c *TokenClaims) SetSignatureAlgorithm(algorithm jose.SignatureAlgorithm) {
type AccessTokenClaims struct {
TokenClaims
Scopes []string `json:"scope,omitempty"`
Claims map[string]any `json:"-"`
Scopes SpaceDelimitedArray `json:"scope,omitempty"`
Claims map[string]any `json:"-"`
}
func NewAccessTokenClaims(issuer, subject string, audience []string, expiration time.Time, jwtid, clientID string, skew time.Duration) *AccessTokenClaims {