feat: add required jwt claims
This commit is contained in:
parent
5bf26f7385
commit
dfa96f09a0
|
@ -67,6 +67,9 @@ func CreateRefreshToken(user models.User, roles []string) (string, int64, error)
|
||||||
expiresAt := time.Now().Add(expiryBound).Unix()
|
expiresAt := time.Now().Add(expiryBound).Unix()
|
||||||
|
|
||||||
customClaims := jwt.MapClaims{
|
customClaims := jwt.MapClaims{
|
||||||
|
"iss": "",
|
||||||
|
"aud": "",
|
||||||
|
"sub": user.ID,
|
||||||
"exp": expiresAt,
|
"exp": expiresAt,
|
||||||
"iat": time.Now().Unix(),
|
"iat": time.Now().Unix(),
|
||||||
"token_type": constants.TokenTypeRefreshToken,
|
"token_type": constants.TokenTypeRefreshToken,
|
||||||
|
@ -94,6 +97,10 @@ func CreateAccessToken(user models.User, roles []string) (string, int64, error)
|
||||||
|
|
||||||
claimKey := envstore.EnvInMemoryStoreObj.GetStringStoreEnvVariable(constants.EnvKeyJwtRoleClaim)
|
claimKey := envstore.EnvInMemoryStoreObj.GetStringStoreEnvVariable(constants.EnvKeyJwtRoleClaim)
|
||||||
customClaims := jwt.MapClaims{
|
customClaims := jwt.MapClaims{
|
||||||
|
"iss": "",
|
||||||
|
"aud": "",
|
||||||
|
"nonce": "",
|
||||||
|
"sub": user.ID,
|
||||||
"exp": expiresAt,
|
"exp": expiresAt,
|
||||||
"iat": time.Now().Unix(),
|
"iat": time.Now().Unix(),
|
||||||
"token_type": constants.TokenTypeAccessToken,
|
"token_type": constants.TokenTypeAccessToken,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user