diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-03-08 15:48:30 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-03-08 15:48:30 -0400 |
| commit | ccb2dda358a54810d940c0c7ddceb255a82ae947 (patch) | |
| tree | 0a6a673390bb8f3e88fbe7f69e408f31c99d18ec /MediaBrowser.Server.Implementations/Session/SessionManager.cs | |
| parent | 55c47e50fc261849c277cb65654d91a8c5a8e308 (diff) | |
connect to socket with access token
Diffstat (limited to 'MediaBrowser.Server.Implementations/Session/SessionManager.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Session/SessionManager.cs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 8eef8536a..a09f585fd 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -1640,6 +1640,26 @@ namespace MediaBrowser.Server.Implementations.Session string.Equals(i.Client, client)); } + public SessionInfo GetSessionByAuthenticationToken(string token) + { + var result = _authRepo.Get(new AuthenticationInfoQuery + { + AccessToken = token + }); + + if (result.Items.Length == 0) + { + return null; + } + + var info = result.Items[0]; + + // TODO: Make Token part of SessionInfo and get result that way + // This can't be done until all apps are updated to new authentication. + return Sessions.FirstOrDefault(i => string.Equals(i.DeviceId, info.DeviceId) && + string.Equals(i.Client, info.AppName)); + } + public Task SendMessageToUserSessions<T>(string userId, string name, T data, CancellationToken cancellationToken) { |
