AuthorizationBuilder Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Used to configure authorization
public class AuthorizationBuilder
type AuthorizationBuilder = class
Public Class AuthorizationBuilder
- Inheritance
-
AuthorizationBuilder
Constructors
AuthorizationBuilder(IServiceCollection) |
Initializes a new instance of AuthorizationBuilder. |
Properties
Services |
The services being configured. |
Methods
AddDefaultPolicy(String, Action<AuthorizationPolicyBuilder>) |
Add a policy that is built from a delegate with the provided name and used as the DefaultPolicy. |
AddDefaultPolicy(String, AuthorizationPolicy) |
Add a policy that is built from a delegate with the provided name and used as the default policy. |
AddFallbackPolicy(String, Action<AuthorizationPolicyBuilder>) |
Add a policy that is built from a delegate with the provided name and used as the FallbackPolicy. |
AddFallbackPolicy(String, AuthorizationPolicy) |
Add a policy that is built from a delegate with the provided name and used as the FallbackPolicy. |
AddPolicy(String, Action<AuthorizationPolicyBuilder>) |
Add a policy that is built from a delegate with the provided name. |
AddPolicy(String, AuthorizationPolicy) |
Adds a AuthorizationPolicy which can be used by IAuthorizationService. |
SetDefaultPolicy(AuthorizationPolicy) |
Sets the default authorization policy. Defaults to require authenticated users. |
SetFallbackPolicy(AuthorizationPolicy) |
Sets the fallback authorization policy used by CombineAsync(IAuthorizationPolicyProvider, IEnumerable<IAuthorizeData>) when no IAuthorizeData have been provided. As a result, the AuthorizationMiddleware uses the fallback policy if there are no IAuthorizeData instances for a resource. If a resource has any IAuthorizeData then they are evaluated instead of the fallback policy. By default the fallback policy is null, and usually will have no effect unless you have the AuthorizationMiddleware in your pipeline. It is not used in any way by the default IAuthorizationService. |
SetInvokeHandlersAfterFailure(Boolean) |
Determines whether authorization handlers should be invoked after HasFailed. Defaults to true. |