diff options
| author | Cody Robibero <cody@robibe.ro> | 2023-10-30 15:31:13 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-30 15:31:13 -0600 |
| commit | 8c5fc8028240adec57a4b39147dbeac81a1835a0 (patch) | |
| tree | 62bcba59fa6e86fa1dfd479b709bbecfaca1cf08 /Emby.Server.Implementations/Session/SessionManager.cs | |
| parent | b26eb7dd6bb928bd3e6f292833092fd518c6db0b (diff) | |
Don't remove all tokens if invalid header (#10490)
Diffstat (limited to 'Emby.Server.Implementations/Session/SessionManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Session/SessionManager.cs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index dc59a4523..e8e63d286 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -1453,10 +1453,15 @@ namespace Emby.Server.Implementations.Session return AuthenticateNewSessionInternal(request, false); } - private async Task<AuthenticationResult> AuthenticateNewSessionInternal(AuthenticationRequest request, bool enforcePassword) + internal async Task<AuthenticationResult> AuthenticateNewSessionInternal(AuthenticationRequest request, bool enforcePassword) { CheckDisposed(); + ArgumentException.ThrowIfNullOrEmpty(request.App); + ArgumentException.ThrowIfNullOrEmpty(request.DeviceId); + ArgumentException.ThrowIfNullOrEmpty(request.DeviceName); + ArgumentException.ThrowIfNullOrEmpty(request.AppVersion); + User user = null; if (!request.UserId.Equals(default)) { @@ -1517,8 +1522,11 @@ namespace Emby.Server.Implementations.Session return returnResult; } - private async Task<string> GetAuthorizationToken(User user, string deviceId, string app, string appVersion, string deviceName) + internal async Task<string> GetAuthorizationToken(User user, string deviceId, string app, string appVersion, string deviceName) { + // This should be validated above, but if it isn't don't delete all tokens. + ArgumentException.ThrowIfNullOrEmpty(deviceId); + var existing = (await _deviceManager.GetDevices( new DeviceQuery { |
