@@ -56,40 +56,30 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
5656
5757 JwtSecurityTokenHandler . DefaultInboundClaimTypeMap . Clear ( ) ;
5858
59- var oidcOptions = new OpenIdConnectOptions
59+ app . UseOpenIdConnectAuthentication ( new OpenIdConnectOptions
6060 {
6161 AuthenticationScheme = "oidc" ,
6262 SignInScheme = "cookies" ,
6363
6464 Authority = Clients . Constants . BaseAddress ,
6565 RequireHttpsMetadata = false ,
66+
6667 ClientId = "mvc.hybrid" ,
6768 ClientSecret = "secret" ,
69+
6870 ResponseType = "code id_token" ,
71+ Scope = { "openid" , "profile" , "email" , "roles" , "api1" , "offline_access" } ,
72+
6973 SaveTokens = true ,
70-
74+
7175 TokenValidationParameters = new Microsoft . IdentityModel . Tokens . TokenValidationParameters
7276 {
7377 NameClaimType = JwtClaimTypes . Name ,
7478 RoleClaimType = JwtClaimTypes . Role ,
7579 }
76- } ;
77-
78- oidcOptions . Scope . Clear ( ) ;
79- oidcOptions . Scope . Add ( "openid" ) ;
80- oidcOptions . Scope . Add ( "profile" ) ;
81- oidcOptions . Scope . Add ( "email" ) ;
82- oidcOptions . Scope . Add ( "roles" ) ;
83- oidcOptions . Scope . Add ( "api1" ) ;
84- oidcOptions . Scope . Add ( "offline_access" ) ;
85-
86- app . UseOpenIdConnectAuthentication ( oidcOptions ) ;
87- app . UseMvc ( routes =>
88- {
89- routes . MapRoute (
90- name : "default" ,
91- template : "{controller=Home}/{action=Index}/{id?}" ) ;
9280 } ) ;
81+
82+ app . UseMvcWithDefaultRoute ( ) ;
9383 }
9484 }
9585}
0 commit comments