2019-01-13 21:01:16 +01:00
|
|
|
using System;
|
2025-02-05 01:10:39 +01:00
|
|
|
using System.Diagnostics.CodeAnalysis;
|
2020-05-12 22:10:35 -04:00
|
|
|
using Jellyfin.Data.Entities;
|
2018-12-27 18:27:57 -05:00
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Net
|
|
|
|
|
{
|
2020-10-28 08:40:11 -06:00
|
|
|
/// <summary>
|
|
|
|
|
/// The request authorization info.
|
|
|
|
|
/// </summary>
|
2018-12-27 18:27:57 -05:00
|
|
|
public class AuthorizationInfo
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2020-05-12 22:10:35 -04:00
|
|
|
/// Gets the user identifier.
|
2018-12-27 18:27:57 -05:00
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The user identifier.</value>
|
2020-05-12 22:10:35 -04:00
|
|
|
public Guid UserId => User?.Id ?? Guid.Empty;
|
2019-01-07 23:27:46 +00:00
|
|
|
|
2018-12-27 18:27:57 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the device identifier.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The device identifier.</value>
|
2025-02-05 01:10:39 +01:00
|
|
|
public string? DeviceId { get; set; }
|
2020-05-12 22:10:35 -04:00
|
|
|
|
2018-12-27 18:27:57 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the device.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The device.</value>
|
2025-02-05 01:10:39 +01:00
|
|
|
public string? Device { get; set; }
|
2020-05-12 22:10:35 -04:00
|
|
|
|
2018-12-27 18:27:57 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the client.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The client.</value>
|
2025-02-05 01:10:39 +01:00
|
|
|
public string? Client { get; set; }
|
2020-05-12 22:10:35 -04:00
|
|
|
|
2018-12-27 18:27:57 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the version.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The version.</value>
|
2025-02-05 01:10:39 +01:00
|
|
|
public string? Version { get; set; }
|
2020-05-12 22:10:35 -04:00
|
|
|
|
2018-12-27 18:27:57 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the token.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The token.</value>
|
2025-02-05 01:10:39 +01:00
|
|
|
public string? Token { get; set; }
|
2018-12-27 18:27:57 -05:00
|
|
|
|
2020-10-28 08:40:11 -06:00
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets a value indicating whether the authorization is from an api key.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsApiKey { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the user making the request.
|
|
|
|
|
/// </summary>
|
2025-02-05 01:10:39 +01:00
|
|
|
public User? User { get; set; }
|
2020-11-08 16:10:33 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets a value indicating whether the token is authenticated.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsAuthenticated { get; set; }
|
2020-12-01 14:47:42 -07:00
|
|
|
|
|
|
|
|
/// <summary>
|
2025-02-05 01:10:39 +01:00
|
|
|
/// Gets a value indicating whether the request has a token.
|
2020-12-01 14:47:42 -07:00
|
|
|
/// </summary>
|
2025-02-05 01:10:39 +01:00
|
|
|
[MemberNotNullWhen(true, nameof(Token))]
|
|
|
|
|
public bool HasToken => !string.IsNullOrWhiteSpace(Token);
|
2018-12-27 18:27:57 -05:00
|
|
|
}
|
|
|
|
|
}
|