![](/img/trans.png)
[英]Authenticate against Azure AD - ColdFusion Web Application
[英]Windows store application to authenticate against azure function
我正在尝试复制以下示例https://github.com/Azure-Samples/active-directory-dotnet-windows-store (通过Azureure AD进行身份验证的Windows应用商店应用程序),但我正在通过替换Web应用程序Azure函数。
在该功能中,检查用户是否已登录的代码如下:
ClaimsPrincipal.Current.FindFirst("http://schemas.microsoft.com/identity/claims/scope").Value.Contains("user_impersonation"))
但这不包含必需的值,并且其他调用也不返回任何值(例如ClaimsPrincipal.Current.FindFirst(ClaimTypes.GivenName));
你知道发生了什么吗?
这与代码是否在Web App或Azure Function中运行无关。 根本原因是获取令牌的差异参数/方式。
当您使用Azure AD保护Azure函数并将令牌与请求相关联时,它还会解析令牌并读取令牌中的声明并构造ClaimsPrincipal
对象。
您可以在此站点中解析令牌,以检查您是否期望令牌中的声明。
看到这个问题https://github.com/Azure-Samples/active-directory-dotnet-daemon/issues/1
该范围不在索赔清单中。 您可以尝试以下操作来转储获得的所有索赔,并查看可用的索赔。
foreach (Claim claim in ClaimsPrincipal.Current.Claims)
{
log.Info("CLAIM TYPE: " + claim.Type + "; CLAIM VALUE: " + claim.Value);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.