/* * 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; using System.Diagnostics; namespace OpenIddict.EntityFrameworkCore.Models { /// /// Represents an OpenIddict token. /// public class OpenIddictToken : OpenIddictToken { public OpenIddictToken() { // Generate a new string identifier. Id = Guid.NewGuid().ToString(); } } /// /// Represents an OpenIddict token. /// public class OpenIddictToken : OpenIddictToken, OpenIddictAuthorization> where TKey : IEquatable { } /// /// Represents an OpenIddict token. /// [DebuggerDisplay("Id = {Id.ToString(),nq} ; Subject = {Subject,nq} ; Type = {Type,nq} ; Status = {Status,nq}")] public class OpenIddictToken where TKey : IEquatable { /// /// Gets or sets the application associated with the current token. /// public virtual TApplication Application { get; set; } /// /// Gets or sets the authorization associated with the current token. /// public virtual TAuthorization Authorization { get; set; } /// /// Gets or sets the concurrency token. /// public virtual string ConcurrencyToken { get; set; } = Guid.NewGuid().ToString(); /// /// Gets or sets the date on which the token /// will start to be considered valid. /// public virtual DateTimeOffset? CreationDate { get; set; } /// /// Gets or sets the date on which the token /// will no longer be considered valid. /// public virtual DateTimeOffset? ExpirationDate { get; set; } /// /// Gets or sets the unique identifier /// associated with the current token. /// public virtual TKey Id { get; set; } /// /// Gets or sets the payload of the current token, if applicable. /// Note: this property is only used for reference tokens /// and may be encrypted for security reasons. /// public virtual string Payload { get; set; } /// /// Gets or sets the additional properties serialized as a JSON object, /// or null if no bag was associated with the current token. /// public virtual string Properties { get; set; } /// /// Gets or sets the reference identifier associated /// with the current token, if applicable. /// 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 status of the current token. /// public virtual string Status { get; set; } /// /// Gets or sets the subject associated with the current token. /// public virtual string Subject { get; set; } /// /// Gets or sets the type of the current token. /// public virtual string Type { get; set; } } }