// 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 System.Threading.Tasks; using Microsoft.Extensions.Options; namespace Microsoft.AspNetCore.Authorization { /// /// A type which can provide a for a particular name. /// public class DefaultAuthorizationPolicyProvider : IAuthorizationPolicyProvider { private readonly AuthorizationOptions _options; public DefaultAuthorizationPolicyProvider(IOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } _options = options.Value; } /// /// Gets a from the given /// /// /// public virtual Task GetPolicyAsync(string policyName) { return Task.FromResult(_options.GetPolicy(policyName)); } } }