Azure Oauth-如何更改令牌到期时间? [英] Azure Oauth - how to change token expiration time?
问题描述
我们正在将Oauth2与Azure一起使用.默认情况下,服务器会返回带有小时间隔的令牌,以使其失效.有什么办法可以改变有效期?
We are using Oauth2 with Azure. And by default server returns token with an hour interval for expiration. Is there any way change expiration interval?
推荐答案
现在可以配置令牌生存期.您可以在此处阅读更多信息:https://docs.microsoft.com/zh-CN/azure/active-directory/develop/active-directory-configurable-token-lifetimes .
It is now possible to configure the token lifetime. You can read more here: https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-configurable-token-lifetimes.
备注:此功能处于预览状态,不会以这种方式投入生产.下面的标头也放在我上面提到的文档链接上.
Remark: This feature is in preview and will not go to production in this way. The following header is also placed on the documentation link I mentioned above.
在预览期间听取客户的意见后,我们计划用Azure Active Directory条件访问中的一项新功能替换此功能.新功能完成后,将在通知期后最终弃用此功能.如果您使用可配置令牌生存期"策略,请准备好在可用的新条件切换到新的条件访问功能.
After hearing from customers during the preview, we're planning to replace this functionality with a new feature in Azure Active Directory Conditional Access. Once the new feature is complete, this functionality will eventually be deprecated after a notification period. If you use the Configurable Token Lifetime policy, be prepared to switch to the new Conditional Access feature once it's available.
原始答案:
当前无法更改到期间隔.这是当前的到期时间.
Currently there is no way to change the expiration interval. These are the current expiration times.
-
最近1小时访问令牌
Access tokens last 1 hour
刷新令牌持续14天,但是
Refresh tokens last for 14 days, but
- 如果您在这14天内使用了刷新令牌,则会收到一个新的令牌,其有效期再移14天.您最多可以重复90天的总有效期,然后必须重新进行身份验证
- 出于与应用无关的原因(例如,用户更改密码),可以随时使刷新令牌失效.因此,您不应在代码中依赖上述内容–您的逻辑应始终假定刷新令牌可能随时失败
- 来宾MSA帐户的刷新令牌问题仅持续12小时
来源: http://www.cloudidentity.com/blog/2015/03/20/azure-ad-token-lifetime/以及我自己的经验.
Source: http://www.cloudidentity.com/blog/2015/03/20/azure-ad-token-lifetime/ and also my own experiences.
这篇关于Azure Oauth-如何更改令牌到期时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!