remove anonymous
This commit is contained in:
@@ -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>();
|
||||
|
||||
Reference in New Issue
Block a user