Generate Access token in constructor

pull/6201/head
Patrick Barron 4 years ago
parent f4d1c3ef7a
commit b03f2353d8

@ -1,6 +1,7 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Globalization;
namespace Jellyfin.Data.Entities.Security namespace Jellyfin.Data.Entities.Security
{ {
@ -13,20 +14,19 @@ namespace Jellyfin.Data.Entities.Security
/// Initializes a new instance of the <see cref="Device"/> class. /// Initializes a new instance of the <see cref="Device"/> class.
/// </summary> /// </summary>
/// <param name="userId">The user id.</param> /// <param name="userId">The user id.</param>
/// <param name="accessToken">The access token.</param>
/// <param name="appName">The app name.</param> /// <param name="appName">The app name.</param>
/// <param name="appVersion">The app version.</param> /// <param name="appVersion">The app version.</param>
/// <param name="deviceName">The device name.</param> /// <param name="deviceName">The device name.</param>
/// <param name="deviceId">The device id.</param> /// <param name="deviceId">The device id.</param>
public Device(Guid userId, string accessToken, string appName, string appVersion, string deviceName, string deviceId) public Device(Guid userId, string appName, string appVersion, string deviceName, string deviceId)
{ {
UserId = userId; UserId = userId;
AccessToken = accessToken;
AppName = appName; AppName = appName;
AppVersion = appVersion; AppVersion = appVersion;
DeviceName = deviceName; DeviceName = deviceName;
DeviceId = deviceId; DeviceId = deviceId;
AccessToken = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
DateCreated = DateTime.UtcNow; DateCreated = DateTime.UtcNow;
DateLastActivity = DateCreated; DateLastActivity = DateCreated;

Loading…
Cancel
Save