aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Data/Entities/Security
diff options
context:
space:
mode:
Diffstat (limited to 'Jellyfin.Data/Entities/Security')
-rw-r--r--Jellyfin.Data/Entities/Security/ApiKey.cs56
-rw-r--r--Jellyfin.Data/Entities/Security/Device.cs107
-rw-r--r--Jellyfin.Data/Entities/Security/DeviceOptions.cs35
3 files changed, 0 insertions, 198 deletions
diff --git a/Jellyfin.Data/Entities/Security/ApiKey.cs b/Jellyfin.Data/Entities/Security/ApiKey.cs
deleted file mode 100644
index 1fcbe0f5e..000000000
--- a/Jellyfin.Data/Entities/Security/ApiKey.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using System;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Globalization;
-
-namespace Jellyfin.Data.Entities.Security
-{
- /// <summary>
- /// An entity representing an API key.
- /// </summary>
- public class ApiKey
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ApiKey"/> class.
- /// </summary>
- /// <param name="name">The name.</param>
- public ApiKey(string name)
- {
- Name = name;
-
- AccessToken = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
- DateCreated = DateTime.UtcNow;
- }
-
- /// <summary>
- /// Gets the id.
- /// </summary>
- /// <remarks>
- /// Identity, Indexed, Required.
- /// </remarks>
- [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id { get; private set; }
-
- /// <summary>
- /// Gets or sets the date created.
- /// </summary>
- public DateTime DateCreated { get; set; }
-
- /// <summary>
- /// Gets or sets the date of last activity.
- /// </summary>
- public DateTime DateLastActivity { get; set; }
-
- /// <summary>
- /// Gets or sets the name.
- /// </summary>
- [MaxLength(64)]
- [StringLength(64)]
- public string Name { get; set; }
-
- /// <summary>
- /// Gets or sets the access token.
- /// </summary>
- public string AccessToken { get; set; }
- }
-}
diff --git a/Jellyfin.Data/Entities/Security/Device.cs b/Jellyfin.Data/Entities/Security/Device.cs
deleted file mode 100644
index 67d7f78ed..000000000
--- a/Jellyfin.Data/Entities/Security/Device.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-using System;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Globalization;
-
-namespace Jellyfin.Data.Entities.Security
-{
- /// <summary>
- /// An entity representing a device.
- /// </summary>
- public class Device
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="Device"/> class.
- /// </summary>
- /// <param name="userId">The user id.</param>
- /// <param name="appName">The app name.</param>
- /// <param name="appVersion">The app version.</param>
- /// <param name="deviceName">The device name.</param>
- /// <param name="deviceId">The device id.</param>
- public Device(Guid userId, string appName, string appVersion, string deviceName, string deviceId)
- {
- UserId = userId;
- AppName = appName;
- AppVersion = appVersion;
- DeviceName = deviceName;
- DeviceId = deviceId;
-
- AccessToken = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
- DateCreated = DateTime.UtcNow;
- DateModified = DateCreated;
- DateLastActivity = DateCreated;
-
- // Non-nullable for EF Core, as this is a required relationship.
- User = null!;
- }
-
- /// <summary>
- /// Gets the id.
- /// </summary>
- [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id { get; private set; }
-
- /// <summary>
- /// Gets the user id.
- /// </summary>
- public Guid UserId { get; private set; }
-
- /// <summary>
- /// Gets or sets the access token.
- /// </summary>
- public string AccessToken { get; set; }
-
- /// <summary>
- /// Gets or sets the app name.
- /// </summary>
- [MaxLength(64)]
- [StringLength(64)]
- public string AppName { get; set; }
-
- /// <summary>
- /// Gets or sets the app version.
- /// </summary>
- [MaxLength(32)]
- [StringLength(32)]
- public string AppVersion { get; set; }
-
- /// <summary>
- /// Gets or sets the device name.
- /// </summary>
- [MaxLength(64)]
- [StringLength(64)]
- public string DeviceName { get; set; }
-
- /// <summary>
- /// Gets or sets the device id.
- /// </summary>
- [MaxLength(256)]
- [StringLength(256)]
- public string DeviceId { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether this device is active.
- /// </summary>
- public bool IsActive { get; set; }
-
- /// <summary>
- /// Gets or sets the date created.
- /// </summary>
- public DateTime DateCreated { get; set; }
-
- /// <summary>
- /// Gets or sets the date modified.
- /// </summary>
- public DateTime DateModified { get; set; }
-
- /// <summary>
- /// Gets or sets the date of last activity.
- /// </summary>
- public DateTime DateLastActivity { get; set; }
-
- /// <summary>
- /// Gets the user.
- /// </summary>
- public User User { get; private set; }
- }
-}
diff --git a/Jellyfin.Data/Entities/Security/DeviceOptions.cs b/Jellyfin.Data/Entities/Security/DeviceOptions.cs
deleted file mode 100644
index 531f66c62..000000000
--- a/Jellyfin.Data/Entities/Security/DeviceOptions.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.ComponentModel.DataAnnotations.Schema;
-
-namespace Jellyfin.Data.Entities.Security
-{
- /// <summary>
- /// An entity representing custom options for a device.
- /// </summary>
- public class DeviceOptions
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="DeviceOptions"/> class.
- /// </summary>
- /// <param name="deviceId">The device id.</param>
- public DeviceOptions(string deviceId)
- {
- DeviceId = deviceId;
- }
-
- /// <summary>
- /// Gets the id.
- /// </summary>
- [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id { get; private set; }
-
- /// <summary>
- /// Gets the device id.
- /// </summary>
- public string DeviceId { get; private set; }
-
- /// <summary>
- /// Gets or sets the custom name.
- /// </summary>
- public string? CustomName { get; set; }
- }
-}