Skip to content

Commit 3ed63c9

Browse files
committed
Update PAR parsing logic to work with latest versions
1 parent 4a2c927 commit 3ed63c9

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

src/Auth0.AspNetCore.Authentication/PushedAuthorizationRequest/PushedAuthorizationRequestHandler.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,20 @@ public static async Task HandleAsync(RedirectContext context, OpenIdConnectOptio
2424
var oidcConfiguration =
2525
await oidcOptions.ConfigurationManager?.GetConfigurationAsync(default)!;
2626

27-
object? rawParEndpoint = string.Empty;
28-
oidcConfiguration?.AdditionalData.TryGetValue("pushed_authorization_request_endpoint", out rawParEndpoint);
29-
string? parEndpoint = rawParEndpoint as string;
27+
// Trying to get the PAR endpoint from the property first, fallback to AdditionalData for older configs.
28+
string? parEndpoint = null;
29+
if (oidcConfiguration != null)
30+
{
31+
parEndpoint = oidcConfiguration?.PushedAuthorizationRequestEndpoint;
32+
if (string.IsNullOrEmpty(parEndpoint))
33+
{
34+
object? rawParEndpoint = string.Empty;
35+
oidcConfiguration.AdditionalData?.TryGetValue("pushed_authorization_request_endpoint", out rawParEndpoint);
36+
parEndpoint = rawParEndpoint as string;
37+
}
38+
}
3039

31-
// If PAR was enabled in the options, but no `pushed_authorization_request_endpoint` value is find
40+
// If PAR was enabled in the options, but no `pushed_authorization_request_endpoint` value is found
3241
// in the OIDC configuration, we will throw an error.
3342
if (string.IsNullOrEmpty(parEndpoint))
3443
{

0 commit comments

Comments
 (0)