Skip to content

Commit 41a2203

Browse files
Include of PAR for WN9 /b (dotnet#33334)
* Include of PAR for WN9 /b * Update aspnetcore-2.2.md
1 parent 7cd8277 commit 41a2203

File tree

3 files changed

+26
-23
lines changed

3 files changed

+26
-23
lines changed

aspnetcore/release-notes/aspnetcore-2.2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: rick-anderson
44
description: Learn about the new features in ASP.NET Core 2.2.
55
ms.author: riande
66
ms.custom: mvc
7-
ms.date: 12/05/2019
7+
ms.date: 12/5/2019
88
uid: aspnetcore-2.2
99
---
1010
# What's new in ASP.NET Core 2.2

aspnetcore/release-notes/aspnetcore-9/includes/par.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66
We'd like to thank [Joe DeCock](https://github.com/josephdecock) from [Duende Software](https://github.com/DuendeSoftware) for adding Pushed Authorization Requests (PAR) to ASP.NET Core's [OpenIdConnectHandler](/dotnet/api/microsoft.aspnetcore.authentication.openidconnect.openidconnecthandler). Joe described the background and motivation for enabling PAR in [his API proposal](https://github.com/dotnet/aspnetcore/issues/51686) as follows:
77

8-
> Pushed Authorization Requests (PAR) is a relatively new [OAuth standard](https://datatracker.ietf.org/doc/html/rfc9126) that improves the security of OAuth and OIDC flows by moving authorization parameters from the front channel to the back channel (that is, from redirect URLs in the browser to direct machine to machine http calls on the back end).
8+
> Pushed Authorization Requests (PAR) is a relatively new [OAuth standard](https://datatracker.ietf.org/doc/html/rfc9126) that improves the security of OAuth and OIDC flows by moving authorization parameters from the front channel to the back channel. Thats is, moving authorization parameters from redirect URLs in the browser to direct machine to machine http calls on the back end.
99
>
10-
> This prevents an attacker in the browser from
10+
> This prevents an attacker in the browser from:
1111
>
12-
> * seeing authorization parameters (which could leak PII) and from
13-
> * tampering with those parameters (e.g., the attacker could change the scope of access being requested).
12+
> * Seeing authorization parameters, which could leak PII.
13+
> * Tampering with those parameters, e.g., the attacker could change the scope of access being requested.
1414
>
15-
> Pushing the authorization parameters also keeps request URLs short. Authorize parameters might get very long when using more complex OAuth and OIDC features such as [Rich Authorization Requests](https://oauth.net/2/rich-authorization-requests/), and URLs that are long cause issues in many browsers and networking infrastructure.
15+
> Pushing the authorization parameters also keeps request URLs short. Authorize parameters can get very long when using more complex OAuth and OIDC features such as [Rich Authorization Requests](https://oauth.net/2/rich-authorization-requests/). URLs that are long cause issues in many browsers and networking infrastructures.
1616
>
1717
> The use of PAR is encouraged by the [FAPI working group](https://openid.net/wg/fapi/) within the OpenID Foundation. For example, [the FAPI2.0 Security Profile](https://openid.bitbucket.io/fapi/fapi-2_0-security-profile.html) requires the use of PAR. This security profile is used by many of the groups working on open banking (primarily in Europe), in health care, and in other industries with high security requirements.
1818
>
@@ -23,8 +23,8 @@ We'd like to thank [Joe DeCock](https://github.com/josephdecock) from [Duende So
2323
> * [Keycloak](https://www.keycloak.org/)
2424
> * [Authlete](https://www.authlete.com/developers/tutorial/oidc/)
2525
26-
For preview7, we have decided to enable PAR by default if the identity provider's discovery document (usually found at `.well-known/openid-configuration`) advertises support for PAR, since it should provide enhanced security for providers that support it. If this causes problems, you can disable PAR via [OpenIdConnectOptions.PushedAuthorizationBehavior](https://source.dot.net/#Microsoft.AspNetCore.Authentication.OpenIdConnect/OpenIdConnectOptions.cs,99014cc0333b1603) as follows:
26+
For .NET 9, we have decided to enable PAR by default if the identity provider's discovery document advertises support for PAR, since it should provide enhanced security for providers that support it. The identity provider's discovery document is usually found at `.well-known/openid-configuration`. If this causes problems, you can disable PAR via [OpenIdConnectOptions.PushedAuthorizationBehavior](https://source.dot.net/#Microsoft.AspNetCore.Authentication.OpenIdConnect/OpenIdConnectOptions.cs,99014cc0333b1603) as follows:
2727

2828
:::code language="csharp" source="~/release-notes/aspnetcore-9/samples/PAR/Program.cs" id="snippet_1" highlight="8-99":::
2929

30-
If you want to ensure that authentication only succeeds if PAR is used, you can use [PushedAuthorizationBehavior.Require](https://source.dot.net/#Microsoft.AspNetCore.Authentication.OpenIdConnect/PushedAuthorizationBehavior.cs,3af73de8f33b70c5) instead. This change also introduces a new [OnPushAuthorization](https://source.dot.net/#Microsoft.AspNetCore.Authentication.OpenIdConnect/Events/OpenIdConnectEvents.cs,6a21c8f3a90753c1) event to [OpenIdConnectEvents](/dotnet/api/microsoft.aspnetcore.authentication.openidconnect.openidconnectevents) which can be used customize the pushed authorization request or handle it manually. Please refer to the [API proposal](https://github.com/dotnet/aspnetcore/issues/51686) for more details.
30+
To ensure that authentication only succeeds if PAR is used, use [PushedAuthorizationBehavior.Require](https://source.dot.net/#Microsoft.AspNetCore.Authentication.OpenIdConnect/PushedAuthorizationBehavior.cs,3af73de8f33b70c5) instead. This change also introduces a new [OnPushAuthorization](https://source.dot.net/#Microsoft.AspNetCore.Authentication.OpenIdConnect/Events/OpenIdConnectEvents.cs,6a21c8f3a90753c1) event to [OpenIdConnectEvents](/dotnet/api/microsoft.aspnetcore.authentication.openidconnect.openidconnectevents) which can be used customize the pushed authorization request or handle it manually. See the [API proposal](https://github.com/dotnet/aspnetcore/issues/51686) for more details.

aspnetcore/release-notes/aspnetcore-9/samples/PAR/Program.cs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,27 @@
44
var builder = WebApplication.CreateBuilder(args);
55

66
// <snippet_1>
7-
builder.Services
8-
.AddAuthentication(options =>
9-
{
10-
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
11-
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
12-
})
13-
.AddCookie()
14-
.AddOpenIdConnect("oidc", oidcOptions =>
15-
{
16-
// Other provider-specific configuration goes here.
17-
18-
// The default value is PushedAuthorizationBehavior.UseIfAvailable.
19-
oidcOptions.PushedAuthorizationBehavior = PushedAuthorizationBehavior.Disable;
20-
});
7+
builder.Services
8+
.AddAuthentication(options =>
9+
{
10+
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
11+
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
12+
})
13+
.AddCookie()
14+
.AddOpenIdConnect("oidc", oidcOptions =>
15+
{
16+
// Other provider-specific configuration goes here.
17+
18+
// The default value is PushedAuthorizationBehavior.UseIfAvailable.
19+
20+
// 'OpenIdConnectOptions' does not contain a definition for 'PushedAuthorizationBehavior'
21+
// and no accessible extension method 'PushedAuthorizationBehavior' accepting a first argument
22+
// of type 'OpenIdConnectOptions' could be found
23+
oidcOptions.PushedAuthorizationBehavior = PushedAuthorizationBehavior.Disable;
24+
});
2125
// </snippet_1>
2226

2327
var app = builder.Build();
24-
2528
app.MapGet("/", () => "Hello World!");
2629

2730
app.Run();

0 commit comments

Comments
 (0)