Esempio n. 1
0
        /// <summary>
        /// Looks up a policy using the <paramref name="policyName"/> and then evaluates the policy using the passed in
        /// <paramref name="context"/>.
        /// </summary>
        /// <param name="requestContext"></param>
        /// <param name="policyName"></param>
        /// <returns>A <see cref="CorsResult"/> which contains the result of policy evaluation and can be
        /// used by the caller to set apporpriate response headers.</returns>
        public CorsResult EvaluatePolicy([NotNull] HttpContext context, string policyName)
        {
            var policy = _options.GetPolicy(policyName);

            return(EvaluatePolicy(context, policy));
        }
Esempio n. 2
0
 /// <inheritdoc />
 public Task <CorsPolicy> GetPolicyAsync(HttpContext context, string policyName)
 {
     return(Task.FromResult(_options.GetPolicy(policyName ?? _options.DefaultPolicyName)));
 }