diff --git a/samples/Mvc.Server/Mvc.Server.csproj b/samples/Mvc.Server/Mvc.Server.csproj
index 5e76d4a6..164c4213 100644
--- a/samples/Mvc.Server/Mvc.Server.csproj
+++ b/samples/Mvc.Server/Mvc.Server.csproj
@@ -3,6 +3,7 @@
netcoreapp3.1
false
+ false
false
diff --git a/src/OpenIddict.Abstractions/Descriptors/OpenIddictAuthorizationDescriptor.cs b/src/OpenIddict.Abstractions/Descriptors/OpenIddictAuthorizationDescriptor.cs
index f53911a5..88563153 100644
--- a/src/OpenIddict.Abstractions/Descriptors/OpenIddictAuthorizationDescriptor.cs
+++ b/src/OpenIddict.Abstractions/Descriptors/OpenIddictAuthorizationDescriptor.cs
@@ -14,6 +14,11 @@ namespace OpenIddict.Abstractions
///
public string? ApplicationId { get; set; }
+ ///
+ /// Gets or sets the creation date associated with the authorization.
+ ///
+ public DateTimeOffset? CreationDate { get; set; }
+
///
/// Gets or sets the optional principal associated with the authorization.
/// Note: this property is not stored by the default authorization stores.
diff --git a/src/OpenIddict.Abstractions/Managers/IOpenIddictAuthorizationManager.cs b/src/OpenIddict.Abstractions/Managers/IOpenIddictAuthorizationManager.cs
index 4d6f111c..ed2dbf3d 100644
--- a/src/OpenIddict.Abstractions/Managers/IOpenIddictAuthorizationManager.cs
+++ b/src/OpenIddict.Abstractions/Managers/IOpenIddictAuthorizationManager.cs
@@ -212,6 +212,17 @@ namespace OpenIddict.Abstractions
Func, TState, IQueryable> query,
TState state, CancellationToken cancellationToken = default);
+ ///
+ /// Retrieves the creation date associated with an authorization.
+ ///
+ /// The authorization.
+ /// The that can be used to abort the operation.
+ ///
+ /// A that can be used to monitor the asynchronous operation,
+ /// whose result returns the creation date associated with the specified authorization.
+ ///
+ ValueTask GetCreationDateAsync(object authorization, CancellationToken cancellationToken = default);
+
///
/// Retrieves the unique identifier associated with an authorization.
///
@@ -350,13 +361,19 @@ namespace OpenIddict.Abstractions
ValueTask PopulateAsync(object authorization, OpenIddictAuthorizationDescriptor descriptor, CancellationToken cancellationToken = default);
///
- /// Removes the authorizations that are marked as invalid and the ad-hoc ones that have no valid/nonexpired token attached.
+ /// Removes the authorizations that are marked as invalid and the ad-hoc ones that have no token attached.
+ /// Only authorizations created before the specified are removed.
///
+ ///
+ /// To ensure ad-hoc authorizations that no longer have any valid/non-expired token
+ /// attached are correctly removed, the tokens should always be pruned first.
+ ///
+ /// The date before which authorizations are not pruned.
/// The that can be used to abort the operation.
///
/// A that can be used to monitor the asynchronous operation.
///
- ValueTask PruneAsync(CancellationToken cancellationToken = default);
+ ValueTask PruneAsync(DateTimeOffset threshold, CancellationToken cancellationToken = default);
///
/// Sets the application identifier associated with an authorization.
diff --git a/src/OpenIddict.Abstractions/Managers/IOpenIddictTokenManager.cs b/src/OpenIddict.Abstractions/Managers/IOpenIddictTokenManager.cs
index ba889d5a..90775c84 100644
--- a/src/OpenIddict.Abstractions/Managers/IOpenIddictTokenManager.cs
+++ b/src/OpenIddict.Abstractions/Managers/IOpenIddictTokenManager.cs
@@ -375,13 +375,15 @@ namespace OpenIddict.Abstractions
ValueTask PopulateAsync(object token, OpenIddictTokenDescriptor descriptor, CancellationToken cancellationToken = default);
///
- /// Removes the tokens that are marked as expired or invalid.
+ /// Removes the tokens that are marked as invalid or whose attached authorization is no longer valid.
+ /// Only tokens created before the specified are removed.
///
+ /// The date before which tokens are not pruned.
/// The that can be used to abort the operation.
///
/// A that can be used to monitor the asynchronous operation.
///
- ValueTask PruneAsync(CancellationToken cancellationToken = default);
+ ValueTask PruneAsync(DateTimeOffset threshold, CancellationToken cancellationToken = default);
///
/// Sets the application identifier associated with a token.
diff --git a/src/OpenIddict.Abstractions/OpenIddictBuilder.cs b/src/OpenIddict.Abstractions/OpenIddictBuilder.cs
index 6274e1e1..a7c0d7c4 100644
--- a/src/OpenIddict.Abstractions/OpenIddictBuilder.cs
+++ b/src/OpenIddict.Abstractions/OpenIddictBuilder.cs
@@ -27,25 +27,15 @@ namespace Microsoft.Extensions.DependencyInjection
[EditorBrowsable(EditorBrowsableState.Never)]
public IServiceCollection Services { get; }
- ///
- /// Determines whether the specified object is equal to the current object.
- ///
- /// The object to compare with the current object.
- /// true if the specified object is equal to the current object; otherwise, false.
+ ///
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object? obj) => base.Equals(obj);
- ///
- /// Serves as the default hash function.
- ///
- /// A hash code for the current object.
+ ///
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode() => base.GetHashCode();
- ///
- /// Returns a string that represents the current object.
- ///
- /// A string that represents the current object.
+ ///
[EditorBrowsable(EditorBrowsableState.Never)]
public override string? ToString() => base.ToString();
}
diff --git a/src/OpenIddict.Abstractions/Resources/OpenIddictResources.resx b/src/OpenIddict.Abstractions/Resources/OpenIddictResources.resx
index 92883256..c4fbcd42 100644
--- a/src/OpenIddict.Abstractions/Resources/OpenIddictResources.resx
+++ b/src/OpenIddict.Abstractions/Resources/OpenIddictResources.resx
@@ -1377,6 +1377,10 @@ To register the OpenIddict core services, reference the 'OpenIddict.Core' packag
The maximum refire count cannot be negative.
{Locked}
+
+ The duration cannot be less than 10 minutes.
+ {Locked}
+
The security token is missing.
diff --git a/src/OpenIddict.Abstractions/Resources/xlf/OpenIddictResources.ar.xlf b/src/OpenIddict.Abstractions/Resources/xlf/OpenIddictResources.ar.xlf
index 6b33f5ca..17172ecf 100644
--- a/src/OpenIddict.Abstractions/Resources/xlf/OpenIddictResources.ar.xlf
+++ b/src/OpenIddict.Abstractions/Resources/xlf/OpenIddictResources.ar.xlf
@@ -599,4 +599,4 @@