Initial ...

This commit is contained in:
2026-03-22 14:08:25 +03:30
commit d3464ef39c
71 changed files with 19087 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
using System.Linq;
using System.Threading.Tasks;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
using IdentityServer4.Services;
using Microsoft.AspNetCore.Identity;
using xCommons.Extensions;
using xIdentityModels;
using xIds.Interfaces;
namespace xIds.Providers
{
public class XIdentityProfileService : IProfileService
{
private readonly IXIdentityManager identityManager;
private readonly IUserClaimsPrincipalFactory<XUser> userClaimsPrincipalFacotry;
public XIdentityProfileService(
IXIdentityManager identityManager,
IUserClaimsPrincipalFactory<XUser> userClaimsPrincipalFacotry
)
{
this.identityManager = identityManager;
this.userClaimsPrincipalFacotry = userClaimsPrincipalFacotry;
}
public async Task GetProfileDataAsync(ProfileDataRequestContext context)
{
//
var sub = context.Subject.GetSubjectId();
var user = await identityManager.GetUserAsync(sub, true);
var principal = await userClaimsPrincipalFacotry.CreateAsync(user);
//
var claims = principal.Claims.ToList();
//
context.IssuedClaims = claims;
}
public async Task IsActiveAsync(IsActiveContext context)
{
//
var sub = context.Subject.GetSubjectId();
var user = await identityManager.GetUserAsync(sub);
//
context.IsActive = !user.IsNull() && user.IsEnable && !user.IsBanned;
}
}
}