diff --git a/src/OpenIddict.Core/Descriptors/OpenIddictScopeDescriptor.cs b/src/OpenIddict.Core/Descriptors/OpenIddictScopeDescriptor.cs
index 82f4418d..01b41d12 100644
--- a/src/OpenIddict.Core/Descriptors/OpenIddictScopeDescriptor.cs
+++ b/src/OpenIddict.Core/Descriptors/OpenIddictScopeDescriptor.cs
@@ -14,6 +14,12 @@ namespace OpenIddict.Core
///
public virtual string Description { get; set; }
+ ///
+ /// Gets or sets the display name
+ /// associated with the scope.
+ ///
+ public virtual string DisplayName { get; set; }
+
///
/// Gets or sets the unique name
/// associated with the scope.
diff --git a/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs b/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs
index ca3b536d..bd3659e2 100644
--- a/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs
+++ b/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs
@@ -261,6 +261,25 @@ namespace OpenIddict.Core
return Store.GetDescriptionAsync(scope, cancellationToken);
}
+ ///
+ /// Retrieves the display name 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 the display name associated with the scope.
+ ///
+ public virtual Task GetDisplayNameAsync([NotNull] TScope scope, CancellationToken cancellationToken = default)
+ {
+ if (scope == null)
+ {
+ throw new ArgumentNullException(nameof(scope));
+ }
+
+ return Store.GetDisplayNameAsync(scope, cancellationToken);
+ }
+
///
/// Retrieves the unique identifier associated with a scope.
///
@@ -452,6 +471,7 @@ namespace OpenIddict.Core
var descriptor = new OpenIddictScopeDescriptor
{
Description = await Store.GetDescriptionAsync(scope, cancellationToken),
+ DisplayName = await Store.GetDisplayNameAsync(scope, cancellationToken),
Name = await Store.GetNameAsync(scope, cancellationToken)
};
@@ -512,6 +532,7 @@ namespace OpenIddict.Core
}
await Store.SetDescriptionAsync(scope, descriptor.Description, cancellationToken);
+ await Store.SetDisplayNameAsync(scope, descriptor.DisplayName, cancellationToken);
await Store.SetNameAsync(scope, descriptor.Name, cancellationToken);
await Store.SetResourcesAsync(scope, descriptor.Resources.ToImmutableArray(), cancellationToken);
}
diff --git a/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs b/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs
index 69b662ab..f0f2ade9 100644
--- a/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs
+++ b/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs
@@ -122,6 +122,17 @@ namespace OpenIddict.Core
///
Task GetDescriptionAsync([NotNull] TScope scope, CancellationToken cancellationToken);
+ ///
+ /// Retrieves the display name 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 the display name associated with the scope.
+ ///
+ Task GetDisplayNameAsync([NotNull] TScope scope, CancellationToken cancellationToken);
+
///
/// Retrieves the unique identifier associated with a scope.
///
@@ -215,6 +226,17 @@ namespace OpenIddict.Core
///
Task SetDescriptionAsync([NotNull] TScope scope, [CanBeNull] string description, CancellationToken cancellationToken);
+ ///
+ /// Sets the display name associated with a scope.
+ ///
+ /// The scope.
+ /// The display name associated with the scope.
+ /// The that can be used to abort the operation.
+ ///
+ /// A that can be used to monitor the asynchronous operation.
+ ///
+ Task SetDisplayNameAsync([NotNull] TScope scope, [CanBeNull] string name, CancellationToken cancellationToken);
+
///
/// Sets the name associated with a scope.
///
diff --git a/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs b/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs
index 86f4f3b5..290d3e78 100644
--- a/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs
+++ b/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs
@@ -197,6 +197,25 @@ namespace OpenIddict.Core
return Task.FromResult(scope.Description);
}
+ ///
+ /// Retrieves the display name 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 the display name associated with the scope.
+ ///
+ public virtual Task GetDisplayNameAsync([NotNull] TScope scope, CancellationToken cancellationToken)
+ {
+ if (scope == null)
+ {
+ throw new ArgumentNullException(nameof(scope));
+ }
+
+ return Task.FromResult(scope.DisplayName);
+ }
+
///
/// Retrieves the unique identifier associated with a scope.
///
@@ -376,6 +395,27 @@ namespace OpenIddict.Core
return Task.FromResult(0);
}
+ ///
+ /// Sets the display name associated with a scope.
+ ///
+ /// The scope.
+ /// The display name 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 SetDisplayNameAsync([NotNull] TScope scope, [CanBeNull] string name, CancellationToken cancellationToken)
+ {
+ if (scope == null)
+ {
+ throw new ArgumentNullException(nameof(scope));
+ }
+
+ scope.DisplayName = name;
+
+ return Task.FromResult(0);
+ }
+
///
/// Sets the name associated with a scope.
///
diff --git a/src/OpenIddict.Models/OpenIddictScope.cs b/src/OpenIddict.Models/OpenIddictScope.cs
index 3d07847a..c02b52ae 100644
--- a/src/OpenIddict.Models/OpenIddictScope.cs
+++ b/src/OpenIddict.Models/OpenIddictScope.cs
@@ -36,6 +36,12 @@ namespace OpenIddict.Models
///
public virtual string Description { get; set; }
+ ///
+ /// Gets or sets the display name
+ /// associated with the current scope.
+ ///
+ public virtual string DisplayName { get; set; }
+
///
/// Gets or sets the unique identifier
/// associated with the current scope.