// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Authorization.Policy;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Microsoft.Extensions.DependencyInjection
{
///
/// Extension methods for setting up authorization services in an .
///
public static class PolicyServiceCollectionExtensions
{
///
/// Adds authorization policy services to the specified .
///
/// The to add services to.
/// The so that additional calls can be chained.
public static IServiceCollection AddAuthorizationPolicyEvaluator(this IServiceCollection services)
{
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
services.TryAdd(ServiceDescriptor.Transient());
return services;
}
}
}