久久久久久久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 應用程序在通過管理門戶更新之前無法運行)
主站蜘蛛池模板: 欧美日韩高清一区 | 中国大陆高清aⅴ毛片 | 久久久国 | 成人啊啊啊| 日韩不卡在线 | 日日夜夜免费精品 | 99伊人| 国产一区二区三区在线看 | 亚洲视频三区 | 伊人在线 | 国产在线a | 亚洲天堂二区 | 亚洲精品一区二区在线观看 | 中文字幕一区在线观看视频 | 久久九九影视 | 免费日本视频 | 黄一区二区三区 | 久久一二区 | 色婷婷综合久久久中文字幕 | 美女张开腿露出尿口 | 不用播放器看的av | 日本一卡精品视频免费 | 成人免费大片黄在线播放 | 亚洲日日夜夜 | 亚洲视频免费在线看 | 羞羞视频在线观看网站 | 欧洲亚洲一区二区三区 | 午夜国产羞羞视频免费网站 | 亚洲精品一级 | 日本高清不卡视频 | 国产精品91视频 | 成人午夜在线 | 午夜成人在线视频 | 一区二区三区av夏目彩春 | 一区二区三区国产 | 国产午夜精品一区二区三区四区 | 九色在线观看 | 国产91久久精品一区二区 | 天天爽天天干 | 人人天天操 | 免费高潮视频95在线观看网站 |