diff options
| author | Cody Robibero <cody@robibe.ro> | 2021-11-13 07:27:28 -0700 |
|---|---|---|
| committer | Cody Robibero <cody@robibe.ro> | 2021-11-13 07:27:28 -0700 |
| commit | 4a28f46cac30e2e1fabc84016d710bcd309a5344 (patch) | |
| tree | 3cae630deab87943278399c7e5161fa93a4a5d22 /Emby.Server.Implementations/HttpServer | |
| parent | 8868b34d78bdb34f4c47aa4b8e81a1a3cd699ded (diff) | |
Don't throw exception on unauthenticated requests
Diffstat (limited to 'Emby.Server.Implementations/HttpServer')
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/Security/AuthService.cs | 2 | ||||
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/WebSocketManager.cs | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/HttpServer/Security/AuthService.cs b/Emby.Server.Implementations/HttpServer/Security/AuthService.cs index e2ad07177..e7103ec95 100644 --- a/Emby.Server.Implementations/HttpServer/Security/AuthService.cs +++ b/Emby.Server.Implementations/HttpServer/Security/AuthService.cs @@ -24,7 +24,7 @@ namespace Emby.Server.Implementations.HttpServer.Security if (!auth.HasToken) { - throw new AuthenticationException("Request does not contain a token."); + return auth; } if (!auth.IsAuthenticated) diff --git a/Emby.Server.Implementations/HttpServer/WebSocketManager.cs b/Emby.Server.Implementations/HttpServer/WebSocketManager.cs index f86bfd755..e99876dce 100644 --- a/Emby.Server.Implementations/HttpServer/WebSocketManager.cs +++ b/Emby.Server.Implementations/HttpServer/WebSocketManager.cs @@ -35,7 +35,12 @@ namespace Emby.Server.Implementations.HttpServer /// <inheritdoc /> public async Task WebSocketRequestHandler(HttpContext context) { - _ = await _authService.Authenticate(context.Request).ConfigureAwait(false); + var authorizationInfo = await _authService.Authenticate(context.Request).ConfigureAwait(false); + if (!authorizationInfo.IsAuthenticated) + { + throw new SecurityException("Token is required"); + } + try { _logger.LogInformation("WS {IP} request", context.Connection.RemoteIpAddress); |
