mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 18:17:35 +00:00
fix: add authURLParams to urls for external idps (#5404)
add authURL parameters to urls for external IDPs, depended on the contents of the authRequest --------- Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
@@ -92,7 +92,7 @@ func (p *Provider) Name() string {
|
||||
// It will create a [Session] with an AuthURL, pointing to the jwtEndpoint
|
||||
// with the authRequest and encrypted userAgent ids.
|
||||
func (p *Provider) BeginAuth(ctx context.Context, state string, params ...any) (idp.Session, error) {
|
||||
if len(params) != 1 {
|
||||
if len(params) < 1 {
|
||||
return nil, ErrMissingUserAgentID
|
||||
}
|
||||
userAgentID, ok := params[0].(string)
|
||||
|
@@ -87,8 +87,14 @@ 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, rp.WithPrompt(oidc.PromptSelectAccount))
|
||||
func (p *Provider) BeginAuth(ctx context.Context, state string, params ...any) (idp.Session, error) {
|
||||
opts := []rp.AuthURLOpt{rp.WithPrompt(oidc.PromptSelectAccount)}
|
||||
for _, param := range params {
|
||||
if option, ok := param.(rp.AuthURLOpt); ok {
|
||||
opts = append(opts, option)
|
||||
}
|
||||
}
|
||||
url := rp.AuthURL(state, p.RelyingParty, opts...)
|
||||
return &Session{AuthURL: url, Provider: p}, nil
|
||||
}
|
||||
|
||||
|
@@ -112,8 +112,14 @@ func (p *Provider) Name() string {
|
||||
|
||||
// BeginAuth implements the [idp.Provider] interface.
|
||||
// It will create a [Session] with an OIDC authorization request as AuthURL.
|
||||
func (p *Provider) BeginAuth(ctx context.Context, state string, _ ...any) (idp.Session, error) {
|
||||
url := rp.AuthURL(state, p.RelyingParty, p.authOptions...)
|
||||
func (p *Provider) BeginAuth(ctx context.Context, state string, params ...any) (idp.Session, error) {
|
||||
opts := p.authOptions
|
||||
for _, param := range params {
|
||||
if option, ok := param.(rp.AuthURLOpt); ok {
|
||||
opts = append(opts, option)
|
||||
}
|
||||
}
|
||||
url := rp.AuthURL(state, p.RelyingParty, opts...)
|
||||
return &Session{AuthURL: url, Provider: p}, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user