forked from casdoor/casdoor
fix: forward RFC 8707 resource parameter to /api/login in web login flow
Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
This commit is contained in:
@@ -159,6 +159,7 @@
|
||||
codeChallenge: getRefinedValue(innerParams.get("code_challenge")),
|
||||
responseMode: getRefinedValue(innerParams.get("response_mode")),
|
||||
relayState: getRefinedValue(lowercaseQueries["relaystate"]),
|
||||
resource: getRefinedValue(innerParams.get("resource")),
|
||||
type: "code"
|
||||
};
|
||||
}
|
||||
@@ -176,7 +177,8 @@
|
||||
"&state=" + oAuthParams.state +
|
||||
"&nonce=" + oAuthParams.nonce +
|
||||
"&code_challenge_method=" + oAuthParams.challengeMethod +
|
||||
"&code_challenge=" + oAuthParams.codeChallenge;
|
||||
"&code_challenge=" + oAuthParams.codeChallenge +
|
||||
"&resource=" + encodeURIComponent(oAuthParams.resource || "");
|
||||
}
|
||||
|
||||
function createFormAndSubmit(action, params) {
|
||||
|
||||
@@ -57,7 +57,7 @@ export function oAuthParamsToQuery(oAuthParams) {
|
||||
}
|
||||
|
||||
// code
|
||||
return `?clientId=${oAuthParams.clientId}&responseType=${oAuthParams.responseType}&redirectUri=${encodeURIComponent(oAuthParams.redirectUri)}&type=${oAuthParams.type}&scope=${oAuthParams.scope}&state=${oAuthParams.state}&nonce=${oAuthParams.nonce}&code_challenge_method=${oAuthParams.challengeMethod}&code_challenge=${oAuthParams.codeChallenge}`;
|
||||
return `?clientId=${oAuthParams.clientId}&responseType=${oAuthParams.responseType}&redirectUri=${encodeURIComponent(oAuthParams.redirectUri)}&type=${oAuthParams.type}&scope=${oAuthParams.scope}&state=${oAuthParams.state}&nonce=${oAuthParams.nonce}&code_challenge_method=${oAuthParams.challengeMethod}&code_challenge=${oAuthParams.codeChallenge}&resource=${encodeURIComponent(oAuthParams.resource || "")}`;
|
||||
}
|
||||
|
||||
export function getApplicationLogin(params) {
|
||||
|
||||
@@ -141,6 +141,7 @@ export function getOAuthGetParameters(params) {
|
||||
const samlRequest = getRefinedValue(lowercaseQueries["samlRequest".toLowerCase()]);
|
||||
const relayState = getRefinedValue(lowercaseQueries["RelayState".toLowerCase()]);
|
||||
const noRedirect = getRefinedValue(lowercaseQueries["noRedirect".toLowerCase()]);
|
||||
const resource = getRefinedValue(queries.get("resource"));
|
||||
|
||||
if (clientId === "" && samlRequest === "") {
|
||||
// login
|
||||
@@ -160,6 +161,7 @@ export function getOAuthGetParameters(params) {
|
||||
samlRequest: samlRequest,
|
||||
relayState: relayState,
|
||||
noRedirect: noRedirect,
|
||||
resource: resource,
|
||||
type: "code",
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user