From 7bc6cab72e3bc3ec3cffe026257fa3d8d4b5f6ba Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Mon, 20 Apr 2015 15:26:22 -0700 Subject: [PATCH] Fix samples --- samples/CookieSample/Startup.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/samples/CookieSample/Startup.cs b/samples/CookieSample/Startup.cs index df88589fb7..e700f4b90a 100644 --- a/samples/CookieSample/Startup.cs +++ b/samples/CookieSample/Startup.cs @@ -18,13 +18,14 @@ namespace CookieSample { app.UseCookieAuthentication(options => { + options.AutomaticAuthentication = true; }); app.Run(async context => { - if (context.User == null || !context.User.Identity.IsAuthenticated) + if (string.IsNullOrEmpty(context.User.Identity.Name)) { - context.Response.SignIn(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim("name", "bob") }))); + context.Response.SignIn(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, "bob") }))); context.Response.ContentType = "text/plain"; await context.Response.WriteAsync("Hello First timer"); return;