53 instantiations of CorsPolicy
Microsoft.AspNetCore.Cors (1)
Infrastructure\CorsPolicyBuilder.cs (1)
13private readonly CorsPolicy _policy = new CorsPolicy();
Microsoft.AspNetCore.Cors.Test (51)
CorsMiddlewareTests.cs (2)
112var policy = new CorsPolicy(); 159var policy = new CorsPolicy();
CorsOptionsTest.cs (6)
13var expectedPolicy = new CorsPolicy(); 16corsOptions.AddPolicy("policy1", new CorsPolicy()); 18corsOptions.AddPolicy("policy3", new CorsPolicy()); 30var expectedPolicy = new CorsPolicy(); 33corsOptions.AddDefaultPolicy(new CorsPolicy()); 57corsOptions.AddPolicy("policy3", new CorsPolicy());
CorsPolicyBuilderTests.cs (2)
13var originalPolicy = new CorsPolicy(); 48var originalPolicy = new CorsPolicy();
CorsPolicyExtensionsTests.cs (4)
13var policy = new CorsPolicy(); 33var policy = new CorsPolicy(); 51var policy = new CorsPolicy(); 72var policy = new CorsPolicy();
CorsPolicyTests.cs (4)
12var corsPolicy = new CorsPolicy(); 32var policy = new CorsPolicy(); 45var policy = new CorsPolicy(); 63var corsPolicy = new CorsPolicy
CorsServiceTests.cs (31)
19var policy = new CorsPolicy 40var result = corsService.EvaluatePolicy(requestContext, new CorsPolicy()); 53var policy = new CorsPolicy(); 69var policy = new CorsPolicy(); 84var policy = new CorsPolicy() 104var policy = new CorsPolicy 124var policy = new CorsPolicy(); 140var policy = new CorsPolicy 159var policy = new CorsPolicy 178var policy = new CorsPolicy(); 195var policy = new CorsPolicy(); 212var policy = new CorsPolicy(); 230var policy = new CorsPolicy(); 247var policy = new CorsPolicy(); 263var policy = new CorsPolicy(); 280var policy = new CorsPolicy(); 299var policy = new CorsPolicy(); 316var policy = new CorsPolicy(); 339var policy = new CorsPolicy(); 360var policy = new CorsPolicy 379var policy = new CorsPolicy 399var policy = new CorsPolicy 419var policy = new CorsPolicy 439var policy = new CorsPolicy(); 461var policy = new CorsPolicy(); 479var policy = new CorsPolicy(); 502var policy = new CorsPolicy(); 525var policy = new CorsPolicy(); 545var policy = new CorsPolicy(); 908var policy = new CorsPolicy(); 926var policy = new CorsPolicy();
DefaultCorsPolicyProviderTests.cs (2)
16var policy = new CorsPolicy(); 36var policy = new CorsPolicy();
Microsoft.AspNetCore.Mvc.Cors.Test (1)
CorsAuthorizationFilterTest.cs (1)
121.Returns(Task.FromResult(new CorsPolicy()));
142 references to CorsPolicy
Microsoft.AspNetCore.Cors (49)
CorsPolicyMetadata.cs (2)
17public CorsPolicyMetadata(CorsPolicy policy) 25public CorsPolicy Policy { get; }
Infrastructure\CorsEndpointConventionBuilderExtensions.cs (1)
60var policy = policyBuilder.Build();
Infrastructure\CorsMiddleware.cs (7)
20private readonly CorsPolicy? _policy; 65/// <param name="policy">An instance of the <see cref="CorsPolicy"/> which can be applied.</param> 70CorsPolicy policy, 132var corsPolicy = _policy; 161async Task InvokeCoreAwaited(HttpContext context, Task<CorsPolicy?> policyTask) 163var corsPolicy = await policyTask; 168private Task EvaluateAndApplyPolicy(HttpContext context, CorsPolicy? corsPolicy)
Infrastructure\CorsOptions.cs (11)
15internal IDictionary<string, (CorsPolicy policy, Task<CorsPolicy> policyTask)> PolicyMap { get; } 16= new Dictionary<string, (CorsPolicy, Task<CorsPolicy>)>(StringComparer.Ordinal); 33/// <param name="policy">The <see cref="CorsPolicy"/> policy to be added.</param> 34public void AddDefaultPolicy(CorsPolicy policy) 56/// <param name="policy">The <see cref="CorsPolicy"/> policy to be added.</param> 57public void AddPolicy(string name, CorsPolicy policy) 77var policy = policyBuilder.Build(); 86/// <returns>The <see cref="CorsPolicy"/> if the policy was added.<c>null</c> otherwise.</returns> 87public CorsPolicy? GetPolicy(string name)
Infrastructure\CorsPolicyBuilder.cs (9)
13private readonly CorsPolicy _policy = new CorsPolicy(); 29public CorsPolicyBuilder(CorsPolicy policy) 40/// This method normalizes the origin value prior to adding it to <see cref="CorsPolicy.Origins"/> to match 46/// Finally, the scheme and punycoded host name are culture invariant lower cased before being added to the <see cref="CorsPolicy.Origins"/> 213/// Sets the <see cref="CorsPolicy.IsOriginAllowed"/> property of the policy to be a function 225/// Builds a new <see cref="CorsPolicy"/> using the entries added. 227/// <returns>The constructed <see cref="CorsPolicy"/>.</returns> 228public CorsPolicy Build() 243private CorsPolicyBuilder Combine(CorsPolicy policy)
Infrastructure\CorsPolicyExtensions.cs (1)
12public static bool IsOriginAnAllowedSubdomain(this CorsPolicy policy, string origin)
Infrastructure\CorsService.cs (8)
48var policy = _options.GetPolicy(policyName); 58public CorsResult EvaluatePolicy(HttpContext context, CorsPolicy policy) 97private static void PopulateResult(HttpContext context, CorsPolicy policy, CorsResult result) 133/// <param name="policy">The <see cref="CorsPolicy"/> to evaluate.</param> 135public virtual void EvaluateRequest(HttpContext context, CorsPolicy policy, CorsResult result) 144/// <param name="policy">The <see cref="CorsPolicy"/> to evaluate.</param> 146public virtual void EvaluatePreflightRequest(HttpContext context, CorsPolicy policy, CorsResult result) 222private bool IsOriginAllowed(CorsPolicy policy, StringValues origin)
Infrastructure\DefaultCorsPolicyProvider.cs (3)
12private static readonly Task<CorsPolicy?> NullResult = Task.FromResult<CorsPolicy?>(null); 25public Task<CorsPolicy?> GetPolicyAsync(HttpContext context, string? policyName)
Infrastructure\ICorsPolicyMetadata.cs (1)
14CorsPolicy Policy { get; }
Infrastructure\ICorsPolicyProvider.cs (4)
9/// A type which can provide a <see cref="CorsPolicy"/> for a particular <see cref="HttpContext"/>. 14/// Gets a <see cref="CorsPolicy"/> from the given <paramref name="context"/> 18/// <returns>A <see cref="CorsPolicy"/></returns> 19Task<CorsPolicy?> GetPolicyAsync(HttpContext context, string? policyName);
Infrastructure\ICorsService.cs (2)
17/// <param name="policy">The <see cref="CorsPolicy"/> which needs to be evaluated.</param> 20CorsResult EvaluatePolicy(HttpContext context, CorsPolicy policy);
Microsoft.AspNetCore.Cors.Test (88)
CorsMiddlewareTests.cs (20)
112var policy = new CorsPolicy(); 159var policy = new CorsPolicy(); 224var policy = new CorsPolicyBuilder(OriginUrl) 382.Returns(Task.FromResult<CorsPolicy>(null)) 411.Returns(Task.FromResult<CorsPolicy>(null)) 644var policy = new CorsPolicyBuilder() 689.Returns(Task.FromResult<CorsPolicy>(null)) 719.Returns(Task.FromResult<CorsPolicy>(null)) 799Mock.Get(corsService).Verify(v => v.EvaluatePolicy(It.IsAny<HttpContext>(), It.IsAny<CorsPolicy>()), Times.Never()); 806var policy = new CorsPolicyBuilder().Build(); 811.Returns(Task.FromResult<CorsPolicy>(null)) 837var defaultPolicy = new CorsPolicyBuilder().Build(); 838var metadataPolicy = new CorsPolicyBuilder().Build(); 843.Returns(Task.FromResult<CorsPolicy>(null)) 845mockCorsService.Setup(o => o.EvaluatePolicy(It.IsAny<HttpContext>(), It.IsAny<CorsPolicy>())) 875var policy = new CorsPolicyBuilder().Build(); 880.Returns(Task.FromResult<CorsPolicy>(null)) 882mockCorsService.Setup(o => o.EvaluatePolicy(It.IsAny<HttpContext>(), It.IsAny<CorsPolicy>())) 916.Returns(Task.FromResult<CorsPolicy>(null)) 946.Returns(Task.FromResult<CorsPolicy>(null))
CorsOptionsTest.cs (6)
13var expectedPolicy = new CorsPolicy(); 21var actualPolicy = corsOptions.GetPolicy(corsOptions.DefaultPolicyName); 30var expectedPolicy = new CorsPolicy(); 37var actualPolicy = corsOptions.GetPolicy(corsOptions.DefaultPolicyName); 46CorsPolicy expectedPolicy = null; 60var actualPolicy = corsOptions.GetPolicy(corsOptions.DefaultPolicyName);
CorsPolicyBuilderTests.cs (20)
13var originalPolicy = new CorsPolicy(); 26var corsPolicy = builder.Build(); 48var originalPolicy = new CorsPolicy(); 55var corsPolicy = builder.Build(); 75var corsPolicy = builder.Build(); 99var corsPolicy = builder.Build(); 121var corsPolicy = builder.Build(); 133var corsPolicy = builder.Build(); 169var corsPolicy = builder.Build(); 185var corsPolicy = builder.Build(); 199var corsPolicy = builder.Build(); 213var corsPolicy = builder.Build(); 227var corsPolicy = builder.Build(); 242var corsPolicy = builder.Build(); 257var corsPolicy = builder.Build(); 272var corsPolicy = builder.Build(); 287var corsPolicy = builder.Build(); 301var corsPolicy = builder.Build(); 315var corsPolicy = builder.Build(); 329var corsPolicy = builder.Build();
CorsPolicyExtensionsTests.cs (4)
13var policy = new CorsPolicy(); 33var policy = new CorsPolicy(); 51var policy = new CorsPolicy(); 72var policy = new CorsPolicy();
CorsPolicyTests.cs (4)
12var corsPolicy = new CorsPolicy(); 32var policy = new CorsPolicy(); 45var policy = new CorsPolicy(); 63var corsPolicy = new CorsPolicy
CorsServiceTests.cs (30)
19var policy = new CorsPolicy 53var policy = new CorsPolicy(); 69var policy = new CorsPolicy(); 84var policy = new CorsPolicy() 104var policy = new CorsPolicy 124var policy = new CorsPolicy(); 140var policy = new CorsPolicy 159var policy = new CorsPolicy 178var policy = new CorsPolicy(); 195var policy = new CorsPolicy(); 212var policy = new CorsPolicy(); 230var policy = new CorsPolicy(); 247var policy = new CorsPolicy(); 263var policy = new CorsPolicy(); 280var policy = new CorsPolicy(); 299var policy = new CorsPolicy(); 316var policy = new CorsPolicy(); 339var policy = new CorsPolicy(); 360var policy = new CorsPolicy 379var policy = new CorsPolicy 399var policy = new CorsPolicy 419var policy = new CorsPolicy 439var policy = new CorsPolicy(); 461var policy = new CorsPolicy(); 479var policy = new CorsPolicy(); 502var policy = new CorsPolicy(); 525var policy = new CorsPolicy(); 545var policy = new CorsPolicy(); 908var policy = new CorsPolicy(); 926var policy = new CorsPolicy();
DefaultCorsPolicyProviderTests.cs (4)
16var policy = new CorsPolicy(); 23var actualPolicy = await policyProvider.GetPolicyAsync(new DefaultHttpContext(), policyName: null); 36var policy = new CorsPolicy(); 43var actualPolicy = await policyProvider.GetPolicyAsync(new DefaultHttpContext(), policyName);
Microsoft.AspNetCore.Mvc.Cors (3)
CorsAuthorizationFilter.cs (3)
14/// A filter that applies the given <see cref="CorsPolicy"/> and adds appropriate response headers. 53/// The policy name used to fetch a <see cref="CorsPolicy"/>. 78var policy = await _corsPolicyProvider.GetPolicyAsync(httpContext, PolicyName);
Microsoft.AspNetCore.Mvc.Cors.Test (2)
CorsAuthorizationFilterTest.cs (2)
171.Setup(o => o.EvaluatePolicy(It.IsAny<HttpContext>(), It.IsAny<CorsPolicy>())) 188.Setup(o => o.EvaluatePolicy(It.IsAny<HttpContext>(), It.IsAny<CorsPolicy>()))