From e609d9196070050adf39b9bdb3cbfbba2edda0d5 Mon Sep 17 00:00:00 2001 From: Nestor Date: Sun, 23 May 2021 15:25:59 +0200 Subject: [PATCH] fix: revert float64 auth_time claim (#599) Closes #598 --- token/jwt/claims_id_token.go | 2 +- token/jwt/claims_id_token_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/token/jwt/claims_id_token.go b/token/jwt/claims_id_token.go index ba7726e17..29ed83a1b 100644 --- a/token/jwt/claims_id_token.go +++ b/token/jwt/claims_id_token.go @@ -110,7 +110,7 @@ func (c *IDTokenClaims) ToMap() map[string]interface{} { } if !c.AuthTime.IsZero() { - ret["auth_time"] = float64(c.AuthTime.Unix()) // jwt-go does not support int64 as datatype + ret["auth_time"] = c.AuthTime.Unix() } else { delete(ret, "auth_time") } diff --git a/token/jwt/claims_id_token_test.go b/token/jwt/claims_id_token_test.go index bfe909d52..abd09f466 100644 --- a/token/jwt/claims_id_token_test.go +++ b/token/jwt/claims_id_token_test.go @@ -70,7 +70,7 @@ func TestIDTokenClaimsToMap(t *testing.T) { "baz": idTokenClaims.Extra["baz"], "at_hash": idTokenClaims.AccessTokenHash, "c_hash": idTokenClaims.CodeHash, - "auth_time": float64(idTokenClaims.AuthTime.Unix()), + "auth_time": idTokenClaims.AuthTime.Unix(), "acr": idTokenClaims.AuthenticationContextClassReference, "amr": idTokenClaims.AuthenticationMethodsReference, }, idTokenClaims.ToMap()) @@ -88,7 +88,7 @@ func TestIDTokenClaimsToMap(t *testing.T) { "baz": idTokenClaims.Extra["baz"], "at_hash": idTokenClaims.AccessTokenHash, "c_hash": idTokenClaims.CodeHash, - "auth_time": float64(idTokenClaims.AuthTime.Unix()), + "auth_time": idTokenClaims.AuthTime.Unix(), "acr": idTokenClaims.AuthenticationContextClassReference, "amr": idTokenClaims.AuthenticationMethodsReference, "nonce": idTokenClaims.Nonce,