好的.
Thanks. I will check your logs.
你可以分享一个项目吗? 使用模版创建一个新的项目, 然后复制你的代码到新项目中?
liming.ma@volosoft.com
谢谢
你i可以使用模版项目和你的自定义代码复现问题吗?
你的项目太复杂, 使用模版项目会更清晰
谢谢
Thanks, I will forwared to our angular team
你的日志显示 Blazor主动请求了注销端点, 请检查下代码, 或者分享你的代码
Request starting HTTP/1.1 GET http://master.xxx.com:28444/Account/Logout - null null
你的步骤是? 我们的angular开发人员会检查它, 请使用英文 谢谢
hi
using System;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Identity;
using OpenIddict.Abstractions;
using OpenIddict.Server;
namespace BankIdDemo;
public class BankIdOpenIddictServerHandler : IOpenIddictServerHandler<OpenIddictServerEvents.ProcessSignInContext>
{
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
= OpenIddictServerHandlerDescriptor.CreateBuilder<OpenIddictServerEvents.ProcessSignInContext>()
.UseSingletonHandler<BankIdOpenIddictServerHandler>()
.SetOrder(100_000)
.SetType(OpenIddictServerHandlerType.Custom)
.Build();
public async ValueTask HandleAsync(OpenIddictServerEvents.ProcessSignInContext context)
{
var httpContext = context.Transaction.GetHttpRequest()?.HttpContext;
if (httpContext == null)
{
return;
}
if (context.EndpointType == OpenIddictServerEndpointType.Authorization && context.AuthorizationCodePrincipal != null)
{
var identity = await httpContext.AuthenticateAsync(IdentityConstants.ApplicationScheme);
if (identity.Principal != null)
{
var bankIdClaim = identity.Principal.FindFirst("isbankidauthenticated");
if (bankIdClaim != null)
{
context.AuthorizationCodePrincipal?.AddClaim("isbankidauthenticated", bankIdClaim.Value);
};
};
}
if (context.EndpointType == OpenIddictServerEndpointType.Token)
{
if (context.AccessTokenPrincipal != null && context.IdentityTokenPrincipal != null)
{
var bankIdClaim = context.AccessTokenPrincipal .FindFirst("isbankidauthenticated");
if (bankIdClaim != null)
{
context.IdentityTokenPrincipal?.AddClaim("isbankidauthenticated", bankIdClaim.Value);
}
}
}
}
}