fix(providers): set prompt select_account again (#5329)

This commit is contained in:
Livio Spring
2023-03-01 08:17:51 +01:00
committed by GitHub
parent 3dbb6f7c67
commit 966df56026
10 changed files with 13 additions and 12 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"github.com/zitadel/oidc/v2/pkg/client/rp"
"github.com/zitadel/oidc/v2/pkg/oidc"
"golang.org/x/oauth2"
"github.com/zitadel/zitadel/internal/idp"
@@ -87,7 +88,7 @@ func (p *Provider) Name() string {
// BeginAuth implements the [idp.Provider] interface.
// It will create a [Session] with an OAuth2.0 authorization request as AuthURL.
func (p *Provider) BeginAuth(ctx context.Context, state string, _ ...any) (idp.Session, error) {
url := rp.AuthURL(state, p.RelyingParty)
url := rp.AuthURL(state, p.RelyingParty, rp.WithPrompt(oidc.PromptSelectAccount))
return &Session{AuthURL: url, Provider: p}, nil
}

View File

@@ -38,7 +38,7 @@ func TestProvider_BeginAuth(t *testing.T) {
Scopes: []string{"user"},
},
},
want: &Session{AuthURL: "https://oauth2.com/authorize?client_id=clientID&redirect_uri=redirectURI&response_type=code&scope=user&state=testState"},
want: &Session{AuthURL: "https://oauth2.com/authorize?client_id=clientID&prompt=select_account&redirect_uri=redirectURI&response_type=code&scope=user&state=testState"},
},
}
for _, tt := range tests {