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

如何在桌面應(yīng)用程序中從 Azure AD 2.0/MSAL 注銷?

How to sign out from Azure AD 2.0/MSAL in a desktop application?(如何在桌面應(yīng)用程序中從 Azure AD 2.0/MSAL 注銷?)
本文介紹了如何在桌面應(yīng)用程序中從 Azure AD 2.0/MSAL 注銷?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

限時送ChatGPT賬號..

我在 WPF 桌面應(yīng)用程序中使用 MSAL,該應(yīng)用程序需要允許用戶登錄和注銷 Azure AD v2.0.Microsoft 的 Graph 訪問示例 和其他大多數(shù)示例我請參閱使用 PublicClientApplication.Remove(IUser) 注銷,例如 在這個函數(shù)中:

I'm using MSAL in a WPF desktop application that needs to allow users to sign in and out against Azure AD v2.0. Microsoft's Graph access sample and most of the other examples I see use PublicClientApplication.Remove(IUser) to log out, like in this function:

//(from Microsoft's example)

/// <summary>
/// Sign out the current user
/// </summary>
private void SignOutButton_Click(object sender, RoutedEventArgs e)
{
    if (App.PublicClientApp.Users.Any())
    {
        try
        {
            App.PublicClientApp.Remove(App.PublicClientApp.Users.FirstOrDefault());
            this.ResultText.Text = "User has signed-out";
            this.CallGraphButton.Visibility = Visibility.Visible;
            this.SignOutButton.Visibility = Visibility.Collapsed;
        }
        catch (MsalException ex)
        {
            ResultText.Text = $"Error signing-out user: {ex.Message}";
        }
    }
}

據(jù)我所知,Remove(IUser) 似乎刪除了該用戶及其令牌的 MSAL 緩存,但它似乎并未真正將用戶注銷.如果我嘗試再次登錄我的應(yīng)用程序,我以前的用戶將顯示為已登錄",單擊將使我以該用戶身份登錄,而無需再次提供憑據(jù).使用 Microsoft 身份驗證庫 (MSAL) 時無法注銷 考慮到 MSAL 的當前狀態(tài),我覺得我需要手動注銷.

From what I can see, it looks like Remove(IUser) deletes MSAL's cache of that user and their tokens, but it doesn't seem like it's actually signing the user out. If I try to log in to my app again, my previous user will show up as "signed in" and clicking will log me in as that user without having to provide credentials again. Logout does not work when using Microsoft Authentication Library (MSAL) makes me think I will need to log out manually, given the current state of MSAL.

我發(fā)現(xiàn)了很多網(wǎng)絡(luò)應(yīng)用教程,例如 this Microsoft one 說退出應(yīng)該涉及刪除應(yīng)用程序的本地記錄(看起來像 Remove(IUser) 正在做),并且還重定向到

I've found a lot of web-app tutorials like this Microsoft one that say a sign-out should involve deleting the app's local record (what it looks like Remove(IUser) is doing), and also redirecting to some variant of

GET https://login.microsoftonline.com/common/oauth2/v2.0/logout?post_logout_redirect_uri=http%3A%2F%2Flocalhost%2Fmyapp%2F

但我的應(yīng)用不在網(wǎng)絡(luò)瀏覽器中,所以我不確定如何處理該請求.在使用 MSAL 時如何真正注銷?

But my app isn't in a web browser, so I'm not sure what to do with that request. How do I really log out while using MSAL?

推薦答案

你是對的,Remove(IUser) 方法只是將用戶從緩存中移除.我們還沒有實現(xiàn)一個 Signout 方法,正如您所寫的那樣,它將利用注銷端點.這是我們希望在未來提供的東西.請注意,有兩種退出方式:從應(yīng)用程序退出和從設(shè)備退出.

You are right, the Remove(IUser) method only removes the user from the cache. We have not yet implemented a Signout method, which would, as your write, leverage the logout endpoint. This is something we want to provide in the future. Note that there are two forms of sign-out: sign-out from the app, and signout from the device.

要回答您的最后一個問題,您的 WPF 應(yīng)用確實不是 Web 瀏覽器,但它包含一個嵌入式 Web 瀏覽器,該瀏覽器保留一個會話 cookie,需要通過向 azure AD 發(fā)送注銷請求來清除它.

To answer your last question, your WPF app is not a web browser indeed, but it contains an embedded web browser, which keeps a session cookie, that needs to be cleared by sending azure AD a logout request.

這篇關(guān)于如何在桌面應(yīng)用程序中從 Azure AD 2.0/MSAL 注銷?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

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 令牌授權(quán)不起作用)
How do I get Azure AD OAuth2 Access Token and Refresh token for Daemon or Server to C# ASP.NET Web API(如何獲取守護進程或服務(wù)器到 C# ASP.NET Web API 的 Azure AD OAuth2 訪問令牌和刷新令牌) - IT屋-程序員軟件開發(fā)技
Azure KeyVault Active Directory AcquireTokenAsync timeout when called asynchronously(異步調(diào)用時 Azure KeyVault Active Directory AcquireTokenAsync 超時)
Getting access token using email address and app password from oauth2/token(使用電子郵件地址和應(yīng)用程序密碼從 oauth2/token 獲取訪問令牌)
New Azure AD application doesn#39;t work until updated through management portal(新的 Azure AD 應(yīng)用程序在通過管理門戶更新之前無法運行)
主站蜘蛛池模板: 日本精品一区二区三区在线观看视频 | 国产精品国产成人国产三级 | 国产一区精品在线 | 久久三区| 在线免费看黄 | 国产成人精品免费 | 欧美国产亚洲一区二区 | 日韩视频中文字幕 | 精品不卡 | 欧美日本在线观看 | h片免费看 | 久久视频免费观看 | 久久中文一区二区 | 二区三区视频 | 亚洲 中文 欧美 | 小早川怜子xxxxaⅴ在线 | 亚洲精品乱码8久久久久久日本 | 伊人国产精品 | 国产精品久久久久久久久久久免费看 | 国产91亚洲精品一区二区三区 | 国产精品免费看 | 久久精品欧美一区二区三区不卡 | 99久久婷婷国产综合精品电影 | 国产精品一区二区三区99 | 日本精品一区二区 | 一本色道久久综合亚洲精品高清 | 日韩精品1区2区3区 成人黄页在线观看 | 日韩精品免费一区二区在线观看 | 欧美午夜精品理论片a级按摩 | 操久久| 精品亚洲一区二区三区 | 欧美性视频在线播放 | 久久久久国产一区二区三区四区 | 日干夜干 | 欧美精品中文字幕久久二区 | 亚洲午夜精品 | 97热在线 | 欧美日韩高清免费 | 欧美在线一区二区三区 | 国产在线精品一区二区 | 久久综合久久综合久久 |