diff --git a/src/IdentityServer/Constants.cs b/src/IdentityServer/Constants.cs index 74f84a85f..8e0e16cb1 100644 --- a/src/IdentityServer/Constants.cs +++ b/src/IdentityServer/Constants.cs @@ -115,7 +115,21 @@ public static class SigningAlgorithms //OidcConstants.PromptModes.Create, }; - public const string SuppressedPrompt = "suppressed_" + OidcConstants.AuthorizeRequest.Prompt; + /// + /// The name of the parameter passed to the authorize callback to indicate + /// prompt modes that have already been used. This constant is deprecated in + /// favor of . + /// + [Obsolete("Use the ProcessedPrompt constant instead.")] + public const string SuppressedPrompt = ProcessedPrompt; + + /// + /// The name of the parameter passed to the authorize callback to indicate + /// prompt modes that have already been used. This constant replaces the + /// deprecated , while keeping the underlying + /// value unchanged. + /// + public const string ProcessedPrompt = "suppressed_" + OidcConstants.AuthorizeRequest.Prompt; public static class KnownAcrValues { diff --git a/src/IdentityServer/Extensions/ValidatedAuthorizeRequestExtensions.cs b/src/IdentityServer/Extensions/ValidatedAuthorizeRequestExtensions.cs index 2bcafcabd..8b416480f 100644 --- a/src/IdentityServer/Extensions/ValidatedAuthorizeRequestExtensions.cs +++ b/src/IdentityServer/Extensions/ValidatedAuthorizeRequestExtensions.cs @@ -41,7 +41,7 @@ public static void RemovePrompt(this ValidatedAuthorizeRequest request) suppress.Append(OidcConstants.PromptModes.Create); } - request.Raw.Add(Constants.SuppressedPrompt, suppress.ToString()); + request.Raw.Add(Constants.ProcessedPrompt, suppress.ToString()); request.PromptModes = request.PromptModes.Except(new[] { OidcConstants.PromptModes.Login, OidcConstants.PromptModes.SelectAccount, diff --git a/src/IdentityServer/Validation/Default/AuthorizeRequestValidator.cs b/src/IdentityServer/Validation/Default/AuthorizeRequestValidator.cs index 98775f20d..8fc887e3d 100644 --- a/src/IdentityServer/Validation/Default/AuthorizeRequestValidator.cs +++ b/src/IdentityServer/Validation/Default/AuthorizeRequestValidator.cs @@ -610,15 +610,15 @@ private async Task ValidateOptionalParametersA } } - var suppressed_prompt = request.Raw.Get(Constants.SuppressedPrompt); - if (suppressed_prompt.IsPresent()) + var processed_prompt = request.Raw.Get(Constants.ProcessedPrompt); + if (processed_prompt.IsPresent()) { - var prompts = suppressed_prompt.Split(' ', StringSplitOptions.RemoveEmptyEntries); + var prompts = processed_prompt.Split(' ', StringSplitOptions.RemoveEmptyEntries); if (prompts.All(p => _options.UserInteraction.PromptValuesSupported?.Contains(p) == true)) { if (prompts.Contains(OidcConstants.PromptModes.None) && prompts.Length > 1) { - LogError("suppressed_prompt contains 'none' and other values. 'none' should be used by itself.", request); + LogError("processed_prompt contains 'none' and other values. 'none' should be used by itself.", request); return Invalid(request, description: "Invalid prompt"); } if (prompts.Contains(OidcConstants.PromptModes.Create) && prompts.Length > 1) @@ -627,16 +627,16 @@ private async Task ValidateOptionalParametersA return Invalid(request, description: "Invalid prompt"); } - request.SuppressedPromptModes = prompts; + request.ProcessedPromptModes = prompts; } else { - LogError("Unsupported prompt mode.", request); + LogError("Unsupported processed_prompt mode.", request); return Invalid(request, description: "Invalid prompt"); } } - request.PromptModes = request.OriginalPromptModes.Except(request.SuppressedPromptModes).ToArray(); + request.PromptModes = request.OriginalPromptModes.Except(request.ProcessedPromptModes).ToArray(); ////////////////////////////////////////////////////////// // check ui locales diff --git a/src/IdentityServer/Validation/Models/ValidatedAuthorizeRequest.cs b/src/IdentityServer/Validation/Models/ValidatedAuthorizeRequest.cs index 3b2a10523..7209a468c 100644 --- a/src/IdentityServer/Validation/Models/ValidatedAuthorizeRequest.cs +++ b/src/IdentityServer/Validation/Models/ValidatedAuthorizeRequest.cs @@ -137,26 +137,66 @@ public class ValidatedAuthorizeRequest : ValidatedRequest /// /// Gets or sets the collection of prompt modes. /// + /// + /// The change as they are used. For example, if + /// the prompt mode is login (to force the login UI to be displayed), the + /// collection will initially contain login, but when the login page is + /// displayed, the login prompt will be removed from the collection of + /// prompt modes so that the login page will only be displayed once. + /// + /// See also: and . + /// + /// /// - /// The collection of prompt modes. + /// The collection of prompt modes, which changes as the request is + /// processed and various prompts are displayed. /// public IEnumerable PromptModes { get; set; } = Enumerable.Empty(); /// /// Gets or sets the collection of original prompt modes. /// + /// + /// The change as they are used. For example, if + /// the prompt mode is login (to force the login UI to be displayed), the + /// collection will initially contain login, but when the login page is + /// displayed, the login prompt will be removed from the collection of + /// prompt modes so that the login page will only be displayed once. + /// + /// See also: + /// + /// + /// + /// + /// + /// /// /// The collection of original prompt modes. /// - internal IEnumerable OriginalPromptModes { get; set; } = Enumerable.Empty(); + public IEnumerable OriginalPromptModes { get; set; } = Enumerable.Empty(); /// - /// Gets or sets the collection of suppressed prompt modes. + /// Gets or sets the collection of previously processed prompt modes. /// + /// + /// The change as they are used. For example, if + /// the prompt mode is login (to force the login UI to be displayed), the + /// collection will initially contain login, but when the login page is + /// displayed, the login prompt will be removed from the collection of + /// prompt modes so that the login page will only be displayed once. + /// + /// + /// See also: + /// + /// + /// + /// + /// /// - /// The collection of suppressed prompt modes. + /// The collection of processed prompt modes. /// - internal IEnumerable SuppressedPromptModes { get; set; } = Enumerable.Empty(); + public IEnumerable ProcessedPromptModes { get; set; } = Enumerable.Empty(); /// /// Gets or sets the maximum age. diff --git a/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests_Login.cs b/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests_Login.cs index 576c75b71..a2fde2428 100644 --- a/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests_Login.cs +++ b/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests_Login.cs @@ -269,6 +269,6 @@ public async Task prompt_for_signin_should_suppress_prompt_from_raw_url() var result = await _subject.ProcessLoginAsync(request); - request.Raw.AllKeys.Should().Contain(Constants.SuppressedPrompt); + request.Raw.AllKeys.Should().Contain(Constants.ProcessedPrompt); } } \ No newline at end of file diff --git a/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_Valid.cs b/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_Valid.cs index 055825ef4..70c05babf 100644 --- a/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_Valid.cs +++ b/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_Valid.cs @@ -224,7 +224,7 @@ public async Task multiple_prompt_values_should_be_accepted() [Fact] [Trait("Category", Category)] - public async Task suppressed_prompt_values_should_overwrite_original_values() + public async Task processed_prompt_values_should_overwrite_original_values() { var validator = Factory.CreateAuthorizeRequestValidator(); @@ -242,19 +242,19 @@ public async Task suppressed_prompt_values_should_overwrite_original_values() } { parameters[OidcConstants.AuthorizeRequest.Prompt] = "consent login"; - parameters[Constants.SuppressedPrompt] = "login"; + parameters[Constants.ProcessedPrompt] = "login"; var result = await validator.ValidateAsync(parameters); result.ValidatedRequest.PromptModes.Should().BeEquivalentTo(new[] { OidcConstants.PromptModes.Consent }); result.ValidatedRequest.OriginalPromptModes.Should().BeEquivalentTo(new[] { OidcConstants.PromptModes.Consent, OidcConstants.PromptModes.Login }); - result.ValidatedRequest.SuppressedPromptModes.Should().BeEquivalentTo(new[] { OidcConstants.PromptModes.Login }); + result.ValidatedRequest.ProcessedPromptModes.Should().BeEquivalentTo(new[] { OidcConstants.PromptModes.Login }); } { parameters[OidcConstants.AuthorizeRequest.Prompt] = "consent login"; - parameters[Constants.SuppressedPrompt] = "login consent"; + parameters[Constants.ProcessedPrompt] = "login consent"; var result = await validator.ValidateAsync(parameters); result.ValidatedRequest.PromptModes.Should().BeEmpty(); result.ValidatedRequest.OriginalPromptModes.Should().BeEquivalentTo(new[] { OidcConstants.PromptModes.Consent, OidcConstants.PromptModes.Login }); - result.ValidatedRequest.SuppressedPromptModes.Should().BeEquivalentTo(new[] { OidcConstants.PromptModes.Consent, OidcConstants.PromptModes.Login }); + result.ValidatedRequest.ProcessedPromptModes.Should().BeEquivalentTo(new[] { OidcConstants.PromptModes.Consent, OidcConstants.PromptModes.Login }); } } } \ No newline at end of file