Abstractions and dtos
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
using AipsCore.Application.Common.Authentication.Models;
|
||||||
|
using AipsCore.Domain.Models.User.ValueObjects;
|
||||||
|
|
||||||
|
namespace AipsCore.Application.Abstract.UserContext;
|
||||||
|
|
||||||
|
public interface IRefreshTokenRepository
|
||||||
|
{
|
||||||
|
Task AddAsync(string token, UserId userId, CancellationToken cancellationToken = default);
|
||||||
|
Task<RefreshToken> GetByValueAsync(string token, CancellationToken cancellationToken = default);
|
||||||
|
Task RevokeAsync(string token, CancellationToken cancellationToken = default);
|
||||||
|
Task RevokeAllAsync(UserId userId, CancellationToken cancellationToken = default);
|
||||||
|
}
|
||||||
@@ -5,5 +5,6 @@ namespace AipsCore.Application.Abstract.UserContext;
|
|||||||
|
|
||||||
public interface ITokenProvider
|
public interface ITokenProvider
|
||||||
{
|
{
|
||||||
string Generate(User user, IList<UserRole> roles);
|
string GenerateAccessToken(User user, IList<UserRole> roles);
|
||||||
|
string GenerateRefreshToken();
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
namespace AipsCore.Application.Common.Authentication.Dtos;
|
||||||
|
|
||||||
|
public record LogInUserResultDto(string AccessToken, string RefreshToken);
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using AipsCore.Application.Common.Authentication.Models;
|
||||||
using AipsCore.Domain.Models.User;
|
using AipsCore.Domain.Models.User;
|
||||||
|
|
||||||
namespace AipsCore.Application.Common.Authentication;
|
namespace AipsCore.Application.Common.Authentication;
|
||||||
@@ -6,4 +7,5 @@ public interface IAuthService
|
|||||||
{
|
{
|
||||||
Task SignUpWithPasswordAsync(User user, string password, CancellationToken cancellationToken = default);
|
Task SignUpWithPasswordAsync(User user, string password, CancellationToken cancellationToken = default);
|
||||||
Task<LoginResult> LoginWithEmailAndPasswordAsync(string email, string password, CancellationToken cancellationToken = default);
|
Task<LoginResult> LoginWithEmailAndPasswordAsync(string email, string password, CancellationToken cancellationToken = default);
|
||||||
|
Task<LoginResult> LoginWithRefreshTokenAsync(RefreshToken refreshToken, CancellationToken cancellationToken = default);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
namespace AipsCore.Application.Common.Authentication.Models;
|
||||||
|
|
||||||
|
public record AccessToken(string Value);
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
using AipsCore.Domain.Models.User.ValueObjects;
|
||||||
|
|
||||||
|
namespace AipsCore.Application.Common.Authentication.Models;
|
||||||
|
|
||||||
|
public record RefreshToken(string Value, string UserId, DateTime ExpiresAt);
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
namespace AipsCore.Application.Common.Authentication;
|
|
||||||
|
|
||||||
public record Token(string Value);
|
|
||||||
Reference in New Issue
Block a user