Skip to content

Commit a1778f7

Browse files
committed
fixes #51
1 parent 6686052 commit a1778f7

File tree

3 files changed

+5
-43
lines changed

3 files changed

+5
-43
lines changed

samples/WebApi Custom Handler/CustomAuthorizationDependenciesFactory.cs

Lines changed: 0 additions & 40 deletions
This file was deleted.

samples/WebApi Custom Handler/Startup.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Web.Http;
55
using Microsoft.Owin;
66
using Microsoft.Owin.Logging;
7+
using Microsoft.Owin.Security.Authorization;
78
using Microsoft.Owin.Security.Authorization.Infrastructure;
89
using Owin;
910
using WebApi_Custom_Handler;
@@ -30,8 +31,10 @@ public void Configuration(IAppBuilder app)
3031
policyBuilder.AddRequirements(new EmployeeNumber2Requirement());
3132
});
3233

33-
var loggerFactory = app.GetLoggerFactory();
34-
options.DependenciesFactory = new CustomAuthorizationDependenciesFactory(loggerFactory, new EmployeeNumber2Handler());
34+
var policyProvider = new CustomAuthorizationPolicyProvider(options);
35+
options.Dependencies.LoggerFactory = app.GetLoggerFactory();
36+
options.Dependencies.PolicyProvider = policyProvider;
37+
options.Dependencies.Service = new DefaultAuthorizationService(policyProvider, new []{ new EmployeeNumber2Handler()});
3538
});
3639

3740
app.UseWebApi(config);

samples/WebApi Custom Handler/WebApi Custom Handler.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@
121121
<ItemGroup>
122122
<Compile Include="App_Start\WebApiConfig.cs" />
123123
<Compile Include="Controllers\ExampleController.cs" />
124-
<Compile Include="CustomAuthorizationDependenciesFactory.cs" />
125124
<Compile Include="CustomAuthorizationPolicyProvider.cs" />
126125
<Compile Include="ExampleConstants.cs" />
127126
<Compile Include="Models\EmployeeNumber2Handler.cs" />

0 commit comments

Comments
 (0)