/* * 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; namespace OpenIddict.MongoDb.Models; /// /// Represents an OpenIddict token. /// [DebuggerDisplay("Id = {Id.ToString(),nq} ; Subject = {Subject,nq} ; Type = {Type,nq} ; Status = {Status,nq}")] public class OpenIddictMongoDbToken { /// /// Gets or sets the identifier of the application associated with the current token. /// [BsonElement("application_id"), BsonIgnoreIfDefault] public virtual ObjectId ApplicationId { get; set; } /// /// Gets or sets the identifier of the authorization associated with the current token. /// [BsonElement("authorization_id"), BsonIgnoreIfDefault] public virtual ObjectId AuthorizationId { get; set; } /// /// Gets or sets the concurrency token. /// [BsonElement("concurrency_token"), BsonIgnoreIfNull] public virtual string? ConcurrencyToken { get; set; } = Guid.NewGuid().ToString(); /// /// Gets or sets the UTC creation date of the current token. /// [BsonElement("creation_date"), BsonIgnoreIfNull] public virtual DateTime? CreationDate { get; set; } /// /// Gets or sets the UTC expiration date of the current token. /// [BsonElement("expiration_date"), BsonIgnoreIfNull] public virtual DateTime? ExpirationDate { get; set; } /// /// Gets or sets the unique identifier associated with the current token. /// [BsonId, BsonRequired] public virtual ObjectId 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. /// [BsonElement("payload"), BsonIgnoreIfNull] public virtual string? Payload { get; set; } /// /// Gets or sets the additional properties associated with the current token. /// [BsonElement("properties"), BsonIgnoreIfNull] public virtual BsonDocument? Properties { get; set; } /// /// Gets or sets the UTC redemption date of the current token. /// [BsonElement("redemption_date"), BsonIgnoreIfNull] public virtual DateTime? RedemptionDate { 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. /// [BsonElement("reference_id"), BsonIgnoreIfNull] public virtual string? ReferenceId { get; set; } /// /// Gets or sets the status of the current token. /// [BsonElement("status"), BsonIgnoreIfNull] public virtual string? Status { get; set; } /// /// Gets or sets the subject associated with the current token. /// [BsonElement("subject"), BsonIgnoreIfNull] public virtual string? Subject { get; set; } /// /// Gets or sets the type of the current token. /// [BsonElement("type"), BsonIgnoreIfNull] public virtual string? Type { get; set; } }