Compare commits
5 Commits
1.1.21.bet
...
1.1.21.bet
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a68876a6f4 | ||
![]() |
2c867b0314 | ||
![]() |
74b858ac24 | ||
![]() |
fedc3173fe | ||
![]() |
de4381261e |
@@ -39,7 +39,6 @@ export default function Root({
|
||||
? searchParams.get('scope')?.toString().split(' ')
|
||||
: ['openid', 'profile', 'email'];
|
||||
const code = searchParams.get('code') || ''
|
||||
const nonce = searchParams.get('nonce') || ''
|
||||
|
||||
const urlProps: Record<string, any> = {
|
||||
state,
|
||||
@@ -59,14 +58,12 @@ export default function Root({
|
||||
useEffect(() => {
|
||||
if (token) {
|
||||
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 !== '') {
|
||||
params += `&code=${code}`
|
||||
}
|
||||
if (nonce !== '') {
|
||||
params += `&nonce=${nonce}`
|
||||
}
|
||||
|
||||
if (token.refresh_token) {
|
||||
params += `&refresh_token=${token.refresh_token}`;
|
||||
}
|
||||
|
@@ -42,6 +42,7 @@ func AuthorizeHandler() gin.HandlerFunc {
|
||||
scopeString := strings.TrimSpace(gc.Query("scope"))
|
||||
clientID := strings.TrimSpace(gc.Query("client_id"))
|
||||
responseMode := strings.TrimSpace(gc.Query("response_mode"))
|
||||
nonce := strings.TrimSpace(gc.Query("nonce"))
|
||||
|
||||
var scope []string
|
||||
if scopeString == "" {
|
||||
@@ -78,11 +79,13 @@ func AuthorizeHandler() gin.HandlerFunc {
|
||||
})
|
||||
|
||||
code := uuid.New().String()
|
||||
nonce := uuid.New().String()
|
||||
if nonce == "" {
|
||||
nonce = uuid.New().String()
|
||||
}
|
||||
memorystore.Provider.SetState(codeChallenge, code)
|
||||
|
||||
// used for response mode query or fragment
|
||||
loginState := "state=" + state + "&scope=" + strings.Join(scope, " ") + "&redirect_uri=" + redirectURI + "&code=" + code + "&nonce=" + nonce
|
||||
loginState := "state=" + state + "&scope=" + strings.Join(scope, " ") + "&redirect_uri=" + redirectURI + "&code=" + code
|
||||
loginURL := "/app?" + loginState
|
||||
|
||||
if responseMode == constants.ResponseModeFragment {
|
||||
@@ -188,7 +191,7 @@ func AuthorizeHandler() gin.HandlerFunc {
|
||||
// },
|
||||
// })
|
||||
|
||||
params := "code=" + code + "&state=" + state + "&nonce=" + nonce
|
||||
params := "code=" + code + "&state=" + state
|
||||
if responseMode == constants.ResponseModeQuery {
|
||||
if strings.Contains(redirectURI, "?") {
|
||||
redirectURI = redirectURI + "&" + params
|
||||
@@ -243,7 +246,7 @@ func AuthorizeHandler() gin.HandlerFunc {
|
||||
}
|
||||
|
||||
// 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{}{
|
||||
"access_token": authToken.AccessToken.Token,
|
||||
@@ -253,7 +256,6 @@ func AuthorizeHandler() gin.HandlerFunc {
|
||||
"token_type": "Bearer",
|
||||
"expires_in": expiresIn,
|
||||
"code": code,
|
||||
"nonce": nonce,
|
||||
}
|
||||
|
||||
if authToken.RefreshToken != nil {
|
||||
|
@@ -17,14 +17,14 @@ func OpenIDConfigurationHandler() gin.HandlerFunc {
|
||||
c.JSON(200, gin.H{
|
||||
"issuer": issuer,
|
||||
"authorization_endpoint": issuer + "/authorize",
|
||||
"token_endpoint": issuer + "/token",
|
||||
"token_endpoint": issuer + "/oauth/token",
|
||||
"userinfo_endpoint": issuer + "/userinfo",
|
||||
"jwks_uri": issuer + "/.well-known/jwks.json",
|
||||
"response_types_supported": []string{"code", "token", "id_token"},
|
||||
"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"},
|
||||
"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"},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@@ -91,7 +91,7 @@ func GetDomainName(uri string) string {
|
||||
return host
|
||||
}
|
||||
|
||||
// GetAppURL to get /app/ url if not configured by user
|
||||
// GetAppURL to get /app url if not configured by user
|
||||
func GetAppURL(gc *gin.Context) string {
|
||||
envAppURL, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAppURL)
|
||||
if envAppURL == "" || err != nil {
|
||||
|
Reference in New Issue
Block a user