pkg/client/rp: Update PKCE logic to pass request if required by cookie handler.
Signed-off-by: Mark Laing <mark.laing@canonical.com>
This commit is contained in:
parent
5cad5e7c9d
commit
8e86a8e01e
1 changed files with 8 additions and 1 deletions
|
@ -415,7 +415,14 @@ func AuthURLHandler(stateFn func() string, rp RelyingParty, urlParam ...URLParam
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if rp.IsPKCE() {
|
if rp.IsPKCE() {
|
||||||
codeChallenge, err := GenerateAndStoreCodeChallenge(w, rp)
|
var codeChallenge string
|
||||||
|
var err error
|
||||||
|
if rp.CookieHandler().IsRequestAware() {
|
||||||
|
codeChallenge, err = GenerateAndStoreCodeChallengeWithRequest(r, w, rp)
|
||||||
|
} else {
|
||||||
|
codeChallenge, err = GenerateAndStoreCodeChallenge(w, rp)
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
unauthorizedError(w, r, "failed to create code challenge: "+err.Error(), state, rp)
|
unauthorizedError(w, r, "failed to create code challenge: "+err.Error(), state, rp)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue