Fix samples
This commit is contained in:
parent
776593ec71
commit
aae2e630b4
|
|
@ -1,16 +1,14 @@
|
||||||
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;
|
||||||
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;
|
||||||
using Microsoft.AspNet.Authentication.Cookies;
|
using Microsoft.AspNet.Authentication.Cookies;
|
||||||
using Microsoft.AspNet.Authentication.Google;
|
using Microsoft.AspNet.Authentication.Google;
|
||||||
using Microsoft.AspNet.Authentication.MicrosoftAccount;
|
using Microsoft.AspNet.Authentication.MicrosoftAccount;
|
||||||
using Microsoft.AspNet.Authentication.OAuth;
|
using Microsoft.AspNet.Authentication.OAuth;
|
||||||
|
using Microsoft.AspNet.Builder;
|
||||||
|
using Microsoft.AspNet.Http;
|
||||||
|
using Microsoft.AspNet.Http.Authentication;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
|
@ -18,26 +16,26 @@ namespace CookieSample
|
||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
|
public void ConfigureServices(IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddDataProtection();
|
||||||
|
services.Configure<ExternalAuthenticationOptions>(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)
|
public void Configure(IApplicationBuilder app)
|
||||||
{
|
{
|
||||||
app.UseErrorPage();
|
app.UseErrorPage();
|
||||||
|
|
||||||
app.UseServices(services =>
|
|
||||||
{
|
|
||||||
services.AddDataProtection();
|
|
||||||
services.Configure<ExternalAuthenticationOptions>(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 =>
|
app.UseCookieAuthentication(options =>
|
||||||
{
|
{
|
||||||
options.LoginPath = new PathString("/login");
|
options.LoginPath = new PathString("/login");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue