53 instantiations of CorsPolicy
Microsoft.AspNetCore.Cors (1)
Infrastructure\CorsPolicyBuilder.cs (1)
13
private readonly CorsPolicy _policy = new
CorsPolicy
();
Microsoft.AspNetCore.Cors.Test (51)
CorsMiddlewareTests.cs (2)
112
var policy = new
CorsPolicy
();
159
var policy = new
CorsPolicy
();
CorsOptionsTest.cs (6)
13
var expectedPolicy = new
CorsPolicy
();
16
corsOptions.AddPolicy("policy1", new
CorsPolicy
());
18
corsOptions.AddPolicy("policy3", new
CorsPolicy
());
30
var expectedPolicy = new
CorsPolicy
();
33
corsOptions.AddDefaultPolicy(new
CorsPolicy
());
57
corsOptions.AddPolicy("policy3", new
CorsPolicy
());
CorsPolicyBuilderTests.cs (2)
13
var originalPolicy = new
CorsPolicy
();
48
var originalPolicy = new
CorsPolicy
();
CorsPolicyExtensionsTests.cs (4)
13
var policy = new
CorsPolicy
();
33
var policy = new
CorsPolicy
();
51
var policy = new
CorsPolicy
();
72
var policy = new
CorsPolicy
();
CorsPolicyTests.cs (4)
12
var corsPolicy = new
CorsPolicy
();
32
var policy = new
CorsPolicy
();
45
var policy = new
CorsPolicy
();
63
var corsPolicy = new
CorsPolicy
CorsServiceTests.cs (31)
19
var policy = new
CorsPolicy
40
var result = corsService.EvaluatePolicy(requestContext, new
CorsPolicy
());
53
var policy = new
CorsPolicy
();
69
var policy = new
CorsPolicy
();
84
var policy = new
CorsPolicy
()
104
var policy = new
CorsPolicy
124
var policy = new
CorsPolicy
();
140
var policy = new
CorsPolicy
159
var policy = new
CorsPolicy
178
var policy = new
CorsPolicy
();
195
var policy = new
CorsPolicy
();
212
var policy = new
CorsPolicy
();
230
var policy = new
CorsPolicy
();
247
var policy = new
CorsPolicy
();
263
var policy = new
CorsPolicy
();
280
var policy = new
CorsPolicy
();
299
var policy = new
CorsPolicy
();
316
var policy = new
CorsPolicy
();
339
var policy = new
CorsPolicy
();
360
var policy = new
CorsPolicy
379
var policy = new
CorsPolicy
399
var policy = new
CorsPolicy
419
var policy = new
CorsPolicy
439
var policy = new
CorsPolicy
();
461
var policy = new
CorsPolicy
();
479
var policy = new
CorsPolicy
();
502
var policy = new
CorsPolicy
();
525
var policy = new
CorsPolicy
();
545
var policy = new
CorsPolicy
();
908
var policy = new
CorsPolicy
();
926
var policy = new
CorsPolicy
();
DefaultCorsPolicyProviderTests.cs (2)
16
var policy = new
CorsPolicy
();
36
var 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)
17
public CorsPolicyMetadata(
CorsPolicy
policy)
25
public
CorsPolicy
Policy { get; }
Infrastructure\CorsEndpointConventionBuilderExtensions.cs (1)
60
var
policy = policyBuilder.Build();
Infrastructure\CorsMiddleware.cs (7)
20
private readonly
CorsPolicy
? _policy;
65
/// <param name="policy">An instance of the <see cref="
CorsPolicy
"/> which can be applied.</param>
70
CorsPolicy
policy,
132
var
corsPolicy = _policy;
161
async Task InvokeCoreAwaited(HttpContext context, Task<
CorsPolicy
?> policyTask)
163
var
corsPolicy = await policyTask;
168
private Task EvaluateAndApplyPolicy(HttpContext context,
CorsPolicy
? corsPolicy)
Infrastructure\CorsOptions.cs (11)
15
internal 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>
34
public void AddDefaultPolicy(
CorsPolicy
policy)
56
/// <param name="policy">The <see cref="
CorsPolicy
"/> policy to be added.</param>
57
public void AddPolicy(string name,
CorsPolicy
policy)
77
var
policy = policyBuilder.Build();
86
/// <returns>The <see cref="
CorsPolicy
"/> if the policy was added.<c>null</c> otherwise.</returns>
87
public
CorsPolicy
? GetPolicy(string name)
Infrastructure\CorsPolicyBuilder.cs (9)
13
private readonly
CorsPolicy
_policy = new CorsPolicy();
29
public 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>
228
public
CorsPolicy
Build()
243
private CorsPolicyBuilder Combine(
CorsPolicy
policy)
Infrastructure\CorsPolicyExtensions.cs (1)
12
public static bool IsOriginAnAllowedSubdomain(this
CorsPolicy
policy, string origin)
Infrastructure\CorsService.cs (8)
48
var
policy = _options.GetPolicy(policyName);
58
public CorsResult EvaluatePolicy(HttpContext context,
CorsPolicy
policy)
97
private static void PopulateResult(HttpContext context,
CorsPolicy
policy, CorsResult result)
133
/// <param name="policy">The <see cref="
CorsPolicy
"/> to evaluate.</param>
135
public virtual void EvaluateRequest(HttpContext context,
CorsPolicy
policy, CorsResult result)
144
/// <param name="policy">The <see cref="
CorsPolicy
"/> to evaluate.</param>
146
public virtual void EvaluatePreflightRequest(HttpContext context,
CorsPolicy
policy, CorsResult result)
222
private bool IsOriginAllowed(
CorsPolicy
policy, StringValues origin)
Infrastructure\DefaultCorsPolicyProvider.cs (3)
12
private static readonly Task<
CorsPolicy
?> NullResult = Task.FromResult<
CorsPolicy
?>(null);
25
public Task<
CorsPolicy
?> GetPolicyAsync(HttpContext context, string? policyName)
Infrastructure\ICorsPolicyMetadata.cs (1)
14
CorsPolicy
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>
19
Task<
CorsPolicy
?> GetPolicyAsync(HttpContext context, string? policyName);
Infrastructure\ICorsService.cs (2)
17
/// <param name="policy">The <see cref="
CorsPolicy
"/> which needs to be evaluated.</param>
20
CorsResult EvaluatePolicy(HttpContext context,
CorsPolicy
policy);
Microsoft.AspNetCore.Cors.Test (88)
CorsMiddlewareTests.cs (20)
112
var
policy = new CorsPolicy();
159
var
policy = new CorsPolicy();
224
var
policy = new CorsPolicyBuilder(OriginUrl)
382
.Returns(Task.FromResult<
CorsPolicy
>(null))
411
.Returns(Task.FromResult<
CorsPolicy
>(null))
644
var
policy = new CorsPolicyBuilder()
689
.Returns(Task.FromResult<
CorsPolicy
>(null))
719
.Returns(Task.FromResult<
CorsPolicy
>(null))
799
Mock.Get(corsService).Verify(v => v.EvaluatePolicy(It.IsAny<HttpContext>(), It.IsAny<
CorsPolicy
>()), Times.Never());
806
var
policy = new CorsPolicyBuilder().Build();
811
.Returns(Task.FromResult<
CorsPolicy
>(null))
837
var
defaultPolicy = new CorsPolicyBuilder().Build();
838
var
metadataPolicy = new CorsPolicyBuilder().Build();
843
.Returns(Task.FromResult<
CorsPolicy
>(null))
845
mockCorsService.Setup(o => o.EvaluatePolicy(It.IsAny<HttpContext>(), It.IsAny<
CorsPolicy
>()))
875
var
policy = new CorsPolicyBuilder().Build();
880
.Returns(Task.FromResult<
CorsPolicy
>(null))
882
mockCorsService.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)
13
var
expectedPolicy = new CorsPolicy();
21
var
actualPolicy = corsOptions.GetPolicy(corsOptions.DefaultPolicyName);
30
var
expectedPolicy = new CorsPolicy();
37
var
actualPolicy = corsOptions.GetPolicy(corsOptions.DefaultPolicyName);
46
CorsPolicy
expectedPolicy = null;
60
var
actualPolicy = corsOptions.GetPolicy(corsOptions.DefaultPolicyName);
CorsPolicyBuilderTests.cs (20)
13
var
originalPolicy = new CorsPolicy();
26
var
corsPolicy = builder.Build();
48
var
originalPolicy = new CorsPolicy();
55
var
corsPolicy = builder.Build();
75
var
corsPolicy = builder.Build();
99
var
corsPolicy = builder.Build();
121
var
corsPolicy = builder.Build();
133
var
corsPolicy = builder.Build();
169
var
corsPolicy = builder.Build();
185
var
corsPolicy = builder.Build();
199
var
corsPolicy = builder.Build();
213
var
corsPolicy = builder.Build();
227
var
corsPolicy = builder.Build();
242
var
corsPolicy = builder.Build();
257
var
corsPolicy = builder.Build();
272
var
corsPolicy = builder.Build();
287
var
corsPolicy = builder.Build();
301
var
corsPolicy = builder.Build();
315
var
corsPolicy = builder.Build();
329
var
corsPolicy = builder.Build();
CorsPolicyExtensionsTests.cs (4)
13
var
policy = new CorsPolicy();
33
var
policy = new CorsPolicy();
51
var
policy = new CorsPolicy();
72
var
policy = new CorsPolicy();
CorsPolicyTests.cs (4)
12
var
corsPolicy = new CorsPolicy();
32
var
policy = new CorsPolicy();
45
var
policy = new CorsPolicy();
63
var
corsPolicy = new CorsPolicy
CorsServiceTests.cs (30)
19
var
policy = new CorsPolicy
53
var
policy = new CorsPolicy();
69
var
policy = new CorsPolicy();
84
var
policy = new CorsPolicy()
104
var
policy = new CorsPolicy
124
var
policy = new CorsPolicy();
140
var
policy = new CorsPolicy
159
var
policy = new CorsPolicy
178
var
policy = new CorsPolicy();
195
var
policy = new CorsPolicy();
212
var
policy = new CorsPolicy();
230
var
policy = new CorsPolicy();
247
var
policy = new CorsPolicy();
263
var
policy = new CorsPolicy();
280
var
policy = new CorsPolicy();
299
var
policy = new CorsPolicy();
316
var
policy = new CorsPolicy();
339
var
policy = new CorsPolicy();
360
var
policy = new CorsPolicy
379
var
policy = new CorsPolicy
399
var
policy = new CorsPolicy
419
var
policy = new CorsPolicy
439
var
policy = new CorsPolicy();
461
var
policy = new CorsPolicy();
479
var
policy = new CorsPolicy();
502
var
policy = new CorsPolicy();
525
var
policy = new CorsPolicy();
545
var
policy = new CorsPolicy();
908
var
policy = new CorsPolicy();
926
var
policy = new CorsPolicy();
DefaultCorsPolicyProviderTests.cs (4)
16
var
policy = new CorsPolicy();
23
var
actualPolicy = await policyProvider.GetPolicyAsync(new DefaultHttpContext(), policyName: null);
36
var
policy = new CorsPolicy();
43
var
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
"/>.
78
var
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
>()))