This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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. | |
public class MyAppSession : ClaimsAbpSession, ITransientDependency | |
{ | |
public MyAppSession( | |
IPrincipalAccessor principalAccessor, | |
IMultiTenancyConfig multiTenancy, | |
ITenantResolver tenantResolver, | |
IAmbientScopeProvider<SessionOverride> sessionOverrideScopeProvider) : | |
base(principalAccessor, multiTenancy, tenantResolver, sessionOverrideScopeProvider) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add new property to claims on login | |
private async Task SignInAsync(User user, ClaimsIdentity identity = null, bool rememberMe = false) | |
{ | |
if (identity == null) | |
{ | |
identity = await _userManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie); | |
} | |
identity.AddClaim(new Claim("Application_UserEmail", user.EmailAddress)); //SETTING NEW PROPERTY |