Reorganized file structure and namespaces
This commit is contained in:
@@ -5,16 +5,15 @@ using AipsCore.Domain.Models.User.Validation;
|
|||||||
using AipsCore.Infrastructure.Persistence.Db;
|
using AipsCore.Infrastructure.Persistence.Db;
|
||||||
using AipsCore.Infrastructure.Persistence.User.Mappers;
|
using AipsCore.Infrastructure.Persistence.User.Mappers;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace AipsCore.Infrastructure.Persistence.Authentication.AuthService;
|
namespace AipsCore.Infrastructure.Authentication.AuthService;
|
||||||
|
|
||||||
public class EfAuthService : IAuthService
|
public class EfAuthService : IAuthService
|
||||||
{
|
{
|
||||||
private readonly AipsDbContext _dbContext;
|
private readonly AipsDbContext _dbContext;
|
||||||
private readonly UserManager<User.User> _userManager;
|
private readonly UserManager<Persistence.User.User> _userManager;
|
||||||
|
|
||||||
public EfAuthService(AipsDbContext dbContext, UserManager<User.User> userManager)
|
public EfAuthService(AipsDbContext dbContext, UserManager<Persistence.User.User> userManager)
|
||||||
{
|
{
|
||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace AipsCore.Infrastructure.Persistence.Authentication.Jwt;
|
namespace AipsCore.Infrastructure.Authentication.Jwt;
|
||||||
|
|
||||||
public sealed class JwtSettings
|
public sealed class JwtSettings
|
||||||
{
|
{
|
||||||
@@ -6,7 +6,7 @@ using AipsCore.Application.Abstract.UserContext;
|
|||||||
using AipsCore.Domain.Models.User.External;
|
using AipsCore.Domain.Models.User.External;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
|
|
||||||
namespace AipsCore.Infrastructure.Persistence.Authentication.Jwt;
|
namespace AipsCore.Infrastructure.Authentication.Jwt;
|
||||||
|
|
||||||
public class JwtTokenProvider : ITokenProvider
|
public class JwtTokenProvider : ITokenProvider
|
||||||
{
|
{
|
||||||
@@ -3,7 +3,7 @@ using AipsCore.Application.Abstract.UserContext;
|
|||||||
using AipsCore.Domain.Models.User.ValueObjects;
|
using AipsCore.Domain.Models.User.ValueObjects;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
||||||
namespace AipsCore.Infrastructure.Persistence.Authentication.UserContext;
|
namespace AipsCore.Infrastructure.Authentication.UserContext;
|
||||||
|
|
||||||
public class HttpUserContext : IUserContext
|
public class HttpUserContext : IUserContext
|
||||||
{
|
{
|
||||||
@@ -5,8 +5,8 @@ using AipsCore.Domain.Models.User.External;
|
|||||||
using AipsCore.Domain.Models.Whiteboard.External;
|
using AipsCore.Domain.Models.Whiteboard.External;
|
||||||
using AipsCore.Domain.Models.WhiteboardMembership.External;
|
using AipsCore.Domain.Models.WhiteboardMembership.External;
|
||||||
using AipsCore.Infrastructure.DI.Configuration;
|
using AipsCore.Infrastructure.DI.Configuration;
|
||||||
using AipsCore.Infrastructure.Persistence.Authentication.RefreshToken;
|
|
||||||
using AipsCore.Infrastructure.Persistence.Db;
|
using AipsCore.Infrastructure.Persistence.Db;
|
||||||
|
using AipsCore.Infrastructure.Persistence.RefreshToken;
|
||||||
using AipsCore.Infrastructure.Persistence.Shape;
|
using AipsCore.Infrastructure.Persistence.Shape;
|
||||||
using AipsCore.Infrastructure.Persistence.User;
|
using AipsCore.Infrastructure.Persistence.User;
|
||||||
using AipsCore.Infrastructure.Persistence.Whiteboard;
|
using AipsCore.Infrastructure.Persistence.Whiteboard;
|
||||||
|
|||||||
@@ -2,11 +2,10 @@ using System.Text;
|
|||||||
using AipsCore.Application.Abstract.UserContext;
|
using AipsCore.Application.Abstract.UserContext;
|
||||||
using AipsCore.Application.Common.Authentication;
|
using AipsCore.Application.Common.Authentication;
|
||||||
using AipsCore.Domain.Models.User.Options;
|
using AipsCore.Domain.Models.User.Options;
|
||||||
|
using AipsCore.Infrastructure.Authentication.AuthService;
|
||||||
|
using AipsCore.Infrastructure.Authentication.Jwt;
|
||||||
|
using AipsCore.Infrastructure.Authentication.UserContext;
|
||||||
using AipsCore.Infrastructure.DI.Configuration;
|
using AipsCore.Infrastructure.DI.Configuration;
|
||||||
using AipsCore.Infrastructure.Persistence.Authentication;
|
|
||||||
using AipsCore.Infrastructure.Persistence.Authentication.AuthService;
|
|
||||||
using AipsCore.Infrastructure.Persistence.Authentication.Jwt;
|
|
||||||
using AipsCore.Infrastructure.Persistence.Authentication.UserContext;
|
|
||||||
using AipsCore.Infrastructure.Persistence.Db;
|
using AipsCore.Infrastructure.Persistence.Db;
|
||||||
using AipsCore.Infrastructure.Persistence.User;
|
using AipsCore.Infrastructure.Persistence.User;
|
||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using AipsCore.Infrastructure.Persistence.Authentication.RefreshToken;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Identity;
|
|
||||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
@@ -7,7 +6,7 @@ namespace AipsCore.Infrastructure.Persistence.Db;
|
|||||||
|
|
||||||
public class AipsDbContext : IdentityDbContext<User.User, IdentityRole<Guid>, Guid>
|
public class AipsDbContext : IdentityDbContext<User.User, IdentityRole<Guid>, Guid>
|
||||||
{
|
{
|
||||||
public DbSet<RefreshToken> RefreshTokens { get; set; }
|
public DbSet<RefreshToken.RefreshToken> RefreshTokens { get; set; }
|
||||||
|
|
||||||
public DbSet<Whiteboard.Whiteboard> Whiteboards { get; set; }
|
public DbSet<Whiteboard.Whiteboard> Whiteboards { get; set; }
|
||||||
public DbSet<Shape.Shape> Shapes { get; set; }
|
public DbSet<Shape.Shape> Shapes { get; set; }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace AipsCore.Infrastructure.Persistence.Authentication.RefreshToken;
|
namespace AipsCore.Infrastructure.Persistence.RefreshToken;
|
||||||
|
|
||||||
public class RefreshToken
|
public class RefreshToken
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace AipsCore.Infrastructure.Persistence.Authentication.RefreshToken;
|
namespace AipsCore.Infrastructure.Persistence.RefreshToken;
|
||||||
|
|
||||||
public class RefreshTokenException : Exception
|
public class RefreshTokenException : Exception
|
||||||
{
|
{
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
namespace AipsCore.Infrastructure.Persistence.Authentication.RefreshToken;
|
namespace AipsCore.Infrastructure.Persistence.RefreshToken;
|
||||||
|
|
||||||
public static class RefreshTokenMappers
|
public static class RefreshTokenMappers
|
||||||
{
|
{
|
||||||
public static Application.Common.Authentication.Models.RefreshToken MapToModel(this RefreshToken entity)
|
public static Application.Common.Authentication.Models.RefreshToken MapToModel(this Persistence.RefreshToken.RefreshToken entity)
|
||||||
{
|
{
|
||||||
return new Application.Common.Authentication.Models.RefreshToken(
|
return new Application.Common.Authentication.Models.RefreshToken(
|
||||||
entity.Token,
|
entity.Token,
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
using AipsCore.Application.Abstract.UserContext;
|
using AipsCore.Application.Abstract.UserContext;
|
||||||
using AipsCore.Domain.Models.User.ValueObjects;
|
using AipsCore.Domain.Models.User.ValueObjects;
|
||||||
using AipsCore.Infrastructure.Persistence.Authentication.Jwt;
|
using AipsCore.Infrastructure.Authentication.Jwt;
|
||||||
using AipsCore.Infrastructure.Persistence.Db;
|
using AipsCore.Infrastructure.Persistence.Db;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace AipsCore.Infrastructure.Persistence.Authentication.RefreshToken;
|
namespace AipsCore.Infrastructure.Persistence.RefreshToken;
|
||||||
|
|
||||||
public class RefreshTokenRepository : IRefreshTokenRepository
|
public class RefreshTokenRepository : IRefreshTokenRepository
|
||||||
{
|
{
|
||||||
@@ -20,7 +20,7 @@ public class RefreshTokenRepository : IRefreshTokenRepository
|
|||||||
|
|
||||||
public async Task AddAsync(string token, UserId userId, CancellationToken cancellationToken = default)
|
public async Task AddAsync(string token, UserId userId, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var refreshToken = new RefreshToken()
|
var refreshToken = new Persistence.RefreshToken.RefreshToken()
|
||||||
{
|
{
|
||||||
Id = Guid.NewGuid(),
|
Id = Guid.NewGuid(),
|
||||||
Token = token,
|
Token = token,
|
||||||
Reference in New Issue
Block a user