Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Fix social samples #304

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions samples/SocialSample/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ dnx . web
});

// Choose an authentication type
app.Map("/login", signoutApp =>
app.Use(next => async context =>
{
signoutApp.Run(async context =>
if (context.Request.Path.StartsWithSegments(new PathString("/login")))
{
var authType = context.Request.Query["authscheme"];
if (!string.IsNullOrEmpty(authType))
Expand All @@ -199,21 +199,21 @@ dnx . web
await context.Response.WriteAsync("<a href=\"?authscheme=" + type.AuthenticationScheme + "\">" + (type.Caption ?? "(suppressed)") + "</a><br>");
}
await context.Response.WriteAsync("</body></html>");
});
});

// Sign-out to remove the user cookie.
app.Map("/logout", signoutApp =>
{
signoutApp.Run(async context =>
return;
}
// Sign-out to remove the user cookie.
else if (context.Request.Path.StartsWithSegments(new PathString("/logout")))
{
await context.Authentication.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
context.Response.ContentType = "text/html";
await context.Response.WriteAsync("<html><body>");
await context.Response.WriteAsync("You have been logged out. Goodbye " + context.User.Identity.Name + "<br>");
await context.Response.WriteAsync("<a href=\"/\">Home</a>");
await context.Response.WriteAsync("</body></html>");
});
return;
}

await next(context);
});

// Deny anonymous request beyond this point.
Expand Down