From d104864f087d91b6374909ac5bae79a153dee372 Mon Sep 17 00:00:00 2001 From: "maruyama.t" Date: Tue, 16 May 2023 00:28:50 +0000 Subject: [PATCH] =?UTF-8?q?Merged=20PR=20108:=20changePassword=E5=87=A6?= =?UTF-8?q?=E7=90=86=E6=99=82=E3=81=AE=E6=A8=A9=E9=99=90=E3=81=AE=E8=AA=BF?= =?UTF-8?q?=E6=9F=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 概要 [Task1754: changePassword処理時の権限の調査](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/1754) - graphClient.api.patchは戻り値を返さないので、changePasswordの戻り値をvoidに変更しました - Azure AD B2C上のアプリケーション「adb2c-graph-app」に対して以下の変更を行いました - アクセス許可に「Directory.ReadWrite.All」「User.ManageIdentities.All」「User.ReadWrite.All」を追加 - 「adb2c-graph-app」にユーザー管理者権限を付与 参考URL:https://blog.kokoni.jp/2021-01-23-142542/ ## レビューポイント - 特になし ## UIの変更 - 無し ## 動作確認状況 - ローカルで確認 ## 補足 - 相談、参考資料などがあれば --- .../src/gateways/adb2c/adb2c.service.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/dictation_server/src/gateways/adb2c/adb2c.service.ts b/dictation_server/src/gateways/adb2c/adb2c.service.ts index 088b847..1a81390 100644 --- a/dictation_server/src/gateways/adb2c/adb2c.service.ts +++ b/dictation_server/src/gateways/adb2c/adb2c.service.ts @@ -40,6 +40,7 @@ export class AdB2cService { const authProvider = new TokenCredentialAuthenticationProvider(credential, { scopes: ['https://graph.microsoft.com/.default'], }); + this.graphClient = Client.initWithMiddleware({ authProvider }); } @@ -143,21 +144,15 @@ export class AdB2cService { * @param externalId ユーザ情報 * @param password パスワード */ - async changePassword( - externalId: string, - password: string, - ): Promise<{ sub: string }> { + async changePassword(externalId: string, password: string): Promise { this.logger.log(`[IN] ${this.changePassword.name}`); try { // ADB2Cのユーザのパスワードを変更する - const changeUser = await this.graphClient - .api(`/users/${externalId}`) - .patch({ - passwordProfile: { - password: password, - }, - }); - return { sub: changeUser.id }; + await this.graphClient.api(`/users/${externalId}`).patch({ + passwordProfile: { + password: password, + }, + }); } catch (e) { this.logger.error(e); throw e;