fix: add nonce to supported claims
This commit is contained in:
parent
a916b8c32c
commit
de4381261e
|
@ -39,7 +39,6 @@ export default function Root({
|
||||||
? searchParams.get('scope')?.toString().split(' ')
|
? searchParams.get('scope')?.toString().split(' ')
|
||||||
: ['openid', 'profile', 'email'];
|
: ['openid', 'profile', 'email'];
|
||||||
const code = searchParams.get('code') || ''
|
const code = searchParams.get('code') || ''
|
||||||
const nonce = searchParams.get('nonce') || ''
|
|
||||||
|
|
||||||
const urlProps: Record<string, any> = {
|
const urlProps: Record<string, any> = {
|
||||||
state,
|
state,
|
||||||
|
@ -59,14 +58,12 @@ export default function Root({
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (token) {
|
if (token) {
|
||||||
let redirectURL = config.redirectURL || '/app';
|
let redirectURL = config.redirectURL || '/app';
|
||||||
let params = `access_token=${token.access_token}&id_token=${token.id_token}&expires_in=${token.expires_in}&state=${globalState.state}&code=`+code;
|
let params = `access_token=${token.access_token}&id_token=${token.id_token}&expires_in=${token.expires_in}&state=${globalState.state}`;
|
||||||
|
|
||||||
if (code !== '') {
|
if (code !== '') {
|
||||||
params += `&code=${code}`
|
params += `&code=${code}`
|
||||||
}
|
}
|
||||||
if (nonce !== '') {
|
|
||||||
params += `&nonce=${nonce}`
|
|
||||||
}
|
|
||||||
if (token.refresh_token) {
|
if (token.refresh_token) {
|
||||||
params += `&refresh_token=${token.refresh_token}`;
|
params += `&refresh_token=${token.refresh_token}`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ func AuthorizeHandler() gin.HandlerFunc {
|
||||||
// },
|
// },
|
||||||
// })
|
// })
|
||||||
|
|
||||||
params := "code=" + code + "&state=" + state + "&nonce=" + nonce
|
params := "code=" + code + "&state=" + state
|
||||||
if responseMode == constants.ResponseModeQuery {
|
if responseMode == constants.ResponseModeQuery {
|
||||||
if strings.Contains(redirectURI, "?") {
|
if strings.Contains(redirectURI, "?") {
|
||||||
redirectURI = redirectURI + "&" + params
|
redirectURI = redirectURI + "&" + params
|
||||||
|
@ -243,7 +243,7 @@ func AuthorizeHandler() gin.HandlerFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
// used of query mode
|
// used of query mode
|
||||||
params := "access_token=" + authToken.AccessToken.Token + "&token_type=bearer&expires_in=" + strconv.FormatInt(expiresIn, 10) + "&state=" + state + "&id_token=" + authToken.IDToken.Token + "&code=" + code + "&nonce=" + nonce
|
params := "access_token=" + authToken.AccessToken.Token + "&token_type=bearer&expires_in=" + strconv.FormatInt(expiresIn, 10) + "&state=" + state + "&id_token=" + authToken.IDToken.Token + "&code=" + code
|
||||||
|
|
||||||
res := map[string]interface{}{
|
res := map[string]interface{}{
|
||||||
"access_token": authToken.AccessToken.Token,
|
"access_token": authToken.AccessToken.Token,
|
||||||
|
@ -253,7 +253,6 @@ func AuthorizeHandler() gin.HandlerFunc {
|
||||||
"token_type": "Bearer",
|
"token_type": "Bearer",
|
||||||
"expires_in": expiresIn,
|
"expires_in": expiresIn,
|
||||||
"code": code,
|
"code": code,
|
||||||
"nonce": nonce,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if authToken.RefreshToken != nil {
|
if authToken.RefreshToken != nil {
|
||||||
|
|
|
@ -24,7 +24,7 @@ func OpenIDConfigurationHandler() gin.HandlerFunc {
|
||||||
"scopes_supported": []string{"openid", "email", "profile", "email_verified", "given_name", "family_name", "nick_name", "picture"},
|
"scopes_supported": []string{"openid", "email", "profile", "email_verified", "given_name", "family_name", "nick_name", "picture"},
|
||||||
"response_modes_supported": []string{"query", "fragment", "form_post", "web_message"},
|
"response_modes_supported": []string{"query", "fragment", "form_post", "web_message"},
|
||||||
"id_token_signing_alg_values_supported": []string{jwtType},
|
"id_token_signing_alg_values_supported": []string{jwtType},
|
||||||
"claims_supported": []string{"aud", "exp", "iss", "iat", "sub", "given_name", "family_name", "middle_name", "nickname", "preferred_username", "picture", "email", "email_verified", "roles", "gender", "birthdate", "phone_number", "phone_number_verified"},
|
"claims_supported": []string{"aud", "exp", "iss", "iat", "sub", "given_name", "family_name", "middle_name", "nickname", "preferred_username", "picture", "email", "email_verified", "roles", "gender", "birthdate", "phone_number", "phone_number_verified", "nonce"},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import (
|
||||||
func TokenHandler() gin.HandlerFunc {
|
func TokenHandler() gin.HandlerFunc {
|
||||||
return func(gc *gin.Context) {
|
return func(gc *gin.Context) {
|
||||||
var reqBody map[string]string
|
var reqBody map[string]string
|
||||||
if err := gc.BindJSON(&reqBody); err != nil {
|
if err := gc.Bind(&reqBody); err != nil {
|
||||||
log.Debug("Error binding JSON: ", err)
|
log.Debug("Error binding JSON: ", err)
|
||||||
gc.JSON(http.StatusBadRequest, gin.H{
|
gc.JSON(http.StatusBadRequest, gin.H{
|
||||||
"error": "error_binding_json",
|
"error": "error_binding_json",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user