@@ -53,8 +53,8 @@ Add the authentication to the web application using the builder.Services in the
5353``` csharp
5454builder .Services .AddAuthentication (options =>
5555{
56- options .DefaultScheme = CookieAuthenticationDefaults .AuthenticationScheme ;
57- options .DefaultChallengeScheme = OpenIdConnectDefaults .AuthenticationScheme ;
56+ options .DefaultScheme = CookieAuthenticationDefaults .AuthenticationScheme ;
57+ options .DefaultChallengeScheme = OpenIdConnectDefaults .AuthenticationScheme ;
5858})
5959.AddCookie ()
6060.AddOpenIdConnect (options =>
@@ -200,35 +200,35 @@ The **Scope** option can be used to request different claims or a refresh token
200200``` csharp
201201services .AddAuthentication (options =>
202202{
203- options .DefaultScheme = CookieAuthenticationDefaults .AuthenticationScheme ;
204- options .DefaultChallengeScheme = OpenIdConnectDefaults .AuthenticationScheme ;
203+ options .DefaultScheme = CookieAuthenticationDefaults .AuthenticationScheme ;
204+ options .DefaultChallengeScheme = OpenIdConnectDefaults .AuthenticationScheme ;
205205})
206206.AddCookie ()
207207.AddOpenIdConnect (OpenIdConnectDefaults .AuthenticationScheme , options =>
208208{
209- var oidcConfig = builder .Configuration .GetSection (" OpenIDConnectSettings" );
210- options .Authority = oidcConfig [" IdentityProviderUrl" ];
211- options .ClientSecret = oidcConfig [" ClientSecret" ];
212- options .ClientId = oidcConfig [" Audience" ];
213- options .ResponseType = OpenIdConnectResponseType .Code ;
209+ var oidcConfig = builder .Configuration .GetSection (" OpenIDConnectSettings" );
210+ options .Authority = oidcConfig [" IdentityProviderUrl" ];
211+ options .ClientSecret = oidcConfig [" ClientSecret" ];
212+ options .ClientId = oidcConfig [" Audience" ];
213+ options .ResponseType = OpenIdConnectResponseType .Code ;
214214
215- options .Scope .Clear ();
216- options .Scope .Add (" openid" );
217- options .Scope .Add (" profile" );
218- options .Scope .Add (" email" );
219- options .Scope .Add (" offline_access" );
215+ options .Scope .Clear ();
216+ options .Scope .Add (" openid" );
217+ options .Scope .Add (" profile" );
218+ options .Scope .Add (" email" );
219+ options .Scope .Add (" offline_access" );
220220
221- options .ClaimActions .Remove (" amr" );
222- options .ClaimActions .MapJsonKey (" website" , " website" );
221+ options .ClaimActions .Remove (" amr" );
222+ options .ClaimActions .MapJsonKey (" website" , " website" );
223223
224- options .GetClaimsFromUserInfoEndpoint = true ;
225- options .SaveTokens = true ;
224+ options .GetClaimsFromUserInfoEndpoint = true ;
225+ options .SaveTokens = true ;
226226
227- // .NET 9 feature
228- options .PushedAuthorizationBehavior = PushedAuthorizationBehavior .Require ;
227+ // .NET 9 feature
228+ options .PushedAuthorizationBehavior = PushedAuthorizationBehavior .Require ;
229229
230- options .TokenValidationParameters .NameClaimType = JwtRegisteredClaimNames .Name ;
231- options .TokenValidationParameters .RoleClaimType = " roles" ;
230+ options .TokenValidationParameters .NameClaimType = JwtRegisteredClaimNames .Name ;
231+ options .TokenValidationParameters .RoleClaimType = " roles" ;
232232});
233233```
234234
0 commit comments