在B2C自定义策略中增加刷新令牌生存期

时间:2017-08-07 11:04:27

标签: azure-ad-b2c

我可以检索自定义B2C策略的刷新令牌,但希望将令牌生存期增加到最大限制,或者将滑动窗口生命周期设置为无过期。

这可以通过基本策略的Azure门户B2C设置完成,但在自定义策略的门户中不可用。

https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-token-session-sso#token-lifetimes-configuration

如何在我的政策中配置此功能?

2 个答案:

答案 0 :(得分:1)

结帐this article

在RP技术配置文件中特别添加以下内容。

<Item Key="token_lifetime_secs">3600</Item>

可以看起来像这样(从文档中复制)

<ClaimsProviders>
   <ClaimsProvider>
      <DisplayName>Token Issuer</DisplayName>
      <TechnicalProfiles>
         <TechnicalProfile Id="JwtIssuer">
            <Metadata>
               <Item Key="token_lifetime_secs">3600</Item>
               <Item Key="id_token_lifetime_secs">3600</Item>
               <Item Key="refresh_token_lifetime_secs">1209600</Item>
               <Item Key="rolling_refresh_token_lifetime_secs">7776000</Item>
               <Item Key="IssuanceClaimPattern">AuthorityAndTenantGuid</Item>
               <Item Key="AuthenticationContextReferenceClaimPattern">None</Item>
            </Metadata>
         </TechnicalProfile>
      </TechnicalProfiles>
   </ClaimsProvider>
</ClaimsProviders>

答案 1 :(得分:0)

Parakh 说的是对的,但请注意他链接到的 the page 上的横幅,上面写着关于带有 PKCE 的 SPA 应用

<块引用>

注意
使用带有 PKCE 的授权代码流的单页应用程序始终具有 24 小时的刷新令牌生命周期,而移动应用程序、桌面应用程序和 Web 应用程序则不受此限制。 Learn more about the security implications of refresh tokens in the browser.

这意味着这些应用可能不会遵守以下设置:

  • refresh_token_lifetime_secs
  • rolling_refresh_token_lifetime_secs
  • allow_infinite_rolling_refresh_token
    • 使用 PKCE 的 SPA从不尊重最后一个
相关问题