Update based on new API changes
This commit is contained in:
parent
689bdf2072
commit
9726a26056
|
|
@ -6,6 +6,7 @@ using Microsoft.AspNet.DependencyInjection;
|
|||
using Microsoft.AspNet.DependencyInjection.Fallback;
|
||||
using Microsoft.AspNet.Logging;
|
||||
using Microsoft.AspNet.Security.Cookies;
|
||||
using Microsoft.AspNet.RequestContainer;
|
||||
|
||||
namespace CookieSample
|
||||
{
|
||||
|
|
@ -13,15 +14,16 @@ namespace CookieSample
|
|||
{
|
||||
public void Configuration(IBuilder app)
|
||||
{
|
||||
// TODO: Move to host.
|
||||
var serviceCollection = new ServiceCollection();
|
||||
serviceCollection.AddInstance<ILoggerFactory>(new NullLoggerFactory());
|
||||
app.ServiceProvider = serviceCollection.BuildServiceProvider(app.ServiceProvider);
|
||||
app.UseServices(services =>
|
||||
{
|
||||
// TODO: Move to host.
|
||||
services.AddInstance<ILoggerFactory>(new NullLoggerFactory());
|
||||
});
|
||||
|
||||
app.UseCookieAuthentication(new CookieAuthenticationOptions()
|
||||
{
|
||||
{
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
app.Run(async context =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
"Microsoft.AspNet.Security": "",
|
||||
"Microsoft.AspNet.Security.Cookies": "",
|
||||
"Microsoft.AspNet.Hosting": "0.1-alpha-*",
|
||||
"Microsoft.AspNet.RequestContainer": "0.1-alpha-*",
|
||||
"Microsoft.AspNet.PipelineCore": "0.1-alpha-*",
|
||||
"Microsoft.AspNet.Abstractions": "0.1-alpha-*",
|
||||
"Microsoft.AspNet.FeatureModel": "0.1-alpha-*",
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ namespace Microsoft.AspNet
|
|||
public static IBuilder UseCookieAuthentication([NotNull] this IBuilder app, [NotNull] CookieAuthenticationOptions options)
|
||||
{
|
||||
// TODO: Use UseMiddleware to inject dependencies once it can discover Invoke from a base class.
|
||||
var dataProtectionProvider = app.ServiceProvider.GetService<IDataProtectionProvider>();
|
||||
var loggerFactory = app.ServiceProvider.GetService<ILoggerFactory>();
|
||||
var dataProtectionProvider = app.ApplicationServices.GetService<IDataProtectionProvider>();
|
||||
var loggerFactory = app.ApplicationServices.GetService<ILoggerFactory>();
|
||||
return app.Use(next => new CookieAuthenticationMiddleware(next, dataProtectionProvider, loggerFactory, options).Invoke);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue