【发布时间】:2019-07-21 00:19:21
【问题描述】:
所以我使用ADAL 库来实现我的应用程序的 Azure 目录单点登录。
documentation
我将 { "scope", "openid"} 添加到请求 url,以便返回 id_token。然后我检索用户的唯一 ID 以在数据库中查找。
AuthenticationContext ac = new AuthenticationContext(MicrosoftAuthBaseURL);
ClientCredential clcred = new ClientCredential(MicrosoftAppId, MicrosoftAppSecret);
AuthenticationResult acResult = ac.AcquireTokenByAuthorizationCodeAsync(code, new Uri(RedirectURI), clcred).Result;
SignInUser(acResult.UserInfo.UniqueId);
我知道验证访问令牌或 id 令牌是一种很好的做法,但在我的情况下,这些令牌都没有直接使用。我只是检索/使用UniqueId 字段。所以我的问题是,我还需要在这里做任何验证吗?我应该验证什么,我可以在库中利用任何内置的验证方法吗?我不喜欢手动做。
【问题讨论】:
标签: asp.net jwt azure-active-directory single-sign-on adal