mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-21 17:26:29 -05:00
refactor(oidc): simplify callback statement
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
f71bf7a974
commit
e7d81c5cdf
1 changed files with 8 additions and 11 deletions
|
@ -187,17 +187,14 @@ export class OidcService {
|
||||||
const code = request.session.oidcLoginCode;
|
const code = request.session.oidcLoginCode;
|
||||||
const state = request.session.oidcLoginState;
|
const state = request.session.oidcLoginState;
|
||||||
const isAutodiscovered = clientConfig.config.authorizeUrl === undefined;
|
const isAutodiscovered = clientConfig.config.authorizeUrl === undefined;
|
||||||
const tokenSet = isAutodiscovered
|
const callbackMethod = isAutodiscovered
|
||||||
? await client.callback(clientConfig.redirectUri, params, {
|
? client.callback.bind(this)
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
: client.oauthCallback.bind(this);
|
||||||
code_verifier: code,
|
const tokenSet = await callbackMethod(clientConfig.redirectUri, params, {
|
||||||
state,
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
})
|
code_verifier: code,
|
||||||
: await client.oauthCallback(clientConfig.redirectUri, params, {
|
state,
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
});
|
||||||
code_verifier: code,
|
|
||||||
state,
|
|
||||||
});
|
|
||||||
|
|
||||||
request.session.oidcIdToken = tokenSet.id_token;
|
request.session.oidcIdToken = tokenSet.id_token;
|
||||||
const userInfoResponse = await client.userinfo(tokenSet);
|
const userInfoResponse = await client.userinfo(tokenSet);
|
||||||
|
|
Loading…
Reference in a new issue