Make AddAuthorization() idempotent
Found this issue which looking into making AddMvc() idempotent. You'll end up with multiple pass-through handlers registered if two components call AddAuthorization(). This is very possible to happen if used two frameworks in the same app.
This commit is contained in:
parent
d2701f4897
commit
831785fe9f
|
|
@ -14,7 +14,7 @@ namespace Microsoft.Framework.DependencyInjection
|
||||||
{
|
{
|
||||||
services.AddOptions();
|
services.AddOptions();
|
||||||
services.TryAdd(ServiceDescriptor.Transient<IAuthorizationService, DefaultAuthorizationService>());
|
services.TryAdd(ServiceDescriptor.Transient<IAuthorizationService, DefaultAuthorizationService>());
|
||||||
services.AddTransient<IAuthorizationHandler, PassThroughAuthorizationHandler>();
|
services.TryAddEnumerable(ServiceDescriptor.Transient<IAuthorizationHandler, PassThroughAuthorizationHandler>());
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue