Skip to content

Commit

Permalink
Respect processed prompt and max age when using par
Browse files Browse the repository at this point in the history
  • Loading branch information
josephdecock committed May 31, 2024
1 parent 845d428 commit 7e5eef3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ public async Task WriteHttpResponse(AuthorizeInteractionPageResult result, HttpC
returnUrl = returnUrl
.AddQueryString(OidcConstants.AuthorizeRequest.RequestUri, requestUri)
.AddQueryString(OidcConstants.AuthorizeRequest.ClientId, result.Request.ClientId);
var processedPrompt = result.Request.Raw[Constants.ProcessedPrompt];
if (processedPrompt != null)
{
returnUrl = returnUrl.AddQueryString(Constants.ProcessedPrompt, processedPrompt);
}
var processedMaxAge = result.Request.Raw[Constants.ProcessedMaxAge];
if (processedMaxAge != null)
{
returnUrl = returnUrl.AddQueryString(Constants.ProcessedMaxAge, processedMaxAge);
}
}
else
{
Expand Down
13 changes: 13 additions & 0 deletions src/IdentityServer/Validation/Default/RequestObjectValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,20 @@ private static bool IsParRequestUri(string requestUri)
// Record the reference value, so we can know that PAR did happen
request.PushedAuthorizationReferenceValue = GetReferenceValue(request);
// Copy the PAR into the raw request so that validation will use the pushed parameters
// But keep the query parameters we add that indicate that we have processed
// prompt and max_age, as those are not pushed
var processedPrompt = request.Raw[Constants.ProcessedPrompt];
var processedMaxAge = request.Raw[Constants.ProcessedMaxAge];

request.Raw = pushedAuthorizationRequest.PushedParameters;
if (processedPrompt != null)
{
request.Raw[Constants.ProcessedPrompt] = processedPrompt;
}
if (processedMaxAge != null)
{
request.Raw[Constants.ProcessedMaxAge] = processedMaxAge;
}

var bindingError = ValidatePushedAuthorizationBindingToClient(pushedAuthorizationRequest, request);
if (bindingError != null)
Expand Down

0 comments on commit 7e5eef3

Please sign in to comment.