diff --git a/build/dependencies.props b/build/dependencies.props
index 93e8fdcf..b87a62b3 100644
--- a/build/dependencies.props
+++ b/build/dependencies.props
@@ -8,6 +8,7 @@
3.0.0
6.1.3
10.3.0
+ 10.0.2
1.0.1
1.4.0
4.7.63
diff --git a/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs b/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs
index 91282f10..6e04c765 100644
--- a/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs
+++ b/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs
@@ -389,62 +389,62 @@ namespace OpenIddict.Core
}
///
- /// Retrieves the reference identifier associated with a token.
- /// Note: depending on the manager used to create the token,
- /// the reference identifier may be hashed for security reasons.
+ /// Retrieves the unique identifier 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 reference identifier associated with the specified token.
+ /// whose result returns the unique identifier associated with the token.
///
- public virtual Task GetReferenceIdAsync([NotNull] TToken token, CancellationToken cancellationToken)
+ public virtual Task GetIdAsync([NotNull] TToken token, CancellationToken cancellationToken)
{
if (token == null)
{
throw new ArgumentNullException(nameof(token));
}
- return Store.GetReferenceIdAsync(token, cancellationToken);
+ return Store.GetIdAsync(token, cancellationToken);
}
///
- /// Retrieves the unique identifier associated with a token.
+ /// Retrieves the payload 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 unique identifier associated with the token.
+ /// whose result returns the payload associated with the specified token.
///
- public virtual Task GetIdAsync([NotNull] TToken token, CancellationToken cancellationToken)
+ public virtual Task GetPayloadAsync([NotNull] TToken token, CancellationToken cancellationToken)
{
if (token == null)
{
throw new ArgumentNullException(nameof(token));
}
- return Store.GetIdAsync(token, cancellationToken);
+ return Store.GetPayloadAsync(token, cancellationToken);
}
///
- /// Retrieves the payload associated with a token.
+ /// Retrieves the reference identifier associated with a token.
+ /// Note: depending on the manager used to create the token,
+ /// the reference identifier may be hashed for security reasons.
///
/// 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 payload associated with the specified token.
+ /// whose result returns the reference identifier associated with the specified token.
///
- public virtual Task GetPayloadAsync([NotNull] TToken token, CancellationToken cancellationToken)
+ public virtual Task GetReferenceIdAsync([NotNull] TToken token, CancellationToken cancellationToken)
{
if (token == null)
{
throw new ArgumentNullException(nameof(token));
}
- return Store.GetPayloadAsync(token, cancellationToken);
+ return Store.GetReferenceIdAsync(token, cancellationToken);
}
///
diff --git a/src/OpenIddict.Core/OpenIddict.Core.csproj b/src/OpenIddict.Core/OpenIddict.Core.csproj
index c5668db7..0731da1c 100644
--- a/src/OpenIddict.Core/OpenIddict.Core.csproj
+++ b/src/OpenIddict.Core/OpenIddict.Core.csproj
@@ -22,6 +22,7 @@
+
diff --git a/src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs b/src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs
index 78a99c69..f9dd5470 100644
--- a/src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs
+++ b/src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs
@@ -10,6 +10,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;
+using Newtonsoft.Json.Linq;
namespace OpenIddict.Core
{
@@ -189,6 +190,17 @@ namespace OpenIddict.Core
///
Task> GetPostLogoutRedirectUrisAsync([NotNull] TApplication application, CancellationToken cancellationToken);
+ ///
+ /// Retrieves the additional properties associated with an application.
+ ///
+ /// 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.
+ ///
+ Task GetPropertiesAsync([NotNull] TApplication application, CancellationToken cancellationToken);
+
///
/// Retrieves the callback addresses associated with an application.
///
@@ -296,6 +308,17 @@ namespace OpenIddict.Core
Task SetPostLogoutRedirectUrisAsync([NotNull] TApplication application,
ImmutableArray addresses, CancellationToken cancellationToken);
+ ///
+ /// Sets the additional properties associated with an application.
+ ///
+ /// The application.
+ /// The additional properties associated with the application.
+ /// The that can be used to abort the operation.
+ ///
+ /// A that can be used to monitor the asynchronous operation.
+ ///
+ Task SetPropertiesAsync([NotNull] TApplication application, [CanBeNull] JObject properties, CancellationToken cancellationToken);
+
///
/// Sets the callback addresses associated with an application.
///
diff --git a/src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs b/src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs
index 44058868..639b62c1 100644
--- a/src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs
+++ b/src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs
@@ -10,6 +10,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;
+using Newtonsoft.Json.Linq;
namespace OpenIddict.Core
{
@@ -123,6 +124,17 @@ namespace OpenIddict.Core
///
Task GetIdAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
+ ///
+ /// Retrieves the additional properties 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 all the additional properties associated with the authorization.
+ ///
+ Task GetPropertiesAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
+
///
/// Retrieves the scopes associated with an authorization.
///
@@ -230,6 +242,17 @@ namespace OpenIddict.Core
Task SetApplicationIdAsync([NotNull] TAuthorization authorization,
[CanBeNull] string identifier, CancellationToken cancellationToken);
+ ///
+ /// Sets the additional properties associated with an authorization.
+ ///
+ /// The authorization.
+ /// The additional properties associated with the authorization.
+ /// The that can be used to abort the operation.
+ ///
+ /// A that can be used to monitor the asynchronous operation.
+ ///
+ Task SetPropertiesAsync([NotNull] TAuthorization authorization, [CanBeNull] JObject properties, CancellationToken cancellationToken);
+
///
/// Sets the scopes associated with an authorization.
///
diff --git a/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs b/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs
index 9b603639..e061433d 100644
--- a/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs
+++ b/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs
@@ -10,6 +10,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;
+using Newtonsoft.Json.Linq;
namespace OpenIddict.Core
{
@@ -121,6 +122,17 @@ namespace OpenIddict.Core
///
Task GetNameAsync([NotNull] TScope scope, CancellationToken cancellationToken);
+ ///
+ /// Retrieves the additional properties associated with a scope.
+ ///
+ /// The scope.
+ /// 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 scope.
+ ///
+ Task GetPropertiesAsync([NotNull] TScope scope, CancellationToken cancellationToken);
+
///
/// Instantiates a new scope.
///
@@ -181,6 +193,17 @@ namespace OpenIddict.Core
///
Task SetNameAsync([NotNull] TScope scope, [CanBeNull] string name, CancellationToken cancellationToken);
+ ///
+ /// Sets the additional properties associated with a scope.
+ ///
+ /// The scope.
+ /// The additional properties associated with the scope.
+ /// The that can be used to abort the operation.
+ ///
+ /// A that can be used to monitor the asynchronous operation.
+ ///
+ Task SetPropertiesAsync([NotNull] TScope scope, [CanBeNull] JObject properties, CancellationToken cancellationToken);
+
///
/// Updates an existing scope.
///
diff --git a/src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs b/src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs
index 566b78ad..4c1581bd 100644
--- a/src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs
+++ b/src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs
@@ -10,6 +10,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;
+using Newtonsoft.Json.Linq;
namespace OpenIddict.Core
{
@@ -197,6 +198,17 @@ namespace OpenIddict.Core
///
Task GetPayloadAsync([NotNull] TToken token, CancellationToken cancellationToken);
+ ///
+ /// Retrieves the additional properties 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 all the additional properties associated with the token.
+ ///
+ Task GetPropertiesAsync([NotNull] TToken token, CancellationToken cancellationToken);
+
///
/// Retrieves the reference identifier associated with a token.
/// Note: depending on the manager used to create the token,
@@ -349,6 +361,17 @@ namespace OpenIddict.Core
///
Task SetPayloadAsync([NotNull] TToken token, [CanBeNull] string payload, CancellationToken cancellationToken);
+ ///
+ /// Sets the additional properties associated with a token.
+ ///
+ /// The token.
+ /// The additional properties associated with the token.
+ /// The that can be used to abort the operation.
+ ///
+ /// A that can be used to monitor the asynchronous operation.
+ ///
+ Task SetPropertiesAsync([NotNull] TToken token, [CanBeNull] JObject properties, CancellationToken cancellationToken);
+
///
/// Sets the reference identifier associated with a token.
/// Note: depending on the manager used to create the token,
diff --git a/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs b/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs
index ce4f50e9..620e0d1a 100644
--- a/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs
+++ b/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs
@@ -11,6 +11,8 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using OpenIddict.Models;
namespace OpenIddict.Core
@@ -381,6 +383,30 @@ namespace OpenIddict.Core
return Task.FromResult(ImmutableArray.Create(uris));
}
+ ///
+ /// Retrieves the additional properties associated with an application.
+ ///
+ /// 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.
+ ///
+ public virtual Task GetPropertiesAsync([NotNull] TApplication application, CancellationToken cancellationToken)
+ {
+ if (application == null)
+ {
+ throw new ArgumentNullException(nameof(application));
+ }
+
+ if (string.IsNullOrEmpty(application.Properties))
+ {
+ return Task.FromResult(new JObject());
+ }
+
+ return Task.FromResult(JObject.Parse(application.Properties));
+ }
+
///
/// Retrieves the callback addresses associated with an application.
///
@@ -596,6 +622,34 @@ namespace OpenIddict.Core
return Task.CompletedTask;
}
+ ///
+ /// Sets the additional properties associated with an application.
+ ///
+ /// The application.
+ /// The additional properties associated with the application.
+ /// The that can be used to abort the operation.
+ ///
+ /// A that can be used to monitor the asynchronous operation.
+ ///
+ public virtual Task SetPropertiesAsync([NotNull] TApplication application, [CanBeNull] JObject properties, CancellationToken cancellationToken)
+ {
+ if (application == null)
+ {
+ throw new ArgumentNullException(nameof(application));
+ }
+
+ if (properties == null)
+ {
+ application.Properties = null;
+
+ return Task.CompletedTask;
+ }
+
+ application.Properties = properties.ToString(Formatting.None);
+
+ return Task.CompletedTask;
+ }
+
///
/// Sets the callback addresses associated with an application.
///
diff --git a/src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs b/src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs
index a3b7d98a..da5493fd 100644
--- a/src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs
+++ b/src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs
@@ -11,6 +11,8 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using OpenIddict.Models;
namespace OpenIddict.Core
@@ -199,6 +201,30 @@ namespace OpenIddict.Core
return Task.FromResult(ConvertIdentifierToString(authorization.Id));
}
+ ///
+ /// Retrieves the additional properties 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 all the additional properties associated with the authorization.
+ ///
+ public virtual Task GetPropertiesAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken)
+ {
+ if (authorization == null)
+ {
+ throw new ArgumentNullException(nameof(authorization));
+ }
+
+ if (string.IsNullOrEmpty(authorization.Properties))
+ {
+ return Task.FromResult(new JObject());
+ }
+
+ return Task.FromResult(JObject.Parse(authorization.Properties));
+ }
+
///
/// Retrieves the scopes associated with an authorization.
///
@@ -387,6 +413,34 @@ namespace OpenIddict.Core
public abstract Task SetApplicationIdAsync([NotNull] TAuthorization authorization,
[CanBeNull] string identifier, CancellationToken cancellationToken);
+ ///
+ /// Sets the additional properties associated with an authorization.
+ ///
+ /// The authorization.
+ /// The additional properties associated with the authorization.
+ /// The that can be used to abort the operation.
+ ///
+ /// A that can be used to monitor the asynchronous operation.
+ ///
+ public virtual Task SetPropertiesAsync([NotNull] TAuthorization authorization, [CanBeNull] JObject properties, CancellationToken cancellationToken)
+ {
+ if (authorization == null)
+ {
+ throw new ArgumentNullException(nameof(authorization));
+ }
+
+ if (properties == null)
+ {
+ authorization.Properties = null;
+
+ return Task.CompletedTask;
+ }
+
+ authorization.Properties = properties.ToString(Formatting.None);
+
+ return Task.CompletedTask;
+ }
+
///
/// Sets the scopes associated with an authorization.
///
diff --git a/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs b/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs
index 7cb7dd6a..a9aa4652 100644
--- a/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs
+++ b/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs
@@ -11,6 +11,8 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using OpenIddict.Models;
namespace OpenIddict.Core
@@ -167,6 +169,30 @@ namespace OpenIddict.Core
return Task.FromResult(scope.Name);
}
+ ///
+ /// Retrieves the additional properties associated with a scope.
+ ///
+ /// The scope.
+ /// 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 scope.
+ ///
+ public virtual Task GetPropertiesAsync([NotNull] TScope scope, CancellationToken cancellationToken)
+ {
+ if (scope == null)
+ {
+ throw new ArgumentNullException(nameof(scope));
+ }
+
+ if (string.IsNullOrEmpty(scope.Properties))
+ {
+ return Task.FromResult(new JObject());
+ }
+
+ return Task.FromResult(JObject.Parse(scope.Properties));
+ }
+
///
/// Instantiates a new scope.
///
@@ -267,6 +293,34 @@ namespace OpenIddict.Core
return Task.CompletedTask;
}
+ ///
+ /// Sets the additional properties associated with a scope.
+ ///
+ /// The scope.
+ /// The additional properties associated with the scope.
+ /// The that can be used to abort the operation.
+ ///
+ /// A that can be used to monitor the asynchronous operation.
+ ///
+ public virtual Task SetPropertiesAsync([NotNull] TScope scope, [CanBeNull] JObject properties, CancellationToken cancellationToken)
+ {
+ if (scope == null)
+ {
+ throw new ArgumentNullException(nameof(scope));
+ }
+
+ if (properties == null)
+ {
+ scope.Properties = null;
+
+ return Task.CompletedTask;
+ }
+
+ scope.Properties = properties.ToString(Formatting.None);
+
+ return Task.CompletedTask;
+ }
+
///
/// Updates an existing scope.
///
diff --git a/src/OpenIddict.Core/Stores/OpenIddictTokenStore.cs b/src/OpenIddict.Core/Stores/OpenIddictTokenStore.cs
index dffd034e..39419e13 100644
--- a/src/OpenIddict.Core/Stores/OpenIddictTokenStore.cs
+++ b/src/OpenIddict.Core/Stores/OpenIddictTokenStore.cs
@@ -11,6 +11,8 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using OpenIddict.Models;
namespace OpenIddict.Core
@@ -347,6 +349,30 @@ namespace OpenIddict.Core
return Task.FromResult(token.Payload);
}
+ ///
+ /// Retrieves the additional properties 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 all the additional properties associated with the token.
+ ///
+ public virtual Task GetPropertiesAsync([NotNull] TToken token, CancellationToken cancellationToken)
+ {
+ if (token == null)
+ {
+ throw new ArgumentNullException(nameof(token));
+ }
+
+ if (string.IsNullOrEmpty(token.Properties))
+ {
+ return Task.FromResult(new JObject());
+ }
+
+ return Task.FromResult(JObject.Parse(token.Properties));
+ }
+
///
/// Retrieves the reference identifier associated with a token.
/// Note: depending on the manager used to create the token,
@@ -607,6 +633,34 @@ namespace OpenIddict.Core
return Task.CompletedTask;
}
+ ///
+ /// Sets the additional properties associated with a token.
+ ///
+ /// The token.
+ /// The additional properties associated with the token.
+ /// The that can be used to abort the operation.
+ ///
+ /// A that can be used to monitor the asynchronous operation.
+ ///
+ public virtual Task SetPropertiesAsync([NotNull] TToken token, [CanBeNull] JObject properties, CancellationToken cancellationToken)
+ {
+ if (token == null)
+ {
+ throw new ArgumentNullException(nameof(token));
+ }
+
+ if (properties == null)
+ {
+ token.Properties = null;
+
+ return Task.CompletedTask;
+ }
+
+ token.Properties = properties.ToString(Formatting.None);
+
+ return Task.CompletedTask;
+ }
+
///
/// Sets the reference identifier associated with a token.
/// Note: depending on the manager used to create the token,
diff --git a/src/OpenIddict.Models/OpenIddictApplication.cs b/src/OpenIddict.Models/OpenIddictApplication.cs
index e82ef837..f198b7e8 100644
--- a/src/OpenIddict.Models/OpenIddictApplication.cs
+++ b/src/OpenIddict.Models/OpenIddictApplication.cs
@@ -75,6 +75,12 @@ namespace OpenIddict.Models
///
public virtual string PostLogoutRedirectUris { get; set; }
+ ///
+ /// Gets or sets the additional properties serialized as a JSON object,
+ /// or null if no bag was associated with the current application.
+ ///
+ public virtual string Properties { get; set; }
+
///
/// Gets or sets the callback URLs
/// associated with the current application,
diff --git a/src/OpenIddict.Models/OpenIddictAuthorization.cs b/src/OpenIddict.Models/OpenIddictAuthorization.cs
index cd4eaca8..273b43a1 100644
--- a/src/OpenIddict.Models/OpenIddictAuthorization.cs
+++ b/src/OpenIddict.Models/OpenIddictAuthorization.cs
@@ -49,6 +49,12 @@ namespace OpenIddict.Models
///
public virtual TKey Id { get; set; }
+ ///
+ /// Gets or sets the additional properties serialized as a JSON object,
+ /// or null if no bag was associated with the current authorization.
+ ///
+ public virtual string Properties { get; set; }
+
///
/// Gets or sets the space-delimited scopes
/// associated with the current authorization.
diff --git a/src/OpenIddict.Models/OpenIddictScope.cs b/src/OpenIddict.Models/OpenIddictScope.cs
index 28e796e2..2b726c31 100644
--- a/src/OpenIddict.Models/OpenIddictScope.cs
+++ b/src/OpenIddict.Models/OpenIddictScope.cs
@@ -47,5 +47,11 @@ namespace OpenIddict.Models
/// associated with the current scope.
///
public virtual string Name { get; set; }
+
+ ///
+ /// Gets or sets the additional properties serialized as a JSON object,
+ /// or null if no bag was associated with the current scope.
+ ///
+ public virtual string Properties { get; set; }
}
}
diff --git a/src/OpenIddict.Models/OpenIddictToken.cs b/src/OpenIddict.Models/OpenIddictToken.cs
index ce10c1fc..0242874b 100644
--- a/src/OpenIddict.Models/OpenIddictToken.cs
+++ b/src/OpenIddict.Models/OpenIddictToken.cs
@@ -73,6 +73,12 @@ namespace OpenIddict.Models
///
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.