【发布时间】:2015-03-26 15:49:04
【问题描述】:
我需要从 Azure AD 发送的令牌中获取名称标识符。我假设这对于 AD 的每个用户都是唯一的,并且有一些基于它的自定义授权逻辑。 例如,
AuthenticationResult result = authenticationContext.AcquireToken(webApiResourceId, certificateCredential);
string accessToken = result.AccessToken;
这个 accessToken 作为 AuthenticationHeader 被发送到 WebAPI,它解密它并获取 nameidentifier 作为
Claim tenantClaim = ClaimsPrincipal.Current.FindFirst(ClaimTypes.NameIdentifier);
但是 WebAPI 上的这个过程是透明的,由 ADAL 执行。但是,我需要在客户端本身获取 NameIdentifier。 有什么方法可以通过解密 AccessToken 在客户端本身获取 NameIdentifier 吗?我搜索时似乎没有找到正确的答案。
【问题讨论】:
标签: azure claims-based-identity azure-active-directory adal