AuthorizationEndpointConventionBuilderExtensions.RequireAuthorization Method
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.
Overloads
RequireAuthorization<TBuilder>(TBuilder) |
Adds the default authorization policy to the endpoint(s). |
RequireAuthorization<TBuilder>(TBuilder, AuthorizationPolicy) |
Adds an authorization policy to the endpoint(s). |
RequireAuthorization<TBuilder>(TBuilder, IAuthorizeData[]) |
Adds authorization policies with the specified IAuthorizeData to the endpoint(s). |
RequireAuthorization<TBuilder>(TBuilder, Action<AuthorizationPolicyBuilder>) |
Adds an new authorization policy configured by a callback to the endpoint(s). |
RequireAuthorization<TBuilder>(TBuilder, String[]) |
Adds authorization policies with the specified names to the endpoint(s). |
RequireAuthorization<TBuilder>(TBuilder)
Adds the default authorization policy to the endpoint(s).
public:
generic <typename TBuilder>
where TBuilder : Microsoft::AspNetCore::Builder::IEndpointConventionBuilder[System::Runtime::CompilerServices::Extension]
static TBuilder RequireAuthorization(TBuilder builder);
public static TBuilder RequireAuthorization<TBuilder> (this TBuilder builder) where TBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder;
static member RequireAuthorization : 'Builder -> 'Builder (requires 'Builder :> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder)
<Extension()>
Public Function RequireAuthorization(Of TBuilder As IEndpointConventionBuilder) (builder As TBuilder) As TBuilder
Type Parameters
- TBuilder
Parameters
- builder
- TBuilder
The endpoint convention builder.
Returns
The original convention builder parameter.
Applies to
RequireAuthorization<TBuilder>(TBuilder, AuthorizationPolicy)
Adds an authorization policy to the endpoint(s).
public static TBuilder RequireAuthorization<TBuilder> (this TBuilder builder, Microsoft.AspNetCore.Authorization.AuthorizationPolicy policy) where TBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder;
static member RequireAuthorization : 'Builder * Microsoft.AspNetCore.Authorization.AuthorizationPolicy -> 'Builder (requires 'Builder :> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder)
<Extension()>
Public Function RequireAuthorization(Of TBuilder As IEndpointConventionBuilder) (builder As TBuilder, policy As AuthorizationPolicy) As TBuilder
Type Parameters
- TBuilder
Parameters
- builder
- TBuilder
The endpoint convention builder.
- policy
- AuthorizationPolicy
The AuthorizationPolicy policy.
Returns
The original convention builder parameter.
Applies to
RequireAuthorization<TBuilder>(TBuilder, IAuthorizeData[])
Adds authorization policies with the specified IAuthorizeData to the endpoint(s).
public:
generic <typename TBuilder>
where TBuilder : Microsoft::AspNetCore::Builder::IEndpointConventionBuilder[System::Runtime::CompilerServices::Extension]
static TBuilder RequireAuthorization(TBuilder builder, ... cli::array <Microsoft::AspNetCore::Authorization::IAuthorizeData ^> ^ authorizeData);
public static TBuilder RequireAuthorization<TBuilder> (this TBuilder builder, params Microsoft.AspNetCore.Authorization.IAuthorizeData[] authorizeData) where TBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder;
static member RequireAuthorization : 'Builder * Microsoft.AspNetCore.Authorization.IAuthorizeData[] -> 'Builder (requires 'Builder :> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder)
<Extension()>
Public Function RequireAuthorization(Of TBuilder As IEndpointConventionBuilder) (builder As TBuilder, ParamArray authorizeData As IAuthorizeData()) As TBuilder
Type Parameters
- TBuilder
Parameters
- builder
- TBuilder
The endpoint convention builder.
- authorizeData
- IAuthorizeData[]
A collection of authorizeData
. If empty, the default authorization policy will be used.
Returns
The original convention builder parameter.
Applies to
RequireAuthorization<TBuilder>(TBuilder, Action<AuthorizationPolicyBuilder>)
Adds an new authorization policy configured by a callback to the endpoint(s).
public static TBuilder RequireAuthorization<TBuilder> (this TBuilder builder, Action<Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder> configurePolicy) where TBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder;
static member RequireAuthorization : 'Builder * Action<Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder> -> 'Builder (requires 'Builder :> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder)
<Extension()>
Public Function RequireAuthorization(Of TBuilder As IEndpointConventionBuilder) (builder As TBuilder, configurePolicy As Action(Of AuthorizationPolicyBuilder)) As TBuilder
Type Parameters
- TBuilder
Parameters
- builder
- TBuilder
The endpoint convention builder.
- configurePolicy
- Action<AuthorizationPolicyBuilder>
The callback used to configure the policy.
Returns
The original convention builder parameter.
Applies to
RequireAuthorization<TBuilder>(TBuilder, String[])
Adds authorization policies with the specified names to the endpoint(s).
public:
generic <typename TBuilder>
where TBuilder : Microsoft::AspNetCore::Builder::IEndpointConventionBuilder[System::Runtime::CompilerServices::Extension]
static TBuilder RequireAuthorization(TBuilder builder, ... cli::array <System::String ^> ^ policyNames);
public static TBuilder RequireAuthorization<TBuilder> (this TBuilder builder, params string[] policyNames) where TBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder;
static member RequireAuthorization : 'Builder * string[] -> 'Builder (requires 'Builder :> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder)
<Extension()>
Public Function RequireAuthorization(Of TBuilder As IEndpointConventionBuilder) (builder As TBuilder, ParamArray policyNames As String()) As TBuilder
Type Parameters
- TBuilder
Parameters
- builder
- TBuilder
The endpoint convention builder.
- policyNames
- String[]
A collection of policy names. If empty, the default authorization policy will be used.
Returns
The original convention builder parameter.