File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed
src/content/docs/identityserver Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ Key takeaways:
21
21
22
22
* how to request a token using client credentials
23
23
* how to use a shared secret
24
- * how to use access token
24
+ * how to use an access token
25
25
26
26
[ link to source code] ( https://github.com/DuendeSoftware/Samples/tree/main/IdentityServer/v7/Basics/ClientCredentials )
27
27
@@ -125,4 +125,13 @@ Key takeaways:
125
125
would normally be sent in that redirect with the resulting request uri. See the ` ParOidcEvents.cs ` file for more
126
126
details.
127
127
128
+ ::: note
129
+ This sample is only relevant if you're using .NET 8 or lower.
130
+
131
+ [ .NET 9 has support for PAR built-in] [ ms-learn-par ] , and the ASP.NET Core OIDC authentication handler will automatically use
132
+ PAR when the authority supports it, based on the discovery metadata.
133
+ :::
134
+
128
135
[ link to source code] ( https://github.com/DuendeSoftware/Samples/tree/main/IdentityServer/v7/Basics/MvcPar )
136
+
137
+ [ ms-learn-par ] : https://learn.microsoft.com/en-us/aspnet/core/release-notes/aspnetcore-9.0?view=aspnetcore-9.0#openidconnecthandler-adds-support-for-pushed-authorization-requests-par
Original file line number Diff line number Diff line change @@ -58,7 +58,27 @@ were just pushed. From there, the OAuth or OIDC flow continues as normal. For ex
58
58
the user will be redirected to log in and other UI pages as necessary before being redirected back to the client with an
59
59
authorization code which the client subsequently exchanges for tokens.
60
60
61
- A sample of how to implement this flow in an ASP.NET application is
61
+ If you're building an ASP.NET Core application using .NET 9 or higher, using PAR is very straightforward:
62
+
63
+ ``` csharp {13-15}
64
+ // Program.cs
65
+ builder .Services
66
+ .AddAuthentication (options =>
67
+ {
68
+ options .DefaultScheme = CookieAuthenticationDefaults .AuthenticationScheme ;
69
+ options .DefaultChallengeScheme = OpenIdConnectDefaults .AuthenticationScheme ;
70
+ })
71
+ .AddCookie ()
72
+ .AddOpenIdConnect (OpenIdConnectDefaults .AuthenticationScheme , oidcOptions =>
73
+ {
74
+ // Your authority, client ID, ... configuration goes here.
75
+
76
+ // By default, PushedAuthorizationBehavior is set to PushedAuthorizationBehavior.UseIfAvailable.
77
+ // You can also require using PAR:
78
+ oidcOptions .PushedAuthorizationBehavior = PushedAuthorizationBehavior .Require ;
79
+ });
80
+ ```
81
+ .NET 8 does not have built-in support for PAR. If you're using .NET 8, we have a sample of how to implement this flow
62
82
available [ here] ( /identityserver/samples/basics#mvc-client-with-pushed-authorization-requests ) .
63
83
64
84
## Data Store
You can’t perform that action at this time.
0 commit comments