使用 openIdConnect 对用户进行身份验证时,IdToken 与 codeIdToken 之间有什么区别
What is the difference between IdToken vs codeIdToken when authenticating users with openIdConnect
我正在针对 Azure AD 对 mvc.net 应用程序中的用户进行身份验证。身份验证后,我正在访问 Azure AD 以获取一些用户信息并使用客户端凭据流。验证用户时有如下代码:
new OpenIdConnectAuthenticationOptions
{
ClientId = clientId
Authority = authority,
RedirectUri = redirectUri,
PostLogoutRedirectUri = redirectUri,
Scope = OpenIdConnectScope.OpenIdProfile,
// ResponseType = OpenIdConnectResponseType.CodeIdToken,
ResponseType = OpenIdConnectResponseType.IdToken,
Notifications = new
OpenIdConnectAuthenticationNotifications
{
AuthenticationFailed = OnAuthenticationFailed,
AuthorizationCodeReceived =
OnAuthorizationCodeReceivedAsync
}
我想找出 OpenIdConnectResponseType.CodeIdToken 和 OpenIdConnectresonseTyope.IdToken 之间的区别以及其他属性。请问什么时候用什么?
它基本上告诉您在用户通过身份验证后想要取回什么,并且根据选择的“流程”,您想要取回不同的项目。 (访问令牌、授权码、身份令牌....)
参考此文档:
我正在针对 Azure AD 对 mvc.net 应用程序中的用户进行身份验证。身份验证后,我正在访问 Azure AD 以获取一些用户信息并使用客户端凭据流。验证用户时有如下代码:
new OpenIdConnectAuthenticationOptions
{
ClientId = clientId
Authority = authority,
RedirectUri = redirectUri,
PostLogoutRedirectUri = redirectUri,
Scope = OpenIdConnectScope.OpenIdProfile,
// ResponseType = OpenIdConnectResponseType.CodeIdToken,
ResponseType = OpenIdConnectResponseType.IdToken,
Notifications = new
OpenIdConnectAuthenticationNotifications
{
AuthenticationFailed = OnAuthenticationFailed,
AuthorizationCodeReceived =
OnAuthorizationCodeReceivedAsync
}
我想找出 OpenIdConnectResponseType.CodeIdToken 和 OpenIdConnectresonseTyope.IdToken 之间的区别以及其他属性。请问什么时候用什么?
它基本上告诉您在用户通过身份验证后想要取回什么,并且根据选择的“流程”,您想要取回不同的项目。 (访问令牌、授权码、身份令牌....)
参考此文档: