mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-12 21:27:22 +01:00
remove anonymous
This commit is contained in:
parent
9e0ac74de7
commit
4477e186a3
2 changed files with 2 additions and 19 deletions
|
|
@ -7,8 +7,6 @@ using System.Text.Encodings.Web;
|
|||
using System.Threading.Tasks;
|
||||
using MareSynchronosServer.Data;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
|
@ -22,13 +20,8 @@ namespace MareSynchronosServer.Authentication
|
|||
|
||||
protected override async Task<AuthenticateResult> HandleAuthenticateAsync()
|
||||
{
|
||||
var endpoint = Context.GetEndpoint();
|
||||
var endpointMetaData = endpoint?.Metadata?.GetMetadata<IAllowAnonymous>();
|
||||
|
||||
if (!Request.Headers.ContainsKey("Authorization") && endpointMetaData == null)
|
||||
if (!Request.Headers.ContainsKey("Authorization"))
|
||||
return AuthenticateResult.Fail("Failed Authorization");
|
||||
else if (!Request.Headers.ContainsKey("Authorization") && endpointMetaData != null)
|
||||
return AuthenticateResult.NoResult();
|
||||
|
||||
var authHeader = Request.Headers["Authorization"].ToString();
|
||||
|
||||
|
|
@ -44,10 +37,6 @@ namespace MareSynchronosServer.Authentication
|
|||
{
|
||||
return AuthenticateResult.Fail("Failed Authorization");
|
||||
}
|
||||
else if (endpointMetaData != null && uid == null)
|
||||
{
|
||||
return AuthenticateResult.NoResult();
|
||||
}
|
||||
|
||||
var claims = new List<Claim> {
|
||||
new Claim(ClaimTypes.NameIdentifier, uid)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ using MareSynchronosServer.Data;
|
|||
using MareSynchronosServer.Metrics;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
|
@ -34,6 +33,7 @@ namespace MareSynchronosServer.Hubs
|
|||
}
|
||||
|
||||
[HubMethodName(Api.InvokeHeartbeat)]
|
||||
[Authorize(AuthenticationSchemes = SecretKeyAuthenticationHandler.AuthScheme)]
|
||||
public async Task<ConnectionDto> Heartbeat(string characterIdentification)
|
||||
{
|
||||
MareMetrics.InitializedConnections.Inc();
|
||||
|
|
@ -79,12 +79,6 @@ namespace MareSynchronosServer.Hubs
|
|||
};
|
||||
}
|
||||
|
||||
[HubMethodName(Api.InvokeGetSystemInfo)]
|
||||
public async Task<SystemInfoDto> GetSystemInfo()
|
||||
{
|
||||
return _systemInfoService.SystemInfoDto;
|
||||
}
|
||||
|
||||
public override Task OnConnectedAsync()
|
||||
{
|
||||
var feature = Context.Features.Get<IHttpContextAccessor>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue