aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Session/SessionManager.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2020-08-31 23:01:27 +0200
committerGitHub <noreply@github.com>2020-08-31 23:01:27 +0200
commit8ee042483a2b6cc5f25f1eef05650a8ff4296923 (patch)
treee1588518cf37d1720724c47a55fd1bb84de3c8d3 /Emby.Server.Implementations/Session/SessionManager.cs
parent43a81366a623b54668ceda13d5d47740e39c9855 (diff)
parentdf0d197dc8509b38c6b4e5bd9ec442810bc0c647 (diff)
Merge pull request #2888 from ConfusedPolarBear/quickconnect
Add quick connect (login without typing password)
Diffstat (limited to 'Emby.Server.Implementations/Session/SessionManager.cs')
-rw-r--r--Emby.Server.Implementations/Session/SessionManager.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs
index dad414142..ca8e0e29b 100644
--- a/Emby.Server.Implementations/Session/SessionManager.cs
+++ b/Emby.Server.Implementations/Session/SessionManager.cs
@@ -1429,6 +1429,24 @@ namespace Emby.Server.Implementations.Session
return AuthenticateNewSessionInternal(request, false);
}
+ public Task<AuthenticationResult> AuthenticateQuickConnect(AuthenticationRequest request, string token)
+ {
+ var result = _authRepo.Get(new AuthenticationInfoQuery()
+ {
+ AccessToken = token,
+ DeviceId = _appHost.SystemId,
+ Limit = 1
+ });
+
+ if (result.TotalRecordCount == 0)
+ {
+ throw new SecurityException("Unknown quick connect token");
+ }
+
+ request.UserId = result.Items[0].UserId;
+ return AuthenticateNewSessionInternal(request, false);
+ }
+
private async Task<AuthenticationResult> AuthenticateNewSessionInternal(AuthenticationRequest request, bool enforcePassword)
{
CheckDisposed();