[server] use scope string instead of string array in tokens

This commit is contained in:
Lakhan Samani 2023-02-07 01:13:03 +05:30
parent a73c6ee49e
commit 4018da6697

View File

@ -137,7 +137,7 @@ func CreateRefreshToken(user models.User, roles, scopes []string, hostname, nonc
"iat": time.Now().Unix(), "iat": time.Now().Unix(),
"token_type": constants.TokenTypeRefreshToken, "token_type": constants.TokenTypeRefreshToken,
"roles": roles, "roles": roles,
"scope": scopes, "scope": strings.Join(scopes, " "),
"nonce": nonce, "nonce": nonce,
"login_method": loginMethod, "login_method": loginMethod,
"allowed_roles": strings.Split(user.Roles, ","), "allowed_roles": strings.Split(user.Roles, ","),
@ -177,7 +177,7 @@ func CreateAccessToken(user models.User, roles, scopes []string, hostName, nonce
"exp": expiresAt, "exp": expiresAt,
"iat": time.Now().Unix(), "iat": time.Now().Unix(),
"token_type": constants.TokenTypeAccessToken, "token_type": constants.TokenTypeAccessToken,
"scope": scopes, "scope": strings.Join(scopes, " "),
"roles": roles, "roles": roles,
"login_method": loginMethod, "login_method": loginMethod,
"allowed_roles": strings.Split(user.Roles, ","), "allowed_roles": strings.Split(user.Roles, ","),