Skip to content

Commit

Permalink
fix(openid/client): prompt parameter is optional
Browse files Browse the repository at this point in the history
  • Loading branch information
tronghn committed Jan 24, 2025
1 parent 0b32d88 commit 062e7b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/openid/client/login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ func TestLogin_URL(t *testing.T) {
assert.Contains(t, query, "ui_locales")
assert.ElementsMatch(t, query["acr_values"], []string{openidConfig.Client().ACRValues()})
assert.ElementsMatch(t, query["ui_locales"], []string{openidConfig.Client().UILocales()})
assert.NotContains(t, query, "prompt")
assert.NotContains(t, query, "max_age")
}
}
})
Expand Down
5 changes: 3 additions & 2 deletions pkg/openid/oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package openid
import (
"fmt"
"net/url"
"strings"

"github.com/nais/wonderwall/pkg/openid/scopes"

"golang.org/x/oauth2"
)
Expand Down Expand Up @@ -49,7 +50,6 @@ func (a AuthorizationCodeParams) AuthParams() AuthParams {
"code_challenge": oauth2.S256ChallengeFromVerifier(a.CodeVerifier),
"code_challenge_method": "S256",
"nonce": a.Nonce,
"prompt": a.Prompt,
"redirect_uri": a.RedirectURI,
"response_mode": "query",
"response_type": "code",
Expand All @@ -66,6 +66,7 @@ func (a AuthorizationCodeParams) AuthParams() AuthParams {
}

if len(a.Prompt) > 0 {
params["prompt"] = a.Prompt
params["max_age"] = "0"
}

Expand Down

0 comments on commit 062e7b0

Please sign in to comment.