|
|
@ -1225,7 +1225,7 @@ namespace MediaBrowser.Server.Implementations.Session
|
|
|
|
throw new UnauthorizedAccessException("Invalid user or password entered.");
|
|
|
|
throw new UnauthorizedAccessException("Invalid user or password entered.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var token = await GetAuthorizationToken(user.Id.ToString("N"), request.DeviceId, request.App, request.DeviceName).ConfigureAwait(false);
|
|
|
|
var token = await GetAuthorizationToken(user.Id.ToString("N"), request.DeviceId, request.App, request.AppVersion, request.DeviceName).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
|
|
EventHelper.FireEventIfNotNull(AuthenticationSucceeded, this, new GenericEventArgs<AuthenticationRequest>(request), _logger);
|
|
|
|
EventHelper.FireEventIfNotNull(AuthenticationSucceeded, this, new GenericEventArgs<AuthenticationRequest>(request), _logger);
|
|
|
|
|
|
|
|
|
|
|
@ -1246,7 +1246,7 @@ namespace MediaBrowser.Server.Implementations.Session
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private async Task<string> GetAuthorizationToken(string userId, string deviceId, string app, string deviceName)
|
|
|
|
private async Task<string> GetAuthorizationToken(string userId, string deviceId, string app, string appVersion, string deviceName)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var existing = _authRepo.Get(new AuthenticationInfoQuery
|
|
|
|
var existing = _authRepo.Get(new AuthenticationInfoQuery
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1265,6 +1265,7 @@ namespace MediaBrowser.Server.Implementations.Session
|
|
|
|
var newToken = new AuthenticationInfo
|
|
|
|
var newToken = new AuthenticationInfo
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AppName = app,
|
|
|
|
AppName = app,
|
|
|
|
|
|
|
|
AppVersion = appVersion,
|
|
|
|
DateCreated = DateTime.UtcNow,
|
|
|
|
DateCreated = DateTime.UtcNow,
|
|
|
|
DeviceId = deviceId,
|
|
|
|
DeviceId = deviceId,
|
|
|
|
DeviceName = deviceName,
|
|
|
|
DeviceName = deviceName,
|
|
|
@ -1690,6 +1691,12 @@ namespace MediaBrowser.Server.Implementations.Session
|
|
|
|
deviceId = info.DeviceId;
|
|
|
|
deviceId = info.DeviceId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Prevent argument exception
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(appVersion))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
appVersion = "1";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return LogSessionActivity(appName, appVersion, deviceId, deviceName, remoteEndpoint, user);
|
|
|
|
return LogSessionActivity(appName, appVersion, deviceId, deviceName, remoteEndpoint, user);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|