mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-10 05:45:52 +08:00
fix(NET-1155): sso login changes (#2905)
* fix(NET-1155): prompt for user account on each sso login * fix(NET-1152): correct pending user response from rac
This commit is contained in:
parent
7de252f996
commit
4a8ce7b6fa
5 changed files with 5 additions and 5 deletions
|
@ -121,7 +121,7 @@ func getAzureUserInfo(state string, code string) (*OAuthUser, error) {
|
||||||
if (!isValid || state != oauth_state_string) && !isStateCached(state) {
|
if (!isValid || state != oauth_state_string) && !isStateCached(state) {
|
||||||
return nil, fmt.Errorf("invalid oauth state")
|
return nil, fmt.Errorf("invalid oauth state")
|
||||||
}
|
}
|
||||||
var token, err = auth_provider.Exchange(context.Background(), code)
|
var token, err = auth_provider.Exchange(context.Background(), code, oauth2.SetAuthURLParam("prompt", "login"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("code exchange failed: %s", err.Error())
|
return nil, fmt.Errorf("code exchange failed: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ func getGithubUserInfo(state string, code string) (*OAuthUser, error) {
|
||||||
if (!isValid || state != oauth_state_string) && !isStateCached(state) {
|
if (!isValid || state != oauth_state_string) && !isStateCached(state) {
|
||||||
return nil, fmt.Errorf("invalid oauth state")
|
return nil, fmt.Errorf("invalid oauth state")
|
||||||
}
|
}
|
||||||
var token, err = auth_provider.Exchange(context.Background(), code)
|
var token, err = auth_provider.Exchange(context.Background(), code, oauth2.SetAuthURLParam("prompt", "login"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("code exchange failed: %s", err.Error())
|
return nil, fmt.Errorf("code exchange failed: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ func getGoogleUserInfo(state string, code string) (*OAuthUser, error) {
|
||||||
if (!isValid || state != oauth_state_string) && !isStateCached(state) {
|
if (!isValid || state != oauth_state_string) && !isStateCached(state) {
|
||||||
return nil, fmt.Errorf("invalid oauth state")
|
return nil, fmt.Errorf("invalid oauth state")
|
||||||
}
|
}
|
||||||
var token, err = auth_provider.Exchange(context.Background(), code)
|
var token, err = auth_provider.Exchange(context.Background(), code, oauth2.SetAuthURLParam("prompt", "login"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("code exchange failed: %s", err.Error())
|
return nil, fmt.Errorf("code exchange failed: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ func HandleHeadlessSSOCallback(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
// check if user approval is already pending
|
// check if user approval is already pending
|
||||||
if logic.IsPendingUser(userClaims.getUserName()) {
|
if logic.IsPendingUser(userClaims.getUserName()) {
|
||||||
handleOauthUserNotAllowed(w)
|
handleOauthUserSignUpApprovalPending(w)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
user, err := logic.GetUser(userClaims.getUserName())
|
user, err := logic.GetUser(userClaims.getUserName())
|
||||||
|
|
|
@ -146,7 +146,7 @@ func getOIDCUserInfo(state string, code string) (u *OAuthUser, e error) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), OIDC_TIMEOUT)
|
ctx, cancel := context.WithTimeout(context.Background(), OIDC_TIMEOUT)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
oauth2Token, err := auth_provider.Exchange(ctx, code)
|
oauth2Token, err := auth_provider.Exchange(ctx, code, oauth2.SetAuthURLParam("prompt", "login"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to exchange oauth2 token using code \"%s\"", code)
|
return nil, fmt.Errorf("failed to exchange oauth2 token using code \"%s\"", code)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue