[英]Blazor Server App - OKTA Groups aren't appearing inside Claims
I created a Blazor Server Web app in OKTA and enabled Open Id.我在 OKTA 中创建了一个 Blazor 服务器 Web 应用程序并启用了 Open Id。 Also added 2 users and their groups.
还添加了 2 个用户及其组。 Below is my code t configure OpenId inside Startup.cs.
下面是我在 Startup.cs 中配置 OpenId 的代码。 I am able to logged and getting Claim details.
我能够登录并获取索赔详细信息。
//hk okta
services.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
})
.AddCookie()
.AddOpenIdConnect(options =>
{
options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.Authority = Configuration["Okta:Domain"] + "/oauth2/default";
options.RequireHttpsMetadata = true;
options.ClientId = Configuration["Okta:ClientId"];
options.ClientSecret = Configuration["Okta:ClientSecret"];
options.ResponseType = OpenIdConnectResponseType.Code;
options.Scope.Add("openid");
options.Scope.Add("profile");
options.SaveTokens = true;
options.GetClaimsFromUserInfoEndpoint = true;
options.TokenValidationParameters = new TokenValidationParameters
{
NameClaimType = "name",
RoleClaimType = "groups",
RequireSignedTokens = true
};
}
);
Even though I am getting details inside Claim, Group names of logged users are not appearing anywhere.即使我在声明中获取详细信息,登录用户的组名也不会出现在任何地方。 Is there any way to trouble shoot this or any other clue?
有没有办法解决这个问题或任何其他线索? I am looping through Claims like below.
我正在遍历如下声明。
@foreach (var claim in context.User.Claims)
{
<tr>
<td>@claim.Type</td>
<td>@claim.Value</td>
</tr>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.