feat: add OIDC feature support. (#373)

1. add nonce parameter.
2. add sub in userinfo endpoint.

Signed-off-by: 0x2a <stevesough@gmail.com>
This commit is contained in:
Steve0x2a
2021-12-15 21:42:16 +08:00
committed by GitHub
parent 370e835499
commit 98f6cc0085
7 changed files with 22 additions and 10 deletions

View File

@ -44,7 +44,7 @@ function oAuthParamsToQuery(oAuthParams) {
}
// code
return `?clientId=${oAuthParams.clientId}&responseType=${oAuthParams.responseType}&redirectUri=${oAuthParams.redirectUri}&scope=${oAuthParams.scope}&state=${oAuthParams.state}`;
return `?clientId=${oAuthParams.clientId}&responseType=${oAuthParams.responseType}&redirectUri=${oAuthParams.redirectUri}&scope=${oAuthParams.scope}&state=${oAuthParams.state}&nonce=${oAuthParams.nonce}`;
}
export function getApplicationLogin(oAuthParams) {

View File

@ -82,6 +82,7 @@ export function getOAuthGetParameters(params) {
const redirectUri = queries.get("redirect_uri");
const scope = queries.get("scope");
const state = queries.get("state");
const nonce = queries.get("nonce")
if (clientId === undefined || clientId === null) {
// login
@ -94,6 +95,7 @@ export function getOAuthGetParameters(params) {
redirectUri: redirectUri,
scope: scope,
state: state,
nonce: nonce,
};
}
}