機械翻訳について

パスワードを忘れた場合のページの有効化

このトピックは、ユーザーがパスワードのリセットを要求したときのDigital Customer Serviceの「パスワードのリセット」ページのURLリンクを含めるようにIdentity Cloud Serviceを設定するために必要です。

この機能が動作するには、テナント管理者がIDCS /Settings APIに対してREST要求を行い、allowedNotificationRedirectUrlsを設定してDigital Customer Serviceの「パスワードのリセット」ページのURLを含める必要があります。 この設定では、POST .../admin/v1/MePasswordResetRequestor要求ペイロードでnotificationRedirectUrlの値として指定できる、許可された通知リダイレクトURLを定義します。これは、パスワードを忘れた場合やパスワードのリセット・フローの一部としてユーザーに送信されるパスワードのリセットEメール通知に含まれます。

IDCSでアプリケーションを作成する必要がある場合は、アプリケーション・クライアントの作成を参照してください。

ノート: アイデンティティ管理者ロールが必要です。また、クライアントIDおよびクライアント・シークレットは、アイデンティティ・ドメイン管理者またはセキュリティ管理者のアプリケーション・ロールが付与されているIDCSアプリケーション用である必要があります。 これは、/Settings REST APIを正常に呼び出すために必要です。

次のPowershellスクリプトを使用します。 MacまたはLinuxコンピュータを使用している場合は、まずPowershellをインストールしてスクリプトを実行する必要があります。 詳細は、MicrosoftのWebサイトを参照してください。 Windowsでは、Powershellがデフォルトでインストールされます。

次のスクリプトをpasswordreset.ps1というファイルに保存して、スクリプト内の'...'値を環境に応じて変更します。

  • Windowsのコマンド・プロンプトからスクリプトを実行するには、powershell -File passwordreset.ps1と入力します。

  • MacまたはLinuxでスクリプトを実行するには、pwsh passwordreset.ps1と入力します。

### MODIFY THE FOLLOWING VARIABLES FOR YOUR IDCS/ODCS ENVIRONMENT ###
 
# Set IDCS variables (modify for your IDCS instance)
$IdcsUrl           = '...' # e.g. 'https://idcs-xxx.identity.yyy.idcs-example.com'
$ClientId          = '...' # Client ID for privileged app in IDCS
$ClientSecret      = '...' # Client Secret for privileged app in IDCS
 
# Either set the first 3 variables below for your ODCS app or explictly define $ForgotPasswordUrl
$OdcsHost          = '...' # e.g. 'my-odcs-example.com'
$OdcsAppName       = '...' # e.g. 'my_odcs_app'
$OdcsVersion       = '...' # e.g. '1.1'
$ForgotPasswordUrl = "https://${OdcsHost}/ic/builder/rt/${OdcsAppName}/${OdcsVersion}/webApps/dcs/?page=shell&shell=forgot-password"
 
### DO NOT MODIFY THIS SCRIPT BELOW THIS LINE ###
 
# Generate an access token
$Credentials = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("${ClientId}:${ClientSecret}"))
$Uri = "$IdcsUrl/oauth2/v1/token"
$Headers = @{
  Authorization = "Basic $Credentials"
}
$Parameters = @{
  grant_type    = 'client_credentials'
  scope         = 'urn:opc:idm:__myscopes__'
}
try {
  $Response = Invoke-RestMethod -Uri $Uri -Method POST -Headers $Headers -Body $Parameters
} catch {
  Write-Host ("Access token request POST to {0} failed with an error: {2}`nForm parameters: {1}`nException: {3}"  -f $Uri, ($Parameters | Out-String), $_.ErrorDetails, $_.Exception) -fore red
  exit
}
$AccessToken = $Response.access_token
 
Write-Debug "Access Token = $AccessToken"
 
# Check the 'allowedNotificationRedirectUrls' IDCS Setting value
$Uri = "$IdcsUrl/admin/v1/Settings/Settings/?attributes=allowedNotificationRedirectUrls"
$Headers = @{
  Authorization   = "Bearer $AccessToken"
  'Content-Type'  = 'application/scim+json'
}
try {
  $Response = Invoke-RestMethod -Uri $Uri -Method GET -Headers $Headers
} catch {
  Write-Host ("Request to GET {0} failed with an error: {1}. `nException: {2}"  -f $Uri, $_.ErrorDetails, $_.Exception) -fore red
  exit
}
$AllowedUrls = $Response.allowedNotificationRedirectUrls
 
Write-Debug "Allowed URLs from GET /admin/v1/Settings/Settings = $AllowedUrls"
 
# Add the forgot password URL to the Settings, if required (i.e. not already in $AllowedUrls)
if ($null -ne $AllowedUrls -And $AllowedUrls.Contains($ForgotPasswordUrl)) {
  Write-Output "URL ($ForgotPasswordUrl) is already registered"
} else {
  # Remove query parameter from /Settings URL, headers remain as for previous request
  $Uri = "$IdcsUrl/admin/v1/Settings/Settings/"
 
  # Add new URL and format the list for inclusion in the JSON payload (without powershell encoding)
  $AllowedUrls += $ForgotPasswordUrl;
  $AllowedUrls = '"{0}"' -f ($AllowedUrls -join '","')
  $Body = '{
    "schemas": [
      "urn:ietf:params:scim:api:messages:2.0:PatchOp"
    ],
    "Operations": [
      {
        "op": "replace",
        "path": "allowedNotificationRedirectUrls",
        "value": [' + $AllowedUrls + ']
      }
    ]
  }'
 
  try {
    $Response = Invoke-RestMethod -Uri $Uri -Method PATCH -Headers $Headers -Body $Body
  } catch {
    Write-Host ("Request to PUT {0} to {1} failed with an error: {2}. `nException:{3}" -f $Body, $Uri, $_.ErrorDetails, $_.Exception) -fore red
    exit
  }
 
  $AllowedUrls = $Response.allowedNotificationRedirectUrls
  Write-Output "Added new URL: $ForgotPasswordUrl"
}
 
Write-Output "`nAllowed Notification Redirect URLs:"
Write-Output $AllowedUrls