![](/img/trans.png)
[英]Thinktecture IdentityServer v3, hybrid flow - is it possible to implement single sign-on with valid authentication but wrong authorization
[英]Profile data from OpenIdConnect provider - Thinktecture IdentityServer V3
我使用Thinktecture IdentitiyServer V3作为OpenIdConnect提供程序进行身份验证。 我有一个自定义用户服务,可以根据Active Directory对用户进行身份验证。 我想发送一些配置文件数据到RP。 身份验证成功进行,但是我不确定如何配置RP来检索配置文件数据。
我的用户服务实现GetProfileDataAsync方法以使用当前配置获取所需的数据,而该方法永远不会被点击。
我是OpenIdConnect的新手。 请帮忙。
我从Startup.cs的RP配置:
app.UseCookieAuthentication(new CookieAuthenticationOptions()
{
AuthenticationType = "Cookies"
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions()
{
Authority = "url",
ClientId = "owinmvc",
Scope = "openid profile",
ResponseType = "id_token token",
RedirectUri = "https://localhost:44307/",
SignInAsAuthenticationType = "Cookies",
Notifications = new OpenIdConnectAuthenticationNotifications()
{
SecurityTokenValidated = (context) =>
{
var identity = context.AuthenticationTicket.Identity;
identity.AddClaim(new Claim("CustomRoleClaim", "This is a role"));
return Task.FromResult(0);
}
}
});
通过提供ResponseType =“ id_token令牌”,您正在请求身份令牌和访问令牌。 尝试仅请求id_token来检查是否将执行GetProfileDataAsync。
另请参阅有关范围的AlwaysIncludeInIdToken。 默认情况下,如果您请求身份令牌和访问令牌一起使用,则身份服务器不包含数据,假设您将通过UserInfo端点手动请求此信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.