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

如何使用 Azure 身份驗(yàn)證在 Azure Function 中獲取當(dāng)前

How to get current user identity in Azure Function with Azure Authentication?(如何使用 Azure 身份驗(yàn)證在 Azure Function 中獲取當(dāng)前用戶身份?)
本文介紹了如何使用 Azure 身份驗(yàn)證在 Azure Function 中獲取當(dāng)前用戶身份?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

限時(shí)送ChatGPT賬號(hào)..

我創(chuàng)建了一個(gè)新的函數(shù)應(yīng)用,為它啟用了應(yīng)用服務(wù)身份驗(yàn)證/授權(quán)(使用身份驗(yàn)證/授權(quán)來(lái)保護(hù)您的應(yīng)用程序并使用每個(gè)用戶的數(shù)據(jù)")并禁用非身份驗(yàn)證請(qǐng)求.

I have created a new Function App, enabled App Service Authentication / Authorization for it ("Use Authentication / Authorization to protect your application and work with per-user data") and disabled non-authenticated requests.

到目前為止,一切似乎都運(yùn)行正常.如果我嘗試請(qǐng)求我的 HttpTriggered 函數(shù),它需要我先登錄;登錄后,所有請(qǐng)求都會(huì)按原樣處理.所以保護(hù)您的應(yīng)用程序"部分沒(méi)有問(wèn)題.

Everything seems to be working correctly so far. If I try to request my HttpTriggered function, it requires me to log in first; once I'm logged in, all requests are processed as they should be. So there is no problem with "protect your application" part.

但是,我完全被處理每個(gè)用戶的數(shù)據(jù)"部分所困擾.我的 Azure 函數(shù)被調(diào)用為

However, I'm totally stuck with the "work with per-user data" part. My Azure Function is invoked as

public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequestMessage req, TraceWriter log)

HttpRequestMessage 中沒(méi)有與身份驗(yàn)證相關(guān)的內(nèi)容.(AuthorizationLevel.Anonymous 似乎控制著完全不同的事情——即,函數(shù)是否可以由任何人調(diào)用,或者只能由具有固定 API 密鑰的人調(diào)用).

And there is nothing related to authentication in HttpRequestMessage. (AuthorizationLevel.Anonymous seems to control the entirely different thing - namely, if the function could be called by anyone or only by those who have a fixed API key).

如何獲取調(diào)用該函數(shù)的經(jīng)過(guò)身份驗(yàn)證的用戶的身份?

How do I get the identity of authenticated user who called the function?

推薦答案

使用 Azure Function runtime v2.0.12309,你可以檢索 來(lái)自 Run 方法中注入的 "noreferrer">ClaimsPrincipal 實(shí)例:

Using the Azure Function runtime v2.0.12309, you can retrieve the authenticated user information from the ClaimsPrincipal instance injected in the Run method:

public static async Task<HttpResponseMessage> Run(
    [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]
    HttpRequest httpRequest, 
    ILogger logger, 
    ClaimsPrincipal claimsPrincipal)
 {
            // Explores the authenticated user's claims in claimsPrincipal.
 }

這篇關(guān)于如何使用 Azure 身份驗(yàn)證在 Azure Function 中獲取當(dāng)前用戶身份?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

ASP.NET Core authenticating with Azure Active Directory and persisting custom Claims across requests(ASP.NET Core 使用 Azure Active Directory 進(jìn)行身份驗(yàn)證并跨請(qǐng)求保留自定義聲明)
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)不起作用)
ASP Core Azure Active Directory Login use roles(ASP Core Azure Active Directory 登錄使用角色)
How do I get Azure AD OAuth2 Access Token and Refresh token for Daemon or Server to C# ASP.NET Web API(如何獲取守護(hù)進(jìn)程或服務(wù)器到 C# ASP.NET Web API 的 Azure AD OAuth2 訪問(wèn)令牌和刷新令牌) - IT屋-程序員軟件開(kāi)發(fā)技
.Net Core 2.0 - Get AAD access token to use with Microsoft Graph(.Net Core 2.0 - 獲取 AAD 訪問(wèn)令牌以與 Microsoft Graph 一起使用)
Azure KeyVault Active Directory AcquireTokenAsync timeout when called asynchronously(異步調(diào)用時(shí) Azure KeyVault Active Directory AcquireTokenAsync 超時(shí))
主站蜘蛛池模板: 日韩成人在线观看 | 蜜桃av鲁一鲁一鲁一鲁 | av在线亚洲天堂 | 特级生活片 | 亚洲欧美中文日韩在线 | 久久精品视频亚洲 | 蜜桃久久 | 午夜男人的天堂 | 成人做爰999 | 一区二区三区在线免费观看 | 91影片| 国产精品久久精品 | 91精品亚洲 | 日韩精品一区二区三区中文在线 | 日本黄色免费大片 | 日韩一区二区在线观看 | 亚洲免费人成在线视频观看 | 99免费在线视频 | 国产精品日日夜夜 | 久久久久久久久久久久久久国产 | 自拍偷拍第一页 | 久久久久久久久久久福利观看 | 久久偷人 | 日韩一区二区在线视频 | 欧美日韩国产不卡 | 日日操视频 | 91 在线 | 久久免费视频网 | 色偷偷噜噜噜亚洲男人 | 91精品国产乱码久久久久久久久 | 一级毛片,一级毛片 | 日本一区二区视频 | 男女免费在线观看视频 | 免费av在线网站 | 国产三级一区二区三区 | 亚洲精品久久嫩草网站秘色 | 国产一区二区在线视频 | 免费天天干| 99精品在线| 国产一区二区三区久久久久久久久 | 国产精品美女久久久久aⅴ国产馆 |