如何增加 Azure SSO 登录的访问令牌过期时间

问题描述 投票:0回答:1

尝试过以下方法:

登录 Azure 门户。 导航到 Azure Active Directory。 单击应用程序注册并选择要增加访问令牌过期时间的应用程序。 选择“清单”选项卡。 在清单编辑器中,搜索“accessToken”属性并以秒为单位更新“accessTokenLifetime”属性的值。 保存更改并关闭清单编辑器。 完成这些步骤后,所选应用程序的访问令牌过期时间将增加。

在清单中添加以下代码:

"accessToken": {   
    "accessTokenType": "jwt",  
    "value": null,  
    "userFlowType": "UserFlows/SignUpSignIn",  
    "userFlowVersion": 1,  
    "accessTokenLifetime": 3600,  
    "includeEmailInIdToken": false,  
    "scope": [  
      "openid",  
      "profile",  
      "email",  
      "offline_access"  
    ]  
  }

错误

无法更新 XXXXXX 应用程序。错误详细信息:没有值的值 找到类型名称,但没有可用的预期类型。当模型 指定后,有效负载中的每个值都必须具有一个可以是的类型 要么在有效负载中指定,由调用者显式指定,要么 从父值隐式推断。 [/axcDaTlIjTKt3x3K7n5ps]

azure
1个回答
0
投票

增加令牌生命周期策略,您必须创建如下策略:

POST https://graph.microsoft.com/v1.0/policies/tokenLifetimePolicies
Content-type: application/json

{
    "definition": [
        "{\"TokenLifetimePolicy\":{\"Version\":1,\"AccessTokenLifetime\":\"8:00:00\"}}"
    ],
    "displayName": "Contoso token lifetime policy",
    "isOrganizationDefault": true
}

enter image description here

将此策略分配给应用程序:

POST https://graph.microsoft.com/v1.0/applications/AppObjID/tokenLifetimePolicies/$ref
Content-Type: application/json

{
 "@odata.id":"https://graph.microsoft.com/v1.0/policies/tokenLifetimePolicies/PolicyID"
}

enter image description here

我为应用程序生成了令牌,令牌生命周期为 10 小时:

enter image description here

您可以在特定用户流程中设置令牌生命周期,如下所示:

enter image description here

参考资料:

配置令牌-Azure Active Directory B2C |微软

创建 tokenLifetimePolicy - Microsoft Graph v1.0 |微软

© www.soinside.com 2019 - 2024. All rights reserved.