/* * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) * See https://github.com/openiddict/openiddict-core for more information concerning * the license and the contributors participating to this project. */ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; namespace OpenIddict.EntityFramework.Models; /// /// Represents an OpenIddict token. /// public class OpenIddictEntityFrameworkToken : OpenIddictEntityFrameworkToken { public OpenIddictEntityFrameworkToken() => Id = Guid.NewGuid().ToString(); } /// /// Represents an OpenIddict token. /// [DebuggerDisplay("Id = {Id.ToString(),nq} ; Subject = {Subject,nq} ; Type = {Type,nq} ; Status = {Status,nq}")] public class OpenIddictEntityFrameworkToken where TKey : notnull, IEquatable where TApplication : class where TAuthorization : class where TSession : class { /// /// Gets or sets the application associated with the token. /// public virtual TApplication? Application { get; set; } /// /// Gets or sets the authorization associated with the token. /// public virtual TAuthorization? Authorization { get; set; } /// /// Gets or sets the concurrency token of the token. /// public virtual string? ConcurrencyToken { get; set; } = Guid.NewGuid().ToString(); /// /// Gets or sets the UTC creation date of the token. /// public virtual DateTime? CreationDate { get; set; } /// /// Gets or sets the UTC expiration date of the token. /// public virtual DateTime? ExpirationDate { get; set; } /// /// Gets or sets the unique identifier of the token. /// public virtual TKey? Id { get; set; } /// /// Gets or sets the payload of the token. /// /// /// Note: this property is only used for reference tokens /// and may be hashed or encrypted for security reasons. /// public virtual string? Payload { get; set; } /// /// Gets or sets the additional properties of the token, serialized as a JSON object. /// [StringSyntax(StringSyntaxAttribute.Json)] public virtual string? Properties { get; set; } /// /// Gets or sets the UTC redemption date of the token. /// public virtual DateTime? RedemptionDate { get; set; } /// /// Gets or sets the reference identifier associated with the token. /// /// /// Note: this property is only used for reference tokens /// and may be hashed or encrypted for security reasons. /// public virtual string? ReferenceId { get; set; } /// /// Gets or sets the session associated with the token. /// public virtual TSession? Session { get; set; } /// /// Gets or sets the status of the token. /// public virtual string? Status { get; set; } /// /// Gets or sets the subject of the token. /// public virtual string? Subject { get; set; } /// /// Gets or sets the type of the token. /// public virtual string? Type { get; set; } }