fix(cqrs): implement missing auth service interfaces and fix tests
- Create RolePermissionService (delegates to AppPermissions) - Create AuthSignInService (wraps SignInManager) - Create AuthDataService (handles settings, first-user, token revocation) - Register all new services in Infrastructure DI - Fix AuthDataService RevokedRefreshToken constructor usage - All 226 tests passing
This commit is contained in:
1 parent
df644c8b2a
commit
6978d2e9ab
4 files changed
+102
No files matched your search
@@ -0,0 +1,32 @@
|
||||
using Heimdall.Application.Services;
|
||||
using Heimdall.Domain.Entities;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace Heimdall.Infrastructure.Security;
|
||||
|
||||
public class AuthSignInService : IAuthSignInService
|
||||
{
|
||||
private readonly SignInManager<AppUser> _signInManager;
|
||||
|
||||
public AuthSignInService(SignInManager<AppUser> signInManager)
|
||||
{
|
||||
_signInManager = signInManager;
|
||||
}
|
||||
|
||||
public async Task<SignInServiceResult> PasswordSignInAsync(AppUser user, string password, bool lockoutOnFailure)
|
||||
{
|
||||
var result = await _signInManager.PasswordSignInAsync(user, password, false, lockoutOnFailure);
|
||||
return result switch
|
||||
{
|
||||
{ Succeeded: true } => new SignInServiceResult(SignInResultType.Success),
|
||||
{ IsLockedOut: true } => new SignInServiceResult(SignInResultType.LockedOut),
|
||||
{ RequiresTwoFactor: true } => new SignInServiceResult(SignInResultType.RequiresTwoFactor),
|
||||
_ => new SignInServiceResult(SignInResultType.Failed)
|
||||
};
|
||||
}
|
||||
|
||||
public async Task SignOutAsync()
|
||||
{
|
||||
await _signInManager.SignOutAsync();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user