Open dmolon opened 1 year ago
hi
Their implementation is almost the same.
hi
Their implementation is almost the same.
Hi, @maliming.
We managed to make the code work with OpenIddict, and now we have a question about how to implement this in a microservices solution since it requires the code below in each OnApplicationInitialization method of the microservices. Our question is whether we need to make all microservices aware of Identity and place this code in each one of them, or if there is a more centralized way to do this.
Sorry for taking up your time, and thank you very much!
app.Use(async (httpContext, func) =>
{
var currentUser = httpContext.RequestServices.GetRequiredService<ICurrentUser>();
if (currentUser.IsAuthenticated)
{
var claimToken = currentUser.GetConcurrentLoginToken();
var userManager = httpContext.RequestServices.GetRequiredService<IdentityUserManager>();
var user = await userManager.FindByIdAsync(currentUser.Id.ToString());
if (claimToken != user.GetProperty("ConcurrentLogin").ToString())
{
//Cookies
if (httpContext.User.Identity != null && httpContext.User.Identity.AuthenticationType == "Identity.Application")
{
await httpContext.RequestServices.GetRequiredService<AbpSignInManager>().SignOutAsync();
await httpContext.ChallengeAsync("Identity.Application");
}
//JWT
if (httpContext.User.Identity != null && httpContext.User.Identity.AuthenticationType == "AuthenticationTypes.Federation")
{
await httpContext.ChallengeAsync(JwtBearerDefaults.AuthenticationScheme);
}
//Other
return;
}
}
await func();
});
microservices solution
Are you using the abp microservice? eg eShopOnAbp?
microservices solution
Are you using the abp microservice? eg eShopOnAbp?
We've created a microsservice solution using ABP Suite.
hi
The ConcurrentLogin doesn't work for the microservice solution.
Hello!
The ConcurrentLogin Example is currently using IdentityServer, could you please update it to use OpenIddict?
Thanks!