久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何配置 Azure AD 訪問令牌的過期時間(使用 ADAL

How can I configure the expiration time of an Azure AD access token (using ADAL)?(如何配置 Azure AD 訪問令牌的過期時間(使用 ADAL)?)
本文介紹了如何配置 Azure AD 訪問令牌的過期時間(使用 ADAL)?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我們使用 Azure AD 通過用戶的 Office 365 帳戶對我們的 WPF 應用程序中的用戶進行身份驗證.這是使用 Active Directory 身份驗證庫 (ADAL) 完成的.

We use Azure AD to authenticate users into our WPF application, using their Office 365 accounts. This is done using the Active Directory Authentication Library (ADAL).

目前,每次打開應用程序時都會提示他們登錄.我們想要更改它以允許通過緩存的令牌登錄到應用程序.這可行,但我們希望將令牌的到期時間縮短到 24 小時或更短,在該時間過去后需要再次登錄.

Currently, they are prompted to log in every time they open the app. We want to change this to allow logging in to the app via a cached token. This works but we want to shorten the expiration time of the token to 24 hours or less, requiring another sign in after that time has passed.

我看不到在代碼中操縱訪問令牌過期的方法.這是需要在 Azure AD 中完成的事情嗎?

I don't see a way to manipulate the expiration of an Access Token in code. Is this something that needs to be done within Azure AD?

推薦答案

總結

您不能使用 ADAL 來配置令牌的到期時間.ADAL 是一個身份驗證庫,可幫助您與令牌服務交互,但您可以在服務主體、應用程序或租戶上設置令牌生命周期配置.

Summary

You cannot use ADAL to configure the expiration time of tokens. ADAL is an authentication library that helps you interact with the token service, but you can set the token lifetime configuration on your Service Principal, Application, or Tenant.

您需要使用 Powershell 創建描述所需行為的策略,并將其鏈接到您的服務主體、租戶或應用程序.請記住,如果您正在構建多租戶應用程序,租戶的所有者可以覆蓋您的策略.

You'll need to use Powershell to create a policy describing the behavior you want, and link it to your service principal, tenant, or application. Keep in mind, if you're building a multi-tenant app, the owner of the tenant can overwrite your policy.

tl;dr: 不要依賴應用中的令牌生命周期,因為它隨時可能發生變化.

tl;dr: Don't rely on the token lifetime in your app as it can change at any time.

您可以使用 Azure AD Powershell 命令 設置這些屬性.然后運行以下命令來設置訪問令牌的生命周期:

You can set these properties using Azure AD Powershell Commands. Then run the following commands to set an access token lifetime:

  1. 登錄到 Powershell.

Connect-AzureAD -Confirm

  1. 創建一個新策略,將訪問令牌有效期設置為 2 小時.您可以將其更改為 10 分鐘到 1 天之間.

New-AzureADPolicy -Definition @('{"TokenLifetimePolicy":{"Version":1,"AccessTokenLifetime":"02:00:00","MaxAgeSessionSingleFactor":"02:00:00"}}') -DisplayName "WebPolicyScenario" -IsOrganizationDefault $false -Type "TokenLifetimePolicy"

  1. 獲取政策的 ObjectId.

Get-AzureAdPolicy

  1. 將新政策與您的應用相關聯.您可以使用 GraphExplorer 獲取應用的 objectId.
  1. Link the new policy to your application. You can get the objectId of your app using the GraphExplorer.

Add-AzureADApplicationPolicy -Id <應用程序的ObjectId>-RefObjectId <策略的ObjectId>

有關更多示例和完整文檔,請查看 Azure AD 可配置令牌生命周期.

For more examples and the full documentation, check out Azure AD Configurable Token Lifetime.

這篇關于如何配置 Azure AD 訪問令牌的過期時間(使用 ADAL)?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

ASP.NET Core authenticating with Azure Active Directory and persisting custom Claims across requests(ASP.NET Core 使用 Azure Active Directory 進行身份驗證并跨請求保留自定義聲明)
ASP.NET Core 2.0 Web API Azure Ad v2 Token Authorization not working(ASP.NET Core 2.0 Web API Azure Ad v2 令牌授權不起作用)
How do I get Azure AD OAuth2 Access Token and Refresh token for Daemon or Server to C# ASP.NET Web API(如何獲取守護進程或服務器到 C# ASP.NET Web API 的 Azure AD OAuth2 訪問令牌和刷新令牌) - IT屋-程序員軟件開發技
Azure KeyVault Active Directory AcquireTokenAsync timeout when called asynchronously(異步調用時 Azure KeyVault Active Directory AcquireTokenAsync 超時)
Getting access token using email address and app password from oauth2/token(使用電子郵件地址和應用程序密碼從 oauth2/token 獲取訪問令牌)
New Azure AD application doesn#39;t work until updated through management portal(新的 Azure AD 應用程序在通過管理門戶更新之前無法運行)
主站蜘蛛池模板: 国产在线aa | 久久久精 | 精品视频免费在线 | 欧洲亚洲一区 | 最新国产在线 | 亚洲性爰 | 国产精品成人久久久久a级 久久蜜桃av一区二区天堂 | 欧美一区二区在线观看视频 | 日韩中文字幕在线不卡 | 日日淫 | 亚洲一区二区视频在线观看 | 久久久久久国产精品免费免费 | 日一区二区三区 | 男人天堂免费在线 | 免费麻豆视频 | 国产一级片av | 一区二区三区中文字幕 | 在线观看亚洲一区二区 | 视频在线h | 欧美大片一区 | 国产精品自产拍 | 亚洲有码转帖 | 一级黄在线观看 | 久久视频免费观看 | 久久尤物免费一区二区三区 | 激情五月综合网 | 免费国产视频在线观看 | 亚洲性在线 | 99久久婷婷国产综合精品首页 | av一区在线观看 | 国产精品亚洲综合 | 国产高清一区二区三区 | 一级特黄a大片 | 国产精品久久久久久久免费观看 | 91伊人| 先锋资源站| 日韩精品一区二区三区久久 | 一级免费看 | 日韩欧美专区 | 久久综合爱 | 国产一区二区在线免费观看 |