Add api key functions

This commit is contained in:
Luke Pulverenti
2014-07-11 22:31:08 -04:00
parent 59de5c0d14
commit b5641013ce
16 changed files with 168 additions and 39 deletions

View File

@@ -1210,15 +1210,15 @@ namespace MediaBrowser.Server.Implementations.Session
/// <returns>Task{SessionInfo}.</returns>
/// <exception cref="System.UnauthorizedAccessException">Invalid user or password entered.</exception>
/// <exception cref="UnauthorizedAccessException"></exception>
public async Task<AuthenticationResult> AuthenticateNewSession(string username,
string password,
string clientType,
string appVersion,
string deviceId,
string deviceName,
public async Task<AuthenticationResult> AuthenticateNewSession(string username,
string password,
string clientType,
string appVersion,
string deviceId,
string deviceName,
string remoteEndPoint)
{
var result = (IsLocalhost(remoteEndPoint) && string.Equals(clientType, "Dashboard", StringComparison.OrdinalIgnoreCase)) ||
var result = (IsLocalhost(remoteEndPoint) && string.Equals(clientType, "Dashboard", StringComparison.OrdinalIgnoreCase)) ||
await _userManager.AuthenticateUser(username, password).ConfigureAwait(false);
if (!result)
@@ -1332,6 +1332,11 @@ namespace MediaBrowser.Server.Implementations.Session
}
}
public Task RevokeToken(string token)
{
return Logout(token);
}
private bool IsLocalhost(string remoteEndpoint)
{
if (string.IsNullOrWhiteSpace(remoteEndpoint))