aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Security
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller/Security')
-rw-r--r--MediaBrowser.Controller/Security/AuthenticationInfo.cs70
-rw-r--r--MediaBrowser.Controller/Security/AuthenticationInfoQuery.cs49
-rw-r--r--MediaBrowser.Controller/Security/IAuthenticationRepository.cs37
-rw-r--r--MediaBrowser.Controller/Security/IEncryptionManager.cs20
4 files changed, 176 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/Security/AuthenticationInfo.cs b/MediaBrowser.Controller/Security/AuthenticationInfo.cs
new file mode 100644
index 000000000..c75bf89e4
--- /dev/null
+++ b/MediaBrowser.Controller/Security/AuthenticationInfo.cs
@@ -0,0 +1,70 @@
+using System;
+
+namespace MediaBrowser.Controller.Security
+{
+ public class AuthenticationInfo
+ {
+ /// <summary>
+ /// Gets or sets the identifier.
+ /// </summary>
+ /// <value>The identifier.</value>
+ public long Id { get; set; }
+
+ /// <summary>
+ /// Gets or sets the access token.
+ /// </summary>
+ /// <value>The access token.</value>
+ public string AccessToken { get; set; }
+
+ /// <summary>
+ /// Gets or sets the device identifier.
+ /// </summary>
+ /// <value>The device identifier.</value>
+ public string DeviceId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the name of the application.
+ /// </summary>
+ /// <value>The name of the application.</value>
+ public string AppName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the application version.
+ /// </summary>
+ /// <value>The application version.</value>
+ public string AppVersion { get; set; }
+
+ /// <summary>
+ /// Gets or sets the name of the device.
+ /// </summary>
+ /// <value>The name of the device.</value>
+ public string DeviceName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the user identifier.
+ /// </summary>
+ /// <value>The user identifier.</value>
+ public Guid UserId { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance is active.
+ /// </summary>
+ /// <value><c>true</c> if this instance is active; otherwise, <c>false</c>.</value>
+ public bool IsActive { get; set; }
+
+ /// <summary>
+ /// Gets or sets the date created.
+ /// </summary>
+ /// <value>The date created.</value>
+ public DateTime DateCreated { get; set; }
+
+ /// <summary>
+ /// Gets or sets the date revoked.
+ /// </summary>
+ /// <value>The date revoked.</value>
+ public DateTime? DateRevoked { get; set; }
+
+ public DateTime DateLastActivity { get; set; }
+ public string UserName { get; set;}
+ }
+}
diff --git a/MediaBrowser.Controller/Security/AuthenticationInfoQuery.cs b/MediaBrowser.Controller/Security/AuthenticationInfoQuery.cs
new file mode 100644
index 000000000..125534c46
--- /dev/null
+++ b/MediaBrowser.Controller/Security/AuthenticationInfoQuery.cs
@@ -0,0 +1,49 @@
+using System;
+
+namespace MediaBrowser.Controller.Security
+{
+ public class AuthenticationInfoQuery
+ {
+ /// <summary>
+ /// Gets or sets the device identifier.
+ /// </summary>
+ /// <value>The device identifier.</value>
+ public string DeviceId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the user identifier.
+ /// </summary>
+ /// <value>The user identifier.</value>
+ public Guid UserId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the access token.
+ /// </summary>
+ /// <value>The access token.</value>
+ public string AccessToken { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance is active.
+ /// </summary>
+ /// <value><c>null</c> if [is active] contains no value, <c>true</c> if [is active]; otherwise, <c>false</c>.</value>
+ public bool? IsActive { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance has user.
+ /// </summary>
+ /// <value><c>null</c> if [has user] contains no value, <c>true</c> if [has user]; otherwise, <c>false</c>.</value>
+ public bool? HasUser { get; set; }
+
+ /// <summary>
+ /// Gets or sets the start index.
+ /// </summary>
+ /// <value>The start index.</value>
+ public int? StartIndex { get; set; }
+
+ /// <summary>
+ /// Gets or sets the limit.
+ /// </summary>
+ /// <value>The limit.</value>
+ public int? Limit { get; set; }
+ }
+}
diff --git a/MediaBrowser.Controller/Security/IAuthenticationRepository.cs b/MediaBrowser.Controller/Security/IAuthenticationRepository.cs
new file mode 100644
index 000000000..2843c6b73
--- /dev/null
+++ b/MediaBrowser.Controller/Security/IAuthenticationRepository.cs
@@ -0,0 +1,37 @@
+using MediaBrowser.Model.Devices;
+using MediaBrowser.Model.Querying;
+using System.Threading;
+
+namespace MediaBrowser.Controller.Security
+{
+ public interface IAuthenticationRepository
+ {
+ /// <summary>
+ /// Creates the specified information.
+ /// </summary>
+ /// <param name="info">The information.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ void Create(AuthenticationInfo info);
+
+ /// <summary>
+ /// Updates the specified information.
+ /// </summary>
+ /// <param name="info">The information.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ void Update(AuthenticationInfo info);
+
+ /// <summary>
+ /// Gets the specified query.
+ /// </summary>
+ /// <param name="query">The query.</param>
+ /// <returns>QueryResult{AuthenticationInfo}.</returns>
+ QueryResult<AuthenticationInfo> Get(AuthenticationInfoQuery query);
+
+ void Delete(AuthenticationInfo info);
+
+ DeviceOptions GetDeviceOptions(string deviceId);
+ void UpdateDeviceOptions(string deviceId, DeviceOptions options);
+ }
+}
diff --git a/MediaBrowser.Controller/Security/IEncryptionManager.cs b/MediaBrowser.Controller/Security/IEncryptionManager.cs
new file mode 100644
index 000000000..bb4f77d83
--- /dev/null
+++ b/MediaBrowser.Controller/Security/IEncryptionManager.cs
@@ -0,0 +1,20 @@
+
+namespace MediaBrowser.Controller.Security
+{
+ public interface IEncryptionManager
+ {
+ /// <summary>
+ /// Encrypts the string.
+ /// </summary>
+ /// <param name="value">The value.</param>
+ /// <returns>System.String.</returns>
+ string EncryptString(string value);
+
+ /// <summary>
+ /// Decrypts the string.
+ /// </summary>
+ /// <param name="value">The value.</param>
+ /// <returns>System.String.</returns>
+ string DecryptString(string value);
+ }
+}