Add DataProtection to samples.
This commit is contained in:
parent
b37966f7ef
commit
977a08ddca
|
|
@ -2,6 +2,7 @@ using System.Security.Claims;
|
||||||
using Microsoft.AspNet.Builder;
|
using Microsoft.AspNet.Builder;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Security.Cookies;
|
using Microsoft.AspNet.Security.Cookies;
|
||||||
|
using Microsoft.AspNet.Security.DataProtection;
|
||||||
|
|
||||||
namespace CookieSample
|
namespace CookieSample
|
||||||
{
|
{
|
||||||
|
|
@ -9,6 +10,11 @@ namespace CookieSample
|
||||||
{
|
{
|
||||||
public void Configure(IApplicationBuilder app)
|
public void Configure(IApplicationBuilder app)
|
||||||
{
|
{
|
||||||
|
app.UseServices(services =>
|
||||||
|
{
|
||||||
|
services.Add(DataProtectionServices.GetDefaultServices());
|
||||||
|
});
|
||||||
|
|
||||||
app.UseCookieAuthentication(options =>
|
app.UseCookieAuthentication(options =>
|
||||||
{
|
{
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using System.Security.Claims;
|
||||||
using Microsoft.AspNet.Builder;
|
using Microsoft.AspNet.Builder;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Security.Cookies;
|
using Microsoft.AspNet.Security.Cookies;
|
||||||
|
using Microsoft.AspNet.Security.DataProtection;
|
||||||
|
|
||||||
namespace CookieSessionSample
|
namespace CookieSessionSample
|
||||||
{
|
{
|
||||||
|
|
@ -10,6 +11,11 @@ namespace CookieSessionSample
|
||||||
{
|
{
|
||||||
public void Configure(IApplicationBuilder app)
|
public void Configure(IApplicationBuilder app)
|
||||||
{
|
{
|
||||||
|
app.UseServices(services =>
|
||||||
|
{
|
||||||
|
services.Add(DataProtectionServices.GetDefaultServices());
|
||||||
|
});
|
||||||
|
|
||||||
app.UseCookieAuthentication(options =>
|
app.UseCookieAuthentication(options =>
|
||||||
{
|
{
|
||||||
options.SessionStore = new MemoryCacheSessionStore();
|
options.SessionStore = new MemoryCacheSessionStore();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
|
@ -8,13 +6,12 @@ using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Http.Security;
|
using Microsoft.AspNet.Http.Security;
|
||||||
using Microsoft.AspNet.Security;
|
using Microsoft.AspNet.Security;
|
||||||
using Microsoft.AspNet.Security.Cookies;
|
using Microsoft.AspNet.Security.Cookies;
|
||||||
using Microsoft.AspNet.Security.Facebook;
|
using Microsoft.AspNet.Security.DataProtection;
|
||||||
using Microsoft.AspNet.Security.Google;
|
using Microsoft.AspNet.Security.Google;
|
||||||
using Microsoft.AspNet.Security.MicrosoftAccount;
|
using Microsoft.AspNet.Security.MicrosoftAccount;
|
||||||
using Microsoft.AspNet.Security.OAuth;
|
using Microsoft.AspNet.Security.OAuth;
|
||||||
using Microsoft.AspNet.Security.Twitter;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
namespace CookieSample
|
namespace CookieSample
|
||||||
{
|
{
|
||||||
|
|
@ -26,6 +23,7 @@ namespace CookieSample
|
||||||
|
|
||||||
app.UseServices(services =>
|
app.UseServices(services =>
|
||||||
{
|
{
|
||||||
|
services.Add(DataProtectionServices.GetDefaultServices());
|
||||||
services.Configure<ExternalAuthenticationOptions>(options =>
|
services.Configure<ExternalAuthenticationOptions>(options =>
|
||||||
{
|
{
|
||||||
options.SignInAsAuthenticationType = CookieAuthenticationDefaults.AuthenticationType;
|
options.SignInAsAuthenticationType = CookieAuthenticationDefaults.AuthenticationType;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue