aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Session
diff options
context:
space:
mode:
author7illusions <z@7illusions.com>2014-08-30 19:06:58 +0200
committer7illusions <z@7illusions.com>2014-08-30 19:06:58 +0200
commit66ad1699e22029b605e17735e8d9450285d8748a (patch)
treeffc92c88d24850b2f82b6b3a8bdd904a2ccc77a5 /MediaBrowser.Controller/Session
parent34bc54263e886aae777a3537dc50a6535b51330a (diff)
parent9d36f518182bc075c19d78084870f5115fa62d1e (diff)
Merge pull request #1 from MediaBrowser/master
Update to latest
Diffstat (limited to 'MediaBrowser.Controller/Session')
-rw-r--r--MediaBrowser.Controller/Session/AuthenticationRequest.cs14
-rw-r--r--MediaBrowser.Controller/Session/ISessionManager.cs61
-rw-r--r--MediaBrowser.Controller/Session/SessionInfo.cs4
3 files changed, 68 insertions, 11 deletions
diff --git a/MediaBrowser.Controller/Session/AuthenticationRequest.cs b/MediaBrowser.Controller/Session/AuthenticationRequest.cs
new file mode 100644
index 0000000000..38871e8147
--- /dev/null
+++ b/MediaBrowser.Controller/Session/AuthenticationRequest.cs
@@ -0,0 +1,14 @@
+
+namespace MediaBrowser.Controller.Session
+{
+ public class AuthenticationRequest
+ {
+ public string Username { get; set; }
+ public string Password { get; set; }
+ public string App { get; set; }
+ public string AppVersion { get; set; }
+ public string DeviceId { get; set; }
+ public string DeviceName { get; set; }
+ public string RemoteEndPoint { get; set; }
+ }
+}
diff --git a/MediaBrowser.Controller/Session/ISessionManager.cs b/MediaBrowser.Controller/Session/ISessionManager.cs
index 8c2ece131f..f715ce7703 100644
--- a/MediaBrowser.Controller/Session/ISessionManager.cs
+++ b/MediaBrowser.Controller/Session/ISessionManager.cs
@@ -1,7 +1,9 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Events;
using MediaBrowser.Model.Session;
+using MediaBrowser.Model.Users;
using System;
using System.Collections.Generic;
using System.Threading;
@@ -45,6 +47,16 @@ namespace MediaBrowser.Controller.Session
/// Occurs when [capabilities changed].
/// </summary>
event EventHandler<SessionEventArgs> CapabilitiesChanged;
+
+ /// <summary>
+ /// Occurs when [authentication failed].
+ /// </summary>
+ event EventHandler<GenericEventArgs<AuthenticationRequest>> AuthenticationFailed;
+
+ /// <summary>
+ /// Occurs when [authentication succeeded].
+ /// </summary>
+ event EventHandler<GenericEventArgs<AuthenticationRequest>> AuthenticationSucceeded;
/// <summary>
/// Gets the sessions.
@@ -206,19 +218,14 @@ namespace MediaBrowser.Controller.Session
/// <param name="sessionId">The session identifier.</param>
/// <param name="item">The item.</param>
void ReportNowViewingItem(string sessionId, BaseItemInfo item);
-
+
/// <summary>
/// Authenticates the new session.
/// </summary>
- /// <param name="user">The user.</param>
- /// <param name="password">The password.</param>
- /// <param name="clientType">Type of the client.</param>
- /// <param name="appVersion">The application version.</param>
- /// <param name="deviceId">The device identifier.</param>
- /// <param name="deviceName">Name of the device.</param>
- /// <param name="remoteEndPoint">The remote end point.</param>
+ /// <param name="request">The request.</param>
+ /// <param name="isLocal">if set to <c>true</c> [is local].</param>
/// <returns>Task{SessionInfo}.</returns>
- Task<SessionInfo> AuthenticateNewSession(User user, string password, string clientType, string appVersion, string deviceId, string deviceName, string remoteEndPoint);
+ Task<AuthenticationResult> AuthenticateNewSession(AuthenticationRequest request, bool isLocal);
/// <summary>
/// Reports the capabilities.
@@ -239,5 +246,41 @@ namespace MediaBrowser.Controller.Session
/// </summary>
/// <param name="deviceId">The device identifier.</param>
void ClearTranscodingInfo(string deviceId);
+
+ /// <summary>
+ /// Gets the session.
+ /// </summary>
+ /// <param name="deviceId">The device identifier.</param>
+ /// <param name="client">The client.</param>
+ /// <param name="version">The version.</param>
+ /// <returns>SessionInfo.</returns>
+ SessionInfo GetSession(string deviceId, string client, string version);
+
+ /// <summary>
+ /// Validates the security token.
+ /// </summary>
+ /// <param name="accessToken">The access token.</param>
+ void ValidateSecurityToken(string accessToken);
+
+ /// <summary>
+ /// Logouts the specified access token.
+ /// </summary>
+ /// <param name="accessToken">The access token.</param>
+ /// <returns>Task.</returns>
+ Task Logout(string accessToken);
+
+ /// <summary>
+ /// Revokes the user tokens.
+ /// </summary>
+ /// <param name="userId">The user identifier.</param>
+ /// <returns>Task.</returns>
+ Task RevokeUserTokens(string userId);
+
+ /// <summary>
+ /// Revokes the token.
+ /// </summary>
+ /// <param name="id">The identifier.</param>
+ /// <returns>Task.</returns>
+ Task RevokeToken(string id);
}
} \ No newline at end of file
diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs
index 6f27f6cb28..53a8d5a7cb 100644
--- a/MediaBrowser.Controller/Session/SessionInfo.cs
+++ b/MediaBrowser.Controller/Session/SessionInfo.cs
@@ -123,7 +123,7 @@ namespace MediaBrowser.Controller.Session
public List<string> SupportedCommands { get; set; }
public TranscodingInfo TranscodingInfo { get; set; }
-
+
/// <summary>
/// Gets a value indicating whether this instance is active.
/// </summary>
@@ -156,7 +156,7 @@ namespace MediaBrowser.Controller.Session
public bool ContainsUser(Guid userId)
{
- return (UserId ?? Guid.Empty) == UserId || AdditionalUsers.Any(i => userId == new Guid(i.UserId));
+ return (UserId ?? Guid.Empty) == userId || AdditionalUsers.Any(i => userId == new Guid(i.UserId));
}
}
}