azure 如何在ADB2C的RESTful技术配置文件中使用动态承载令牌?

14ifxucb  于 12个月前  发布在  DB2
关注(0)|答案(1)|浏览(98)

我有一个API,我可以使用TTL为1小时的承载令牌访问。我需要通过ADB2C使用此API。
按照Microsoft Documentation,从策略密钥B2C_1A_B2cRestClientAccessToken读取承载令牌:

<TechnicalProfile Id="REST-API-SignUp">
  <DisplayName>Validate user's input data and return loyaltyNumber claim</DisplayName>
  <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
  <Metadata>
    <Item Key="ServiceUrl">https://your-app-name.azurewebsites.NET/api/identity/signup</Item>
    <Item Key="AuthenticationType">Bearer</Item>
    <Item Key="SendClaimsIn">Body</Item>
  </Metadata>
  <CryptographicKeys>
    <Key Id="BearerAuthenticationToken" StorageReferenceId="B2C_1A_B2cRestClientAccessToken" />
  </CryptographicKeys>
</TechnicalProfile>

然而,策略密钥(B2C_1A_B2cRestClientAccessToken)是静态的,而在我的情况下,每次ADB2C需要使用API时都需要检索承载令牌。我该如何实现这一点?

zpf6vheq

zpf6vheq1#

下面的Microsoft文档似乎解释了如何获取访问令牌并在每次需要使用API时使用。我还没有测试它,但它似乎完全覆盖:
https://learn.microsoft.com/en-us/azure/active-directory-b2c/secure-rest-api?tabs=windows&pivots=b2c-custom-policy#prerequisites

相关问题