我不确定是否可以捕获 url,但它很容易使用claims transformations并声明 resolver构造它。
以下将是策略 url 的格式,其中包含提到的所有声明解析器。您将需要声明转换来格式化最终 url。https://{Policy:RelyingPartyTenantId}.b2clogin.com/{Policy:RelyingPartyTenantId}.onmicrosoft.com/oauth2/v2.0/authorize?p={Policy:PolicyId}&client_id={OIDC:ClientId}&nonce={OIDC :Nonce}&redirect_uri=https%3A%2F%2Fjwt.ms&scope{OIDC:scope}&response_type=id_token&prompt={OIDC:Prompt}&ui_locales={Culture:LanguageName}
自定义策略中目前没有两个变量可用作声明解析器 - redirect_uri 和 responseType。对于他们,您有两个选项 - 硬编码 - 将它们复制到策略 url 的其他查询字符串参数中,然后将它们提取为声明解析器。B2C 有索赔解析器,它可以从查询字符串参数中获取价值,它被称为 {OAUTH-KV} 索赔解析器。查询字符串参数 testReplyUrl 的示例。
<OutputClaim ClaimTypeReferenceId="replyUrl" DefaultValue="{OAUTH-KV:testReplyUrl}" AlwaysUseDefaultValue="true" />
<BuildingBlocks>
<ClaimsSchema>
<ClaimType Id="replyUrl">
<DisplayName>redirect uri</DisplayName>
<DataType>string</DataType>
<AdminHelpText>Reply url</AdminHelpText>
<UserHelpText>ReplyUrl.</UserHelpText>
</ClaimType>
</ClaimsSchema>
</BuildingBlocks>