Skip to content

Commit c99a28c

Browse files
authored
Merge pull request #78 from whyleee/master
Use system web cookie managers
2 parents 967cc79 + 3e53a80 commit c99a28c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

TaskWebApp/App_Start/Startup.Auth.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Microsoft.Identity.Client;
22
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
33
using Microsoft.IdentityModel.Tokens;
4+
using Microsoft.Owin.Host.SystemWeb;
45
using Microsoft.Owin.Security;
56
using Microsoft.Owin.Security.Cookies;
67
using Microsoft.Owin.Security.Notifications;
@@ -29,7 +30,11 @@ public void ConfigureAuth(IAppBuilder app)
2930

3031
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
3132

32-
app.UseCookieAuthentication(new CookieAuthenticationOptions());
33+
app.UseCookieAuthentication(new CookieAuthenticationOptions
34+
{
35+
// ASP.NET web host compatible cookie manager
36+
CookieManager = new SystemWebChunkingCookieManager()
37+
});
3338

3439
app.UseOpenIdConnectAuthentication(
3540
new OpenIdConnectAuthenticationOptions
@@ -58,7 +63,10 @@ public void ConfigureAuth(IAppBuilder app)
5863
},
5964

6065
// Specify the scope by appending all of the scopes requested into one string (separated by a blank space)
61-
Scope = $"openid profile offline_access {Globals.ReadTasksScope} {Globals.WriteTasksScope}"
66+
Scope = $"openid profile offline_access {Globals.ReadTasksScope} {Globals.WriteTasksScope}",
67+
68+
// ASP.NET web host compatible cookie manager
69+
CookieManager = new SystemWebCookieManager()
6270
}
6371
);
6472
}

0 commit comments

Comments
 (0)