Fix login
All checks were successful
Build and Push Image / build-and-push (push) Successful in 5m23s

This commit is contained in:
2025-07-06 01:37:32 -04:00
parent 7427bbb576
commit bc8a4414cd
2 changed files with 3 additions and 2 deletions

View File

@@ -14,8 +14,9 @@ using Aoba.RPC;
namespace AobaServer.Services; namespace AobaServer.Services;
public class AobaAuthService(AccountsService accountsService, AuthInfo authInfo) : AuthRpc.AuthRpcBase public class AobaAuthService(AccountsService accountsService, AuthConfigService authConfig) : AuthRpc.AuthRpcBase
{ {
[AllowAnonymous]
public override async Task<LoginResponse> Login(Credentials request, ServerCallContext context) public override async Task<LoginResponse> Login(Credentials request, ServerCallContext context)
{ {
var user = await accountsService.VerifyLoginAsync(request.User, request.Password, context.CancellationToken); var user = await accountsService.VerifyLoginAsync(request.User, request.Password, context.CancellationToken);
@@ -27,6 +28,7 @@ public class AobaAuthService(AccountsService accountsService, AuthInfo authInfo)
Message = "Invalid login credentials" Message = "Invalid login credentials"
} }
}; };
var authInfo = await authConfig.GetDefaultAuthInfoAsync();
var token = user.GetToken(authInfo); var token = user.GetToken(authInfo);
return new LoginResponse return new LoginResponse
{ {

View File

@@ -14,7 +14,6 @@ namespace AobaServer.Services;
public class MetricsRpcService(AuthConfigService authConfig): Aoba.RPC.Metrics.MetricsRpc.MetricsRpcBase public class MetricsRpcService(AuthConfigService authConfig): Aoba.RPC.Metrics.MetricsRpc.MetricsRpcBase
{ {
[AllowAnonymous]
public override async Task<Jwt> GetToken(Empty request, ServerCallContext context) public override async Task<Jwt> GetToken(Empty request, ServerCallContext context)
{ {
var authInfo = await authConfig.GetAuthInfoAsync("aoba", "metrics"); var authInfo = await authConfig.GetAuthInfoAsync("aoba", "metrics");