Skip to content

Commit 4161efd

Browse files
committed
Update authentication middleware
Update global to sdk 2.0.0
1 parent 58f3b5b commit 4161efd

2 files changed

Lines changed: 19 additions & 21 deletions

File tree

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sdk": {
3-
"version":"2.0.0-preview2-006497"
3+
"version":"2.0.0"
44
}
55
}

src/Web/WebMVC/Startup.cs

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86,30 +86,28 @@ public void ConfigureServices(IServiceCollection services)
8686

8787
// Add Authentication services
8888

89-
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
90-
.AddCookie(CookieAuthenticationDefaults.AuthenticationScheme)
91-
.AddOpenIdConnect(options => {
92-
options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
93-
options.Authority = identityUrl.ToString();
94-
options.SignedOutRedirectUri = callBackUrl.ToString();
95-
options.ClientId = useLoadTest ? "mvctest" : "mvc";
96-
options.ClientSecret = "secret";
97-
options.ResponseType = useLoadTest ? "code id_token token" : "code id_token";
98-
options.SaveTokens = true;
99-
options.GetClaimsFromUserInfoEndpoint = true;
100-
options.RequireHttpsMetadata = false;
101-
options.Scope.Add("openid");
102-
options.Scope.Add("profile");
103-
options.Scope.Add("orders");
104-
options.Scope.Add("basket");
105-
options.Scope.Add("marketing");
106-
options.Scope.Add("locations");
107-
});
108-
10989
services.AddAuthentication(options => {
11090
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
11191
options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
11292
options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
93+
})
94+
.AddCookie(CookieAuthenticationDefaults.AuthenticationScheme)
95+
.AddOpenIdConnect(options => {
96+
options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
97+
options.Authority = identityUrl.ToString();
98+
options.SignedOutRedirectUri = callBackUrl.ToString();
99+
options.ClientId = useLoadTest ? "mvctest" : "mvc";
100+
options.ClientSecret = "secret";
101+
options.ResponseType = useLoadTest ? "code id_token token" : "code id_token";
102+
options.SaveTokens = true;
103+
options.GetClaimsFromUserInfoEndpoint = true;
104+
options.RequireHttpsMetadata = false;
105+
options.Scope.Add("openid");
106+
options.Scope.Add("profile");
107+
options.Scope.Add("orders");
108+
options.Scope.Add("basket");
109+
options.Scope.Add("marketing");
110+
options.Scope.Add("locations");
113111
});
114112
}
115113

0 commit comments

Comments
 (0)