File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
src/content/docs/identityserver/tokens Expand file tree Collapse file tree 1 file changed +21
-1
lines changed 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
+ ``` cs {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