Integrated AuthenticationStateProvider using .NET Core Identity

This commit is contained in:
Shaun Walker
2019-07-08 12:52:40 -04:00
parent 46821b8a10
commit 6cf1eb1c31
21 changed files with 565 additions and 137 deletions

View File

@ -9,6 +9,7 @@ namespace Oqtane.Repository
void AddUser(User User);
void UpdateUser(User User);
User GetUser(int UserId);
User GetUser(string Username);
void DeleteUser(int UserId);
}
}

View File

@ -1,10 +1,12 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Oqtane.Models;
using System;
namespace Oqtane.Repository
{
public class TenantContext : DbContext
public class TenantContext : IdentityDbContext<IdentityUser>
{
public virtual DbSet<Site> Site { get; set; }
public virtual DbSet<Page> Page { get; set; }

View File

@ -28,6 +28,10 @@ namespace Oqtane.Repository
{
aliasname += "/" + segments[1];
}
if (aliasname.EndsWith("/"))
{
aliasname = aliasname.Substring(0, aliasname.Length - 1);
}
}
public Tenant GetTenant()

View File

@ -65,6 +65,19 @@ namespace Oqtane.Repository
}
}
public User GetUser(string Username)
{
try
{
User user = db.User.Where(item => item.Username == Username).FirstOrDefault();
return user;
}
catch
{
throw;
}
}
public void DeleteUser(int userId)
{
try