From 8cd0498db46650d6239766482f51f75e7601c4a3 Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Fri, 16 Sep 2022 17:36:13 +0300 Subject: [PATCH] include client in id token issue --- package.json | 2 +- src/controller/authorization.ts | 1 + src/controller/tokens/authorizationCode.ts | 8 +++++++- src/model/model.ts | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8a60fff..e7a19c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@icynet/oauth2-provider", - "version": "1.0.2", + "version": "1.0.3", "description": "OAuth2.0 Provider for Icy Network", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/controller/authorization.ts b/src/controller/authorization.ts index f61f8aa..2758b6b 100644 --- a/src/controller/authorization.ts +++ b/src/controller/authorization.ts @@ -208,6 +208,7 @@ export const authorization = wrap(async (req, res) => { data = await oauth2.model.jwt.issueIdToken( user, + client, scope, redirectUri, req.query.nonce as string | undefined diff --git a/src/controller/tokens/authorizationCode.ts b/src/controller/tokens/authorizationCode.ts index 1b31d10..8be9463 100644 --- a/src/controller/tokens/authorizationCode.ts +++ b/src/controller/tokens/authorizationCode.ts @@ -116,7 +116,13 @@ export async function authorizationCode( ); try { - respObj.id_token = await oauth2.model.jwt.issueIdToken(user, cleanScope, undefined, code.nonce); + respObj.id_token = await oauth2.model.jwt.issueIdToken( + user, + client, + cleanScope, + undefined, + code.nonce + ); } catch (err) { oauth2.logger.error(err); throw new ServerError('Failed to issue an ID token'); diff --git a/src/model/model.ts b/src/model/model.ts index 79ff6b1..6a5b9df 100644 --- a/src/model/model.ts +++ b/src/model/model.ts @@ -327,6 +327,7 @@ export interface JWTAdapter { */ issueIdToken: ( user: OAuth2User, + client: OAuth2Client, scope: string[], redirectUri?: string, nonce?: string