diff --git a/build/dependencies.props b/build/dependencies.props
index 5a2b5b76..cedd715a 100644
--- a/build/dependencies.props
+++ b/build/dependencies.props
@@ -16,6 +16,7 @@
2.0.0
2.0.0
2.0.0
+ 4.4.0
15.3.0
2.3.1
diff --git a/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs b/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs
index e60ab678..c9869f39 100644
--- a/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs
+++ b/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs
@@ -326,10 +326,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the client identifier associated with the application.
///
- public virtual Task GetClientIdAsync([NotNull] TApplication application, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetClientIdAsync([NotNull] TApplication application, CancellationToken cancellationToken = default)
{
if (application == null)
{
@@ -345,10 +345,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the client type of the application (by default, "public").
///
- public virtual async Task GetClientTypeAsync(
+ public virtual async ValueTask GetClientTypeAsync(
[NotNull] TApplication application, CancellationToken cancellationToken = default)
{
if (application == null)
@@ -376,10 +376,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the consent type of the application (by default, "explicit").
///
- public virtual async Task GetConsentTypeAsync([NotNull] TApplication application, CancellationToken cancellationToken = default)
+ public virtual async ValueTask GetConsentTypeAsync([NotNull] TApplication application, CancellationToken cancellationToken = default)
{
if (application == null)
{
@@ -401,10 +401,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the display name associated with the application.
///
- public virtual Task GetDisplayNameAsync([NotNull] TApplication application, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetDisplayNameAsync([NotNull] TApplication application, CancellationToken cancellationToken = default)
{
if (application == null)
{
@@ -420,10 +420,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the unique identifier associated with the application.
///
- public virtual Task GetIdAsync([NotNull] TApplication application, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetIdAsync([NotNull] TApplication application, CancellationToken cancellationToken = default)
{
if (application == null)
{
@@ -439,10 +439,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns all the permissions associated with the application.
///
- public virtual Task> GetPermissionsAsync(
+ public virtual ValueTask> GetPermissionsAsync(
[NotNull] TApplication application, CancellationToken cancellationToken = default)
{
if (application == null)
@@ -459,10 +459,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation, whose
- /// result returns all the post_logout_redirect_uri associated with the application.
+ /// A that can be used to monitor the asynchronous operation,
+ /// whose result returns all the post_logout_redirect_uri associated with the application.
///
- public virtual Task> GetPostLogoutRedirectUrisAsync(
+ public virtual ValueTask> GetPostLogoutRedirectUrisAsync(
[NotNull] TApplication application, CancellationToken cancellationToken = default)
{
if (application == null)
@@ -479,10 +479,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns all the redirect_uri associated with the application.
///
- public virtual Task> GetRedirectUrisAsync(
+ public virtual ValueTask> GetRedirectUrisAsync(
[NotNull] TApplication application, CancellationToken cancellationToken = default)
{
if (application == null)
diff --git a/src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs b/src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs
index c362a269..c944105c 100644
--- a/src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs
+++ b/src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs
@@ -386,10 +386,10 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the application identifier associated with the authorization.
///
- public virtual Task GetApplicationIdAsync(
+ public virtual ValueTask GetApplicationIdAsync(
[NotNull] TAuthorization authorization, CancellationToken cancellationToken = default)
{
if (authorization == null)
@@ -446,10 +446,10 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the unique identifier associated with the authorization.
///
- public virtual Task GetIdAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetIdAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken = default)
{
if (authorization == null)
{
@@ -465,10 +465,10 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the scopes associated with the specified authorization.
///
- public virtual Task> GetScopesAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken = default)
+ public virtual ValueTask> GetScopesAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken = default)
{
if (authorization == null)
{
@@ -484,10 +484,10 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the status associated with the specified authorization.
///
- public virtual Task GetStatusAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetStatusAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken = default)
{
if (authorization == null)
{
@@ -503,10 +503,10 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the subject associated with the specified authorization.
///
- public virtual Task GetSubjectAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetSubjectAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken = default)
{
if (authorization == null)
{
@@ -522,10 +522,10 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the type associated with the specified authorization.
///
- public virtual Task GetTypeAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetTypeAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken = default)
{
if (authorization == null)
{
diff --git a/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs b/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs
index b0eecfb4..ec4015d4 100644
--- a/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs
+++ b/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs
@@ -248,10 +248,10 @@ namespace OpenIddict.Core
/// The scope.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the description associated with the specified scope.
///
- public virtual Task GetDescriptionAsync([NotNull] TScope scope, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetDescriptionAsync([NotNull] TScope scope, CancellationToken cancellationToken = default)
{
if (scope == null)
{
@@ -267,10 +267,10 @@ namespace OpenIddict.Core
/// The scope.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the display name associated with the scope.
///
- public virtual Task GetDisplayNameAsync([NotNull] TScope scope, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetDisplayNameAsync([NotNull] TScope scope, CancellationToken cancellationToken = default)
{
if (scope == null)
{
@@ -286,10 +286,10 @@ namespace OpenIddict.Core
/// The scope.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the unique identifier associated with the scope.
///
- public virtual Task GetIdAsync([NotNull] TScope scope, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetIdAsync([NotNull] TScope scope, CancellationToken cancellationToken = default)
{
if (scope == null)
{
@@ -305,10 +305,10 @@ namespace OpenIddict.Core
/// The scope.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the name associated with the specified scope.
///
- public virtual Task GetNameAsync([NotNull] TScope scope, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetNameAsync([NotNull] TScope scope, CancellationToken cancellationToken = default)
{
if (scope == null)
{
@@ -324,10 +324,10 @@ namespace OpenIddict.Core
/// The scope.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns all the resources associated with the scope.
///
- public virtual Task> GetResourcesAsync(
+ public virtual ValueTask> GetResourcesAsync(
[NotNull] TScope scope, CancellationToken cancellationToken = default)
{
if (scope == null)
diff --git a/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs b/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs
index 6dc9cad0..2ea62973 100644
--- a/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs
+++ b/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs
@@ -279,10 +279,10 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the application identifier associated with the token.
///
- public virtual Task GetApplicationIdAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetApplicationIdAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
{
if (token == null)
{
@@ -338,10 +338,10 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the authorization identifier associated with the token.
///
- public virtual Task GetAuthorizationIdAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetAuthorizationIdAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
{
if (token == null)
{
@@ -357,10 +357,10 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the creation date associated with the specified token.
///
- public virtual Task GetCreationDateAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetCreationDateAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
{
if (token == null)
{
@@ -376,10 +376,10 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the expiration date associated with the specified token.
///
- public virtual Task GetExpirationDateAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetExpirationDateAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
{
if (token == null)
{
@@ -395,10 +395,10 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the unique identifier associated with the token.
///
- public virtual Task GetIdAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetIdAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
{
if (token == null)
{
@@ -414,10 +414,10 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the payload associated with the specified token.
///
- public virtual Task GetPayloadAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetPayloadAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
{
if (token == null)
{
@@ -435,10 +435,10 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the reference identifier associated with the specified token.
///
- public virtual Task GetReferenceIdAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetReferenceIdAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
{
if (token == null)
{
@@ -454,10 +454,10 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the status associated with the specified token.
///
- public virtual Task GetStatusAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
+ public virtual ValueTask GetStatusAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
{
if (token == null)
{
@@ -467,6 +467,44 @@ namespace OpenIddict.Core
return Store.GetStatusAsync(token, cancellationToken);
}
+ ///
+ /// Retrieves the subject associated with a token.
+ ///
+ /// The token.
+ /// The that can be used to abort the operation.
+ ///
+ /// A that can be used to monitor the asynchronous operation,
+ /// whose result returns the subject associated with the specified token.
+ ///
+ public virtual ValueTask GetSubjectAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
+ {
+ if (token == null)
+ {
+ throw new ArgumentNullException(nameof(token));
+ }
+
+ return Store.GetSubjectAsync(token, cancellationToken);
+ }
+
+ ///
+ /// Retrieves the token type associated with a token.
+ ///
+ /// The token.
+ /// The that can be used to abort the operation.
+ ///
+ /// A that can be used to monitor the asynchronous operation,
+ /// whose result returns the token type associated with the specified token.
+ ///
+ public virtual ValueTask GetTokenTypeAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
+ {
+ if (token == null)
+ {
+ throw new ArgumentNullException(nameof(token));
+ }
+
+ return Store.GetTokenTypeAsync(token, cancellationToken);
+ }
+
///
/// Determines whether a given token has already been redemeed.
///
diff --git a/src/OpenIddict.Core/OpenIddict.Core.csproj b/src/OpenIddict.Core/OpenIddict.Core.csproj
index 2d2f3931..32092ff8 100644
--- a/src/OpenIddict.Core/OpenIddict.Core.csproj
+++ b/src/OpenIddict.Core/OpenIddict.Core.csproj
@@ -26,6 +26,7 @@
+
diff --git a/src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs b/src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs
index 11f11698..c9f023e7 100644
--- a/src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs
+++ b/src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs
@@ -128,10 +128,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the client identifier associated with the application.
///
- Task GetClientIdAsync([NotNull] TApplication application, CancellationToken cancellationToken);
+ ValueTask GetClientIdAsync([NotNull] TApplication application, CancellationToken cancellationToken);
///
/// Retrieves the client secret associated with an application.
@@ -141,10 +141,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the client secret associated with the application.
///
- Task GetClientSecretAsync([NotNull] TApplication application, CancellationToken cancellationToken);
+ ValueTask GetClientSecretAsync([NotNull] TApplication application, CancellationToken cancellationToken);
///
/// Retrieves the client type associated with an application.
@@ -152,10 +152,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the client type of the application (by default, "public").
///
- Task GetClientTypeAsync([NotNull] TApplication application, CancellationToken cancellationToken);
+ ValueTask GetClientTypeAsync([NotNull] TApplication application, CancellationToken cancellationToken);
///
/// Retrieves the consent type associated with an application.
@@ -163,10 +163,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the consent type of the application (by default, "explicit").
///
- Task GetConsentTypeAsync([NotNull] TApplication application, CancellationToken cancellationToken);
+ ValueTask GetConsentTypeAsync([NotNull] TApplication application, CancellationToken cancellationToken);
///
/// Retrieves the display name associated with an application.
@@ -174,10 +174,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the display name associated with the application.
///
- Task GetDisplayNameAsync([NotNull] TApplication application, CancellationToken cancellationToken);
+ ValueTask GetDisplayNameAsync([NotNull] TApplication application, CancellationToken cancellationToken);
///
/// Retrieves the unique identifier associated with an application.
@@ -185,10 +185,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the unique identifier associated with the application.
///
- Task GetIdAsync([NotNull] TApplication application, CancellationToken cancellationToken);
+ ValueTask GetIdAsync([NotNull] TApplication application, CancellationToken cancellationToken);
///
/// Retrieves the permissions associated with an application.
@@ -196,10 +196,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns all the permissions associated with the application.
///
- Task> GetPermissionsAsync([NotNull] TApplication application, CancellationToken cancellationToken);
+ ValueTask> GetPermissionsAsync([NotNull] TApplication application, CancellationToken cancellationToken);
///
/// Retrieves the logout callback addresses associated with an application.
@@ -207,10 +207,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation, whose
- /// result returns all the post_logout_redirect_uri associated with the application.
+ /// A that can be used to monitor the asynchronous operation,
+ /// whose result returns all the post_logout_redirect_uri associated with the application.
///
- Task> GetPostLogoutRedirectUrisAsync([NotNull] TApplication application, CancellationToken cancellationToken);
+ ValueTask> GetPostLogoutRedirectUrisAsync([NotNull] TApplication application, CancellationToken cancellationToken);
///
/// Retrieves the additional properties associated with an application.
@@ -218,10 +218,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation, whose
- /// result returns all the additional properties associated with the application.
+ /// A that can be used to monitor the asynchronous operation,
+ /// whose result returns all the additional properties associated with the application.
///
- Task GetPropertiesAsync([NotNull] TApplication application, CancellationToken cancellationToken);
+ ValueTask GetPropertiesAsync([NotNull] TApplication application, CancellationToken cancellationToken);
///
/// Retrieves the callback addresses associated with an application.
@@ -229,20 +229,20 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns all the redirect_uri associated with the application.
///
- Task> GetRedirectUrisAsync([NotNull] TApplication application, CancellationToken cancellationToken);
+ ValueTask> GetRedirectUrisAsync([NotNull] TApplication application, CancellationToken cancellationToken);
///
/// Instantiates a new application.
///
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation, whose result
- /// returns the instantiated application, that can be persisted in the database.
+ /// A that can be used to monitor the asynchronous operation,
+ /// whose result returns the instantiated application, that can be persisted in the database.
///
- Task InstantiateAsync(CancellationToken cancellationToken);
+ ValueTask InstantiateAsync(CancellationToken cancellationToken);
///
/// Executes the specified query and returns all the corresponding elements.
diff --git a/src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs b/src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs
index 38073448..95dd042d 100644
--- a/src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs
+++ b/src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs
@@ -135,10 +135,10 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the application identifier associated with the authorization.
///
- Task GetApplicationIdAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
+ ValueTask GetApplicationIdAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
///
/// Executes the specified query and returns the first element.
@@ -162,10 +162,10 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the unique identifier associated with the authorization.
///
- Task GetIdAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
+ ValueTask GetIdAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
///
/// Retrieves the additional properties associated with an authorization.
@@ -173,10 +173,10 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation, whose
- /// result returns all the additional properties associated with the authorization.
+ /// A that can be used to monitor the asynchronous operation,
+ /// whose result returns all the additional properties associated with the authorization.
///
- Task GetPropertiesAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
+ ValueTask GetPropertiesAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
///
/// Retrieves the scopes associated with an authorization.
@@ -184,10 +184,10 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the scopes associated with the specified authorization.
///
- Task> GetScopesAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
+ ValueTask> GetScopesAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
///
/// Retrieves the status associated with an authorization.
@@ -195,10 +195,10 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the status associated with the specified authorization.
///
- Task GetStatusAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
+ ValueTask GetStatusAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
///
/// Retrieves the subject associated with an authorization.
@@ -206,10 +206,10 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the subject associated with the specified authorization.
///
- Task GetSubjectAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
+ ValueTask GetSubjectAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
///
/// Retrieves the type associated with an authorization.
@@ -217,20 +217,20 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the type associated with the specified authorization.
///
- Task GetTypeAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
+ ValueTask GetTypeAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
///
/// Instantiates a new authorization.
///
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation, whose result
- /// returns the instantiated authorization, that can be persisted in the database.
+ /// A that can be used to monitor the asynchronous operation,
+ /// whose result returns the instantiated authorization, that can be persisted in the database.
///
- Task InstantiateAsync(CancellationToken cancellationToken);
+ ValueTask InstantiateAsync(CancellationToken cancellationToken);
///
/// Executes the specified query and returns all the corresponding elements.
diff --git a/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs b/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs
index f0f2ade9..996405db 100644
--- a/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs
+++ b/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs
@@ -117,10 +117,10 @@ namespace OpenIddict.Core
/// The scope.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the description associated with the specified scope.
///
- Task GetDescriptionAsync([NotNull] TScope scope, CancellationToken cancellationToken);
+ ValueTask GetDescriptionAsync([NotNull] TScope scope, CancellationToken cancellationToken);
///
/// Retrieves the display name associated with a scope.
@@ -128,10 +128,10 @@ namespace OpenIddict.Core
/// The scope.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the display name associated with the scope.
///
- Task GetDisplayNameAsync([NotNull] TScope scope, CancellationToken cancellationToken);
+ ValueTask GetDisplayNameAsync([NotNull] TScope scope, CancellationToken cancellationToken);
///
/// Retrieves the unique identifier associated with a scope.
@@ -139,10 +139,10 @@ namespace OpenIddict.Core
/// The scope.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the unique identifier associated with the scope.
///
- Task GetIdAsync([NotNull] TScope scope, CancellationToken cancellationToken);
+ ValueTask GetIdAsync([NotNull] TScope scope, CancellationToken cancellationToken);
///
/// Retrieves the name associated with a scope.
@@ -150,10 +150,10 @@ namespace OpenIddict.Core
/// The scope.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the name associated with the specified scope.
///
- Task GetNameAsync([NotNull] TScope scope, CancellationToken cancellationToken);
+ ValueTask GetNameAsync([NotNull] TScope scope, CancellationToken cancellationToken);
///
/// Retrieves the additional properties associated with a scope.
@@ -161,10 +161,10 @@ namespace OpenIddict.Core
/// The scope.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation, whose
+ /// A that can be used to monitor the asynchronous operation, whose
/// result returns all the additional properties associated with the scope.
///
- Task GetPropertiesAsync([NotNull] TScope scope, CancellationToken cancellationToken);
+ ValueTask GetPropertiesAsync([NotNull] TScope scope, CancellationToken cancellationToken);
///
/// Retrieves the resources associated with a scope.
@@ -172,20 +172,20 @@ namespace OpenIddict.Core
/// The scope.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns all the resources associated with the scope.
///
- Task> GetResourcesAsync([NotNull] TScope scope, CancellationToken cancellationToken);
+ ValueTask> GetResourcesAsync([NotNull] TScope scope, CancellationToken cancellationToken);
///
/// Instantiates a new scope.
///
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the instantiated scope, that can be persisted in the database.
///
- Task InstantiateAsync(CancellationToken cancellationToken);
+ ValueTask InstantiateAsync(CancellationToken cancellationToken);
///
/// Executes the specified query and returns all the corresponding elements.
diff --git a/src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs b/src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs
index 57daeb73..59f4cef3 100644
--- a/src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs
+++ b/src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs
@@ -122,10 +122,10 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the application identifier associated with the token.
///
- Task GetApplicationIdAsync([NotNull] TToken token, CancellationToken cancellationToken);
+ ValueTask GetApplicationIdAsync([NotNull] TToken token, CancellationToken cancellationToken);
///
/// Executes the specified query and returns the first element.
@@ -149,10 +149,10 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the authorization identifier associated with the token.
///
- Task GetAuthorizationIdAsync([NotNull] TToken token, CancellationToken cancellationToken);
+ ValueTask GetAuthorizationIdAsync([NotNull] TToken token, CancellationToken cancellationToken);
///
/// Retrieves the creation date associated with a token.
@@ -160,10 +160,10 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the creation date associated with the specified token.
///
- Task GetCreationDateAsync([NotNull] TToken token, CancellationToken cancellationToken);
+ ValueTask GetCreationDateAsync([NotNull] TToken token, CancellationToken cancellationToken);
///
/// Retrieves the expiration date associated with a token.
@@ -171,10 +171,10 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the expiration date associated with the specified token.
///
- Task GetExpirationDateAsync([NotNull] TToken token, CancellationToken cancellationToken);
+ ValueTask GetExpirationDateAsync([NotNull] TToken token, CancellationToken cancellationToken);
///
/// Retrieves the unique identifier associated with a token.
@@ -182,10 +182,10 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the unique identifier associated with the token.
///
- Task GetIdAsync([NotNull] TToken token, CancellationToken cancellationToken);
+ ValueTask GetIdAsync([NotNull] TToken token, CancellationToken cancellationToken);
///
/// Retrieves the payload associated with a token.
@@ -193,10 +193,10 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the payload associated with the specified token.
///
- Task GetPayloadAsync([NotNull] TToken token, CancellationToken cancellationToken);
+ ValueTask GetPayloadAsync([NotNull] TToken token, CancellationToken cancellationToken);
///
/// Retrieves the additional properties associated with a token.
@@ -204,10 +204,10 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation, whose
- /// result returns all the additional properties associated with the token.
+ /// A that can be used to monitor the asynchronous operation,
+ /// whose result returns all the additional properties associated with the token.
///
- Task GetPropertiesAsync([NotNull] TToken token, CancellationToken cancellationToken);
+ ValueTask GetPropertiesAsync([NotNull] TToken token, CancellationToken cancellationToken);
///
/// Retrieves the reference identifier associated with a token.
@@ -217,10 +217,10 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the reference identifier associated with the specified token.
///
- Task GetReferenceIdAsync([NotNull] TToken token, CancellationToken cancellationToken);
+ ValueTask GetReferenceIdAsync([NotNull] TToken token, CancellationToken cancellationToken);
///
/// Retrieves the status associated with a token.
@@ -228,10 +228,10 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the status associated with the specified token.
///
- Task GetStatusAsync([NotNull] TToken token, CancellationToken cancellationToken);
+ ValueTask GetStatusAsync([NotNull] TToken token, CancellationToken cancellationToken);
///
/// Retrieves the subject associated with a token.
@@ -239,10 +239,10 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the subject associated with the specified token.
///
- Task GetSubjectAsync([NotNull] TToken token, CancellationToken cancellationToken);
+ ValueTask GetSubjectAsync([NotNull] TToken token, CancellationToken cancellationToken);
///
/// Retrieves the token type associated with a token.
@@ -250,20 +250,20 @@ namespace OpenIddict.Core
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the token type associated with the specified token.
///
- Task GetTokenTypeAsync([NotNull] TToken token, CancellationToken cancellationToken);
+ ValueTask GetTokenTypeAsync([NotNull] TToken token, CancellationToken cancellationToken);
///
/// Instantiates a new token.
///
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the instantiated token, that can be persisted in the database.
///
- Task InstantiateAsync(CancellationToken cancellationToken);
+ ValueTask InstantiateAsync(CancellationToken cancellationToken);
///
/// Executes the specified query and returns all the corresponding elements.
diff --git a/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs b/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs
index dabc46e4..9b6a88a1 100644
--- a/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs
+++ b/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs
@@ -254,17 +254,17 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the client identifier associated with the application.
///
- public virtual Task GetClientIdAsync([NotNull] TApplication application, CancellationToken cancellationToken)
+ public virtual ValueTask GetClientIdAsync([NotNull] TApplication application, CancellationToken cancellationToken)
{
if (application == null)
{
throw new ArgumentNullException(nameof(application));
}
- return Task.FromResult(application.ClientId);
+ return new ValueTask(application.ClientId);
}
///
@@ -275,17 +275,17 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the client secret associated with the application.
///
- public virtual Task GetClientSecretAsync([NotNull] TApplication application, CancellationToken cancellationToken)
+ public virtual ValueTask GetClientSecretAsync([NotNull] TApplication application, CancellationToken cancellationToken)
{
if (application == null)
{
throw new ArgumentNullException(nameof(application));
}
- return Task.FromResult(application.ClientSecret);
+ return new ValueTask(application.ClientSecret);
}
///
@@ -294,17 +294,17 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the client type of the application (by default, "public").
///
- public virtual Task GetClientTypeAsync([NotNull] TApplication application, CancellationToken cancellationToken)
+ public virtual ValueTask GetClientTypeAsync([NotNull] TApplication application, CancellationToken cancellationToken)
{
if (application == null)
{
throw new ArgumentNullException(nameof(application));
}
- return Task.FromResult(application.Type);
+ return new ValueTask(application.Type);
}
///
@@ -313,17 +313,17 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the consent type of the application (by default, "explicit").
///
- public virtual Task GetConsentTypeAsync([NotNull] TApplication application, CancellationToken cancellationToken)
+ public virtual ValueTask GetConsentTypeAsync([NotNull] TApplication application, CancellationToken cancellationToken)
{
if (application == null)
{
throw new ArgumentNullException(nameof(application));
}
- return Task.FromResult(application.ConsentType);
+ return new ValueTask(application.ConsentType);
}
///
@@ -332,17 +332,17 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the display name associated with the application.
///
- public virtual Task GetDisplayNameAsync([NotNull] TApplication application, CancellationToken cancellationToken)
+ public virtual ValueTask GetDisplayNameAsync([NotNull] TApplication application, CancellationToken cancellationToken)
{
if (application == null)
{
throw new ArgumentNullException(nameof(application));
}
- return Task.FromResult(application.DisplayName);
+ return new ValueTask(application.DisplayName);
}
///
@@ -351,17 +351,17 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the unique identifier associated with the application.
///
- public virtual Task GetIdAsync([NotNull] TApplication application, CancellationToken cancellationToken)
+ public virtual ValueTask GetIdAsync([NotNull] TApplication application, CancellationToken cancellationToken)
{
if (application == null)
{
throw new ArgumentNullException(nameof(application));
}
- return Task.FromResult(ConvertIdentifierToString(application.Id));
+ return new ValueTask(ConvertIdentifierToString(application.Id));
}
///
@@ -370,10 +370,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns all the permissions associated with the application.
///
- public virtual Task> GetPermissionsAsync([NotNull] TApplication application, CancellationToken cancellationToken)
+ public virtual ValueTask> GetPermissionsAsync([NotNull] TApplication application, CancellationToken cancellationToken)
{
if (application == null)
{
@@ -382,7 +382,7 @@ namespace OpenIddict.Core
if (string.IsNullOrEmpty(application.Permissions))
{
- return Task.FromResult(ImmutableArray.Create());
+ return new ValueTask>(ImmutableArray.Create());
}
// Note: parsing the stringified permissions is an expensive operation.
@@ -397,7 +397,7 @@ namespace OpenIddict.Core
.ToImmutableArray());
}
- return Task.FromResult(permissions.GetValueOrDefault());
+ return new ValueTask>(permissions.GetValueOrDefault());
}
///
@@ -406,10 +406,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation, whose
- /// result returns all the post_logout_redirect_uri associated with the application.
+ /// A that can be used to monitor the asynchronous operation,
+ /// whose result returns all the post_logout_redirect_uri associated with the application.
///
- public virtual Task> GetPostLogoutRedirectUrisAsync([NotNull] TApplication application, CancellationToken cancellationToken)
+ public virtual ValueTask> GetPostLogoutRedirectUrisAsync([NotNull] TApplication application, CancellationToken cancellationToken)
{
if (application == null)
{
@@ -418,7 +418,7 @@ namespace OpenIddict.Core
if (string.IsNullOrEmpty(application.PostLogoutRedirectUris))
{
- return Task.FromResult(ImmutableArray.Create());
+ return new ValueTask>(ImmutableArray.Create());
}
// Note: parsing the stringified addresses is an expensive operation.
@@ -433,7 +433,7 @@ namespace OpenIddict.Core
.ToImmutableArray());
}
- return Task.FromResult(addresses.GetValueOrDefault());
+ return new ValueTask>(addresses.GetValueOrDefault());
}
///
@@ -442,10 +442,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation, whose
- /// result returns all the additional properties associated with the application.
+ /// A that can be used to monitor the asynchronous operation,
+ /// whose result returns all the additional properties associated with the application.
///
- public virtual Task GetPropertiesAsync([NotNull] TApplication application, CancellationToken cancellationToken)
+ public virtual ValueTask GetPropertiesAsync([NotNull] TApplication application, CancellationToken cancellationToken)
{
if (application == null)
{
@@ -454,10 +454,10 @@ namespace OpenIddict.Core
if (string.IsNullOrEmpty(application.Properties))
{
- return Task.FromResult(new JObject());
+ return new ValueTask(new JObject());
}
- return Task.FromResult(JObject.Parse(application.Properties));
+ return new ValueTask(JObject.Parse(application.Properties));
}
///
@@ -466,10 +466,10 @@ namespace OpenIddict.Core
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns all the redirect_uri associated with the application.
///
- public virtual Task> GetRedirectUrisAsync([NotNull] TApplication application, CancellationToken cancellationToken)
+ public virtual ValueTask> GetRedirectUrisAsync([NotNull] TApplication application, CancellationToken cancellationToken)
{
if (application == null)
{
@@ -478,7 +478,7 @@ namespace OpenIddict.Core
if (string.IsNullOrEmpty(application.RedirectUris))
{
- return Task.FromResult(ImmutableArray.Create());
+ return new ValueTask>(ImmutableArray.Create());
}
// Note: parsing the stringified addresses is an expensive operation.
@@ -493,7 +493,7 @@ namespace OpenIddict.Core
.ToImmutableArray());
}
- return Task.FromResult(addresses.GetValueOrDefault());
+ return new ValueTask>(addresses.GetValueOrDefault());
}
///
@@ -501,10 +501,11 @@ namespace OpenIddict.Core
///
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation, whose result
- /// returns the instantiated application, that can be persisted in the database.
+ /// A that can be used to monitor the asynchronous operation,
+ /// whose result returns the instantiated application, that can be persisted in the database.
///
- public virtual Task InstantiateAsync(CancellationToken cancellationToken) => Task.FromResult(new TApplication());
+ public virtual ValueTask InstantiateAsync(CancellationToken cancellationToken)
+ => new ValueTask(new TApplication());
///
/// Executes the specified query and returns all the corresponding elements.
diff --git a/src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs b/src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs
index 0a846ce0..97dcc6cd 100644
--- a/src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs
+++ b/src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs
@@ -278,10 +278,10 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the application identifier associated with the authorization.
///
- public virtual async Task GetApplicationIdAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken)
+ public virtual async ValueTask GetApplicationIdAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken)
{
if (authorization == null)
{
@@ -325,17 +325,17 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the unique identifier associated with the authorization.
///
- public virtual Task GetIdAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken)
+ public virtual ValueTask GetIdAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken)
{
if (authorization == null)
{
throw new ArgumentNullException(nameof(authorization));
}
- return Task.FromResult(ConvertIdentifierToString(authorization.Id));
+ return new ValueTask(ConvertIdentifierToString(authorization.Id));
}
///
@@ -344,10 +344,10 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation, whose
- /// result returns all the additional properties associated with the authorization.
+ /// A that can be used to monitor the asynchronous operation,
+ /// whose result returns all the additional properties associated with the authorization.
///
- public virtual Task GetPropertiesAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken)
+ public virtual ValueTask GetPropertiesAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken)
{
if (authorization == null)
{
@@ -356,10 +356,10 @@ namespace OpenIddict.Core
if (string.IsNullOrEmpty(authorization.Properties))
{
- return Task.FromResult(new JObject());
+ return new ValueTask(new JObject());
}
- return Task.FromResult(JObject.Parse(authorization.Properties));
+ return new ValueTask(JObject.Parse(authorization.Properties));
}
///
@@ -368,10 +368,10 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the scopes associated with the specified authorization.
///
- public virtual Task> GetScopesAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken)
+ public virtual ValueTask> GetScopesAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken)
{
if (authorization == null)
{
@@ -380,10 +380,10 @@ namespace OpenIddict.Core
if (string.IsNullOrEmpty(authorization.Scopes))
{
- return Task.FromResult(ImmutableArray.Create());
+ return new ValueTask>(ImmutableArray.Create());
}
- return Task.FromResult(JArray.Parse(authorization.Scopes).Select(element => (string) element).ToImmutableArray());
+ return new ValueTask>(JArray.Parse(authorization.Scopes).Select(element => (string) element).ToImmutableArray());
}
///
@@ -392,12 +392,17 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the status associated with the specified authorization.
///
- public virtual Task GetStatusAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken)
+ public virtual ValueTask GetStatusAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken)
{
- return Task.FromResult(authorization.Status);
+ if (authorization == null)
+ {
+ throw new ArgumentNullException(nameof(authorization));
+ }
+
+ return new ValueTask(authorization.Status);
}
///
@@ -406,17 +411,17 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the subject associated with the specified authorization.
///
- public virtual Task GetSubjectAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken)
+ public virtual ValueTask GetSubjectAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken)
{
if (authorization == null)
{
throw new ArgumentNullException(nameof(authorization));
}
- return Task.FromResult(authorization.Subject);
+ return new ValueTask(authorization.Subject);
}
///
@@ -425,17 +430,17 @@ namespace OpenIddict.Core
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the type associated with the specified authorization.
///
- public virtual Task GetTypeAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken)
+ public virtual ValueTask GetTypeAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken)
{
if (authorization == null)
{
throw new ArgumentNullException(nameof(authorization));
}
- return Task.FromResult(authorization.Type);
+ return new ValueTask(authorization.Type);
}
///
@@ -443,10 +448,11 @@ namespace OpenIddict.Core
///
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation, whose result
- /// returns the instantiated authorization, that can be persisted in the database.
+ /// A that can be used to monitor the asynchronous operation,
+ /// whose result returns the instantiated authorization, that can be persisted in the database.
///
- public virtual Task InstantiateAsync(CancellationToken cancellationToken) => Task.FromResult(new TAuthorization());
+ public virtual ValueTask InstantiateAsync(CancellationToken cancellationToken)
+ => new ValueTask(new TAuthorization());
///
/// Executes the specified query and returns all the corresponding elements.
diff --git a/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs b/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs
index 5bd08b87..b7686484 100644
--- a/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs
+++ b/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs
@@ -183,17 +183,17 @@ namespace OpenIddict.Core
/// The scope.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the description associated with the specified scope.
///
- public virtual Task GetDescriptionAsync([NotNull] TScope scope, CancellationToken cancellationToken)
+ public virtual ValueTask GetDescriptionAsync([NotNull] TScope scope, CancellationToken cancellationToken)
{
if (scope == null)
{
throw new ArgumentNullException(nameof(scope));
}
- return Task.FromResult(scope.Description);
+ return new ValueTask