Add DataProtection to samples.

This commit is contained in:
Chris Ross 2014-11-18 14:59:56 -08:00
parent b37966f7ef
commit 977a08ddca
3 changed files with 15 additions and 5 deletions

View File

@ -2,6 +2,7 @@ using System.Security.Claims;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Security.Cookies;
using Microsoft.AspNet.Security.DataProtection;
namespace CookieSample
{
@ -9,6 +10,11 @@ namespace CookieSample
{
public void Configure(IApplicationBuilder app)
{
app.UseServices(services =>
{
services.Add(DataProtectionServices.GetDefaultServices());
});
app.UseCookieAuthentication(options =>
{
});

View File

@ -3,6 +3,7 @@ using System.Security.Claims;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Security.Cookies;
using Microsoft.AspNet.Security.DataProtection;
namespace CookieSessionSample
{
@ -10,6 +11,11 @@ namespace CookieSessionSample
{
public void Configure(IApplicationBuilder app)
{
app.UseServices(services =>
{
services.Add(DataProtectionServices.GetDefaultServices());
});
app.UseCookieAuthentication(options =>
{
options.SessionStore = new MemoryCacheSessionStore();

View File

@ -1,5 +1,3 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Security.Claims;
@ -8,13 +6,12 @@ using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Security;
using Microsoft.AspNet.Security;
using Microsoft.AspNet.Security.Cookies;
using Microsoft.AspNet.Security.Facebook;
using Microsoft.AspNet.Security.DataProtection;
using Microsoft.AspNet.Security.Google;
using Microsoft.AspNet.Security.MicrosoftAccount;
using Microsoft.AspNet.Security.OAuth;
using Microsoft.AspNet.Security.Twitter;
using Newtonsoft.Json.Linq;
using Microsoft.Framework.DependencyInjection;
using Newtonsoft.Json.Linq;
namespace CookieSample
{
@ -26,6 +23,7 @@ namespace CookieSample
app.UseServices(services =>
{
services.Add(DataProtectionServices.GetDefaultServices());
services.Configure<ExternalAuthenticationOptions>(options =>
{
options.SignInAsAuthenticationType = CookieAuthenticationDefaults.AuthenticationType;