connect to socket with access token

This commit is contained in:
Luke Pulverenti
2015-03-08 15:48:30 -04:00
parent 55c47e50fc
commit ccb2dda358
13 changed files with 247 additions and 21 deletions

View File

@@ -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)
{