diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2021-11-13 15:31:14 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-13 15:31:14 -0500 |
| commit | 761a4e8415b2fc1023679c24ddd66fabf237abec (patch) | |
| tree | 7524e612964a29e8c4db582fb59b2a5e9911a5f4 /Emby.Server.Implementations/HttpServer | |
| parent | f0028c728f7f6f018e356fb6a82c126ff8684d0b (diff) | |
| parent | 4a28f46cac30e2e1fabc84016d710bcd309a5344 (diff) | |
Merge pull request #6837 from crobibero/auth-exceptionv10.8.0-alpha2
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); |
