Refractor token auth stuff to use identiycore framework
This commit is contained in:
parent
f8d7581a12
commit
8f7df85d49
14 changed files with 377 additions and 50 deletions
10
API/Entities/AppRole.cs
Normal file
10
API/Entities/AppRole.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace API.Entities
|
||||
{
|
||||
public class AppRole : IdentityRole<int>
|
||||
{
|
||||
public ICollection<AppUserRole> UserRoles { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,18 +1,13 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using API.Entities.Interfaces;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
|
||||
namespace API.Entities
|
||||
{
|
||||
public class AppUser : IHasConcurrencyToken
|
||||
public class AppUser : IdentityUser<int>
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string UserName { get; set; }
|
||||
public byte[] PasswordHash { get; set; }
|
||||
public byte[] PasswordSalt { get; set; }
|
||||
public DateTime Created { get; set; } = DateTime.Now;
|
||||
public DateTime LastActive { get; set; }
|
||||
public bool IsAdmin { get; set; }
|
||||
|
@ -20,6 +15,8 @@ namespace API.Entities
|
|||
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; set; }
|
||||
|
||||
public ICollection<AppUserRole> UserRoles { get; set; }
|
||||
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
|
|
10
API/Entities/AppUserRole.cs
Normal file
10
API/Entities/AppUserRole.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace API.Entities
|
||||
{
|
||||
public class AppUserRole : IdentityUserRole<int>
|
||||
{
|
||||
public AppUser User { get; set; }
|
||||
public AppRole Role { get; set; }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue