mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-15 15:34:15 +01:00
Syncshells (#11)
* some groups stuff * further groups rework * fixes for pause changes * adjsut timeout interval * fixes and namespace change to file scoped * more fixes * further implement groups * fix change group ownership * add some more stuff for groups * more fixes and additions * some fixes based on analyzers, add shard info to ui * add discord command, cleanup * fix regex * add group migration and deletion on user deletion * add api method for client to check health of connection * adjust regex for vanity * fixes for server and bot * fixes some string comparison in linq queries * fixes group leave and sets alias to null * fix syntax in changeownership * add better logging, fixes for group leaving * fixes for group leave Co-authored-by: Stanley Dimant <root.darkarchon@outlook.com>
This commit is contained in:
parent
d866223069
commit
bff21ead95
57 changed files with 3761 additions and 1239 deletions
|
|
@ -5,38 +5,37 @@ using MareSynchronosShared.Protos;
|
|||
using Microsoft.Extensions.Logging;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MareSynchronosServices.Services
|
||||
namespace MareSynchronosServices.Services;
|
||||
|
||||
public class AuthenticationService : AuthService.AuthServiceBase
|
||||
{
|
||||
public class AuthenticationService : AuthService.AuthServiceBase
|
||||
private readonly ILogger<AuthenticationService> _logger;
|
||||
private readonly MareDbContext _dbContext;
|
||||
private readonly SecretKeyAuthenticationHandler _authHandler;
|
||||
|
||||
public AuthenticationService(ILogger<AuthenticationService> logger, MareDbContext dbContext, SecretKeyAuthenticationHandler authHandler)
|
||||
{
|
||||
private readonly ILogger<AuthenticationService> _logger;
|
||||
private readonly MareDbContext _dbContext;
|
||||
private readonly SecretKeyAuthenticationHandler _authHandler;
|
||||
_logger = logger;
|
||||
_dbContext = dbContext;
|
||||
_authHandler = authHandler;
|
||||
}
|
||||
|
||||
public AuthenticationService(ILogger<AuthenticationService> logger, MareDbContext dbContext, SecretKeyAuthenticationHandler authHandler)
|
||||
{
|
||||
_logger = logger;
|
||||
_dbContext = dbContext;
|
||||
_authHandler = authHandler;
|
||||
}
|
||||
public override async Task<AuthReply> Authorize(AuthRequest request, ServerCallContext context)
|
||||
{
|
||||
return await _authHandler.AuthenticateAsync(_dbContext, request.Ip, request.SecretKey);
|
||||
}
|
||||
|
||||
public override async Task<AuthReply> Authorize(AuthRequest request, ServerCallContext context)
|
||||
{
|
||||
return await _authHandler.AuthenticateAsync(_dbContext, request.Ip, request.SecretKey);
|
||||
}
|
||||
public override Task<Empty> RemoveAuth(RemoveAuthRequest request, ServerCallContext context)
|
||||
{
|
||||
_logger.LogInformation("Removing Authentication for {uid}", request.Uid);
|
||||
_authHandler.RemoveAuthentication(request.Uid);
|
||||
return Task.FromResult(new Empty());
|
||||
}
|
||||
|
||||
public override Task<Empty> RemoveAuth(RemoveAuthRequest request, ServerCallContext context)
|
||||
{
|
||||
_logger.LogInformation("Removing Authentication for {uid}", request.Uid);
|
||||
_authHandler.RemoveAuthentication(request.Uid);
|
||||
return Task.FromResult(new Empty());
|
||||
}
|
||||
|
||||
public override Task<Empty> ClearUnauthorized(Empty request, ServerCallContext context)
|
||||
{
|
||||
_logger.LogInformation("Clearing unauthorized users");
|
||||
_authHandler.ClearUnauthorizedUsers();
|
||||
return Task.FromResult(new Empty());
|
||||
}
|
||||
public override Task<Empty> ClearUnauthorized(Empty request, ServerCallContext context)
|
||||
{
|
||||
_logger.LogInformation("Clearing unauthorized users");
|
||||
_authHandler.ClearUnauthorizedUsers();
|
||||
return Task.FromResult(new Empty());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue