This file contains hidden or 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
public class CustomPasswordHasher : IPasswordHasher | |
{ | |
public IPasswordHasher<User> AspNetPasswordHasher { get; set; } | |
public byte Version => throw new NotImplementedException(); | |
public CustomPasswordHasher(IPasswordHasher<User> ph) | |
{ | |
AspNetPasswordHasher = ph; | |
} |
This file contains hidden or 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
namespace Test | |
{ | |
public class Startup | |
{ | |
// This method gets called by the runtime. Use this method to add services to the container. | |
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
} |
This file contains hidden or 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
[Alias("AspNetUsers")] | |
public class User : IUserAuth | |
{ | |
[Index] | |
public string Email { get; set; } | |
[Required] | |
public bool EmailConfirmed { get; set; } = false; | |
public string PasswordHash { get; set; } |
This file contains hidden or 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
public class CustomAuthProvider : CredentialsAuthProvider | |
{ | |
public override IHttpResult OnAuthenticated(IServiceBase authService, IAuthSession session, IAuthTokens tokens, Dictionary<string, string> authInfo) | |
{ | |
var dbFactory = authService.ResolveService<IDbConnectionFactory>(); | |
using (var db = dbFactory.Open()) | |
{ | |
var user = db.LoadSelect<User>(x => x.Email.ToLower() == session.UserAuthName.ToLower()).FirstOrDefault(); |
This file contains hidden or 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
public class CustomAuthRepository : OrmLiteAuthRepository<AspNetUser, UserAuthDetails> | |
{ | |
public CustomAuthRepository(IDbConnectionFactory dbFactory, string namedConnnection = null) : base(dbFactory, namedConnnection) | |
{ | |
} | |
public override void AssignRoles(string userAuthId, ICollection<string> roles = null, ICollection<string> permissions = null) | |
{ | |
var userAuth = GetUserAuth(userAuthId) as User; |
This file contains hidden or 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
ALTER TABLE AspNetUsers | |
ADD | |
[PrimaryEmail] nvarchar(max) NULL, | |
[DisplayName] nvarchar(max) NULL, | |
[Company] nvarchar(max) NULL, | |
[Birthdate] datetime NULL, | |
[BirthdateRaw] nvarchar(max) NULL, | |
[Address] nvarchar(max) NULL, | |
[Address2] nvarchar(max) NULL, | |
[City] nvarchar(max) NULL, |