0
kalidarscope created
i added UserClaimsPrincipalFactory.cs page
public override async Task<ClaimsPrincipal> CreateAsync(User user)
{
var claim = await base.CreateAsync(user);
claim.Identities.First().AddClaim(new Claim("EmailAddress", user.EmailAddress));
return claim;
}
then Application.core page
public ASAPSessions11(
IPrincipalAccessor principalAccessor,
IMultiTenancyConfig multiTenancy,
ITenantResolver tenantResolver,
IAmbientScopeProvider<SessionOverride> sessionOverrideScopeProvider) :
base(principalAccessor, multiTenancy, tenantResolver, sessionOverrideScopeProvider)
{
}
public string EmailAddress
{
get
{
var userEmailClaim = PrincipalAccessor.Principal?.Claims.FirstOrDefault(c => c.Type == "EmailAddress");
if (string.IsNullOrEmpty(userEmailClaim?.Value))
{
return null;
}
return userEmailClaim.Value;
}
}
how to get EmailAddress value project.Applictaion page
6 Answer(s)
-
0
Define your own session and add your custom field to it Then, you can inject MyAppSession and use it's new property in your project.
see:https://gist.github.com/ismcagdas/6f2a9a3b5d7b907cb8d94a72124d59a1
-
0
How can i use the session and get the injected values from session in Project.Application folder.
Noted : i am useing ASP.NET Core & Angular
-
0
ASAPSessions11.EmailAddress
-
0
-
1
Inject an instance.
-
0
Thanks