Merged PR 108: changePassword処理時の権限の調査

## 概要
[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の変更
- 無し

## 動作確認状況
- ローカルで確認

## 補足
- 相談、参考資料などがあれば
This commit is contained in:
maruyama.t 2023-05-16 00:28:50 +00:00
parent d982d7e129
commit d104864f08

View File

@ -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<void> {
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;