4 instantiations of PolicyAuthorizationResult
Microsoft.AspNetCore.Authorization.Policy (4)
PolicyAuthorizationResult.cs (4)
11private static readonly PolicyAuthorizationResult _challengedResult = new() { Challenged = true }; 12private static readonly PolicyAuthorizationResult _forbiddenResult = new() { Forbidden = true }; 13private static readonly PolicyAuthorizationResult _succeededResult = new() { Succeeded = true }; 57: new PolicyAuthorizationResult { Forbidden = true, AuthorizationFailure = authorizationFailure };
56 references to PolicyAuthorizationResult
Aspire.Dashboard (8)
Authentication\AspirePolicyEvaluator.cs (8)
102/// <returns>Returns <see cref="PolicyAuthorizationResult.Success"/> if authorization succeeds. 103/// Otherwise returns <see cref="PolicyAuthorizationResult.Forbid(AuthorizationFailure)"/> if <see cref="AuthenticateResult.Succeeded"/>, otherwise 104/// returns <see cref="PolicyAuthorizationResult.Challenge"/></returns> 105public virtual async Task<PolicyAuthorizationResult> AuthorizeAsync(AuthorizationPolicy policy, AuthenticateResult authenticationResult, HttpContext context, object? resource) 111return PolicyAuthorizationResult.Forbid(); 117return PolicyAuthorizationResult.Success(); 122? PolicyAuthorizationResult.Forbid(result.Failure) 123: PolicyAuthorizationResult.Challenge();
CustomAuthorizationFailureResponse (1)
Authorization\SampleAuthorizationMiddlewareResultHandler.cs (1)
29PolicyAuthorizationResult policyAuthorizationResult)
Microsoft.AspNetCore.Authorization.Policy (25)
AuthorizationMiddleware.cs (1)
193var authorizeResult = await policyEvaluator.AuthorizeAsync(policy, authenticateResult!, context, resource);
AuthorizationMiddlewareResultHandler.cs (1)
15public Task HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
IAuthorizationMiddlewareResultHandler.cs (1)
23Task HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult);
IPolicyEvaluator.cs (4)
34/// <returns>Returns <see cref="PolicyAuthorizationResult.Success"/> if authorization succeeds. 35/// Otherwise returns <see cref="PolicyAuthorizationResult.Forbid(AuthorizationFailure)"/> if <see cref="AuthenticateResult.Succeeded"/>, otherwise 36/// returns <see cref="PolicyAuthorizationResult.Challenge"/></returns> 37Task<PolicyAuthorizationResult> AuthorizeAsync(AuthorizationPolicy policy, AuthenticateResult authenticationResult, HttpContext context, object? resource);
PolicyAuthorizationResult.cs (11)
11private static readonly PolicyAuthorizationResult _challengedResult = new() { Challenged = true }; 12private static readonly PolicyAuthorizationResult _forbiddenResult = new() { Forbidden = true }; 13private static readonly PolicyAuthorizationResult _succeededResult = new() { Succeeded = true }; 40/// <returns>The <see cref="PolicyAuthorizationResult"/>.</returns> 41public static PolicyAuthorizationResult Challenge() => _challengedResult; 46/// <returns>The <see cref="PolicyAuthorizationResult"/>.</returns> 47public static PolicyAuthorizationResult Forbid() => _forbiddenResult; 53/// <returns>The <see cref="PolicyAuthorizationResult"/>.</returns> 54public static PolicyAuthorizationResult Forbid(AuthorizationFailure? authorizationFailure) 62/// <returns>The <see cref="PolicyAuthorizationResult"/>.</returns> 63public static PolicyAuthorizationResult Success() => _succeededResult;
PolicyEvaluator.cs (7)
91/// <returns>Returns <see cref="PolicyAuthorizationResult.Success"/> if authorization succeeds. 92/// Otherwise returns <see cref="PolicyAuthorizationResult.Forbid(AuthorizationFailure)"/> if <see cref="AuthenticateResult.Succeeded"/>, otherwise 93/// returns <see cref="PolicyAuthorizationResult.Challenge"/></returns> 94public virtual async Task<PolicyAuthorizationResult> AuthorizeAsync(AuthorizationPolicy policy, AuthenticateResult authenticationResult, HttpContext context, object? resource) 101return PolicyAuthorizationResult.Success(); 106? PolicyAuthorizationResult.Forbid(result.Failure) 107: PolicyAuthorizationResult.Challenge();
Microsoft.AspNetCore.Authorization.Test (20)
AuthorizationMiddlewareResultHandlerTests.cs (14)
20var policyAuthorizationResult = PolicyAuthorizationResult.Success(); 34var policyAuthorizationResult = PolicyAuthorizationResult.Challenge(); 48var policyAuthorizationResult = PolicyAuthorizationResult.Forbid(); 69var policyAuthorizationResult = PolicyAuthorizationResult.Challenge(); 87var policyAuthorizationResult = PolicyAuthorizationResult.Challenge(); 108var policyAuthorizationResult = PolicyAuthorizationResult.Forbid(); 126var policyAuthorizationResult = PolicyAuthorizationResult.Forbid();
PolicyEvaluatorTests.cs (6)
77var result = await evaluator.AuthorizeAsync(policy, AuthenticateResult.Fail("Nooo"), context, resource: null); 95var result = await evaluator.AuthorizeAsync(policy, success, context, resource: null); 96var result2 = await evaluator.AuthorizeAsync(policy, success, context, resource: new object()); 112var result = await evaluator.AuthorizeAsync(policy, AuthenticateResult.Fail("Nooo"), context, resource: null); 129var result = await evaluator.AuthorizeAsync(policy, AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(), "scheme")), context, resource: null); 149var result = await evaluator.AuthorizeAsync(policy, AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(), "scheme")), context, resource: null);
Microsoft.AspNetCore.Mvc.Core (1)
Authorization\AuthorizeFilter.cs (1)
185var authorizeResult = await policyEvaluator.AuthorizeAsync(effectivePolicy, authenticateResult, context.HttpContext, context);
SecurityWebSite (1)
CountingPolicyEvaluator.cs (1)
16public override Task<PolicyAuthorizationResult> AuthorizeAsync(AuthorizationPolicy policy, AuthenticateResult authenticationResult, HttpContext context, object resource)