mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 13:20:19 +08:00
feat: add PKCE support (#434)
* feat: add PKCE support Signed-off-by: Steve0x2a <stevesough@gmail.com> * fix: error output when challenge is empty Signed-off-by: Steve0x2a <stevesough@gmail.com>
This commit is contained in:
@ -44,7 +44,7 @@ function oAuthParamsToQuery(oAuthParams) {
|
||||
}
|
||||
|
||||
// code
|
||||
return `?clientId=${oAuthParams.clientId}&responseType=${oAuthParams.responseType}&redirectUri=${oAuthParams.redirectUri}&scope=${oAuthParams.scope}&state=${oAuthParams.state}&nonce=${oAuthParams.nonce}`;
|
||||
return `?clientId=${oAuthParams.clientId}&responseType=${oAuthParams.responseType}&redirectUri=${oAuthParams.redirectUri}&scope=${oAuthParams.scope}&state=${oAuthParams.state}&nonce=${oAuthParams.nonce}&code_challenge_method=${oAuthParams.challengeMethod}&code_challenge=${oAuthParams.codeChallenge}`;
|
||||
}
|
||||
|
||||
export function getApplicationLogin(oAuthParams) {
|
||||
|
@ -83,7 +83,9 @@ export function getOAuthGetParameters(params) {
|
||||
const scope = queries.get("scope");
|
||||
const state = queries.get("state");
|
||||
const nonce = queries.get("nonce")
|
||||
|
||||
const challengeMethod = queries.get("code_challenge_method")
|
||||
const codeChallenge = queries.get("code_challenge")
|
||||
|
||||
if (clientId === undefined || clientId === null) {
|
||||
// login
|
||||
return null;
|
||||
@ -96,6 +98,8 @@ export function getOAuthGetParameters(params) {
|
||||
scope: scope,
|
||||
state: state,
|
||||
nonce: nonce,
|
||||
challengeMethod: challengeMethod,
|
||||
codeChallenge: codeChallenge,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user