/* * 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 authorization. /// public class OpenIddictEntityFrameworkAuthorization : OpenIddictEntityFrameworkAuthorization { public OpenIddictEntityFrameworkAuthorization() { // Generate a new string identifier. Id = Guid.NewGuid().ToString(); } } /// /// Represents an OpenIddict authorization. /// [DebuggerDisplay("Id = {Id.ToString(),nq} ; Subject = {Subject,nq} ; Type = {Type,nq} ; Status = {Status,nq}")] public class OpenIddictEntityFrameworkAuthorization where TKey : notnull, IEquatable where TApplication : class where TToken : class { /// /// Gets or sets the application associated with the current authorization. /// public virtual TApplication? Application { get; set; } /// /// Gets or sets the concurrency token. /// public virtual string? ConcurrencyToken { get; set; } = Guid.NewGuid().ToString(); /// /// Gets or sets the UTC creation date of the current authorization. /// public virtual DateTime? CreationDate { get; set; } /// /// Gets or sets the unique identifier associated with the current authorization. /// public virtual TKey? Id { get; set; } /// /// Gets or sets the additional properties serialized as a JSON object, /// or if no bag was associated with the current authorization. /// [StringSyntax(StringSyntaxAttribute.Json)] public virtual string? Properties { get; set; } /// /// Gets or sets the scopes associated with the current /// authorization, serialized as a JSON array. /// [StringSyntax(StringSyntaxAttribute.Json)] public virtual string? Scopes { get; set; } /// /// Gets or sets the status of the current authorization. /// public virtual string? Status { get; set; } /// /// Gets or sets the subject associated with the current authorization. /// public virtual string? Subject { get; set; } /// /// Gets the list of tokens associated with the current authorization. /// public virtual ICollection Tokens { get; } = new HashSet(); /// /// Gets or sets the type of the current authorization. /// public virtual string? Type { get; set; } }