hi
You can add a new IAbpClaimsPrincipalContributor and check results from GetExternalLoginInfoAsync.
Your roles claims will exist in externalLoginInfo.
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Security.Claims;
using IdentityUser = Volo.Abp.Identity.IdentityUser;
namespace MyCompanyName.MyProjectName.Web;
public class MyClaimsPrincipalContributor : IAbpClaimsPrincipalContributor, ITransientDependency
{
protected SignInManager<IdentityUser> SignInManager { get; }
public MyClaimsPrincipalContributor(SignInManager<IdentityUser> signInManager)
{
SignInManager = signInManager;
}
public async Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
{
var identity = context.ClaimsPrincipal.Identities.FirstOrDefault();
if (identity == null)
{
return;
}
var externalLoginInfo = await SignInManager.GetExternalLoginInfoAsync();
if (externalLoginInfo == null)
{
return;
}
var roles = externalLoginInfo.Principal.Claims
.Where(c => c.Type == "roles")
.Select(c => c.Value)
.ToList();
if (roles.IsNullOrEmpty())
{
return;
}
foreach (var role in roles)
{
identity.AddClaim(new Claim("MyRoles", role));
}
}
}
hi
The Register page in the Account Pro module.
You can download its source code.
Thanks.
hi
Our angular team will help you asap
Thanks.
No problem. Take your time.
Thanks, I will check it asap.
Sure, if you get any problems, feel free to reach out anytime.
hi
I didn't receive. Can you send it by https://wetransfer.com/
Thanks.
hi
Can you share a simple project?
liming.ma@volosoft.com
I will check and fix it
Thanks.