From aae2e630b40cf1c5160d3c244dde16d870d7306a Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Thu, 19 Mar 2015 11:43:03 -0700 Subject: [PATCH] Fix samples --- samples/SocialSample/Startup.cs | 40 ++++++++++++++++----------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/samples/SocialSample/Startup.cs b/samples/SocialSample/Startup.cs index bc7d61b4ae..0d0c78838d 100644 --- a/samples/SocialSample/Startup.cs +++ b/samples/SocialSample/Startup.cs @@ -1,16 +1,14 @@ using System.Net.Http; using System.Net.Http.Headers; using System.Security.Claims; -using System.Threading.Tasks; -using Microsoft.AspNet.Builder; -using Microsoft.AspNet.DataProtection; -using Microsoft.AspNet.Http; -using Microsoft.AspNet.Http.Authentication; using Microsoft.AspNet.Authentication; using Microsoft.AspNet.Authentication.Cookies; using Microsoft.AspNet.Authentication.Google; using Microsoft.AspNet.Authentication.MicrosoftAccount; using Microsoft.AspNet.Authentication.OAuth; +using Microsoft.AspNet.Builder; +using Microsoft.AspNet.Http; +using Microsoft.AspNet.Http.Authentication; using Microsoft.Framework.DependencyInjection; using Newtonsoft.Json.Linq; @@ -18,26 +16,26 @@ namespace CookieSample { public class Startup { + public void ConfigureServices(IServiceCollection services) + { + services.AddDataProtection(); + services.Configure(options => + { + options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; + }); + services.ConfigureClaimsTransformation(p => + { + var id = new ClaimsIdentity("xform"); + id.AddClaim(new Claim("ClaimsTransformation", "TransformAddedClaim")); + p.AddIdentity(id); + return p; + }); + } + public void Configure(IApplicationBuilder app) { app.UseErrorPage(); - app.UseServices(services => - { - services.AddDataProtection(); - services.Configure(options => - { - options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; - }); - services.ConfigureClaimsTransformation(p => - { - var id = new ClaimsIdentity("xform"); - id.AddClaim(new Claim("ClaimsTransformation", "TransformAddedClaim")); - p.AddIdentity(id); - return p; - }); - }); - app.UseCookieAuthentication(options => { options.LoginPath = new PathString("/login");