AuthorizationPolicyBuilder.RequireRole 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
RequireRole(String[]) |
Adds a RolesAuthorizationRequirement to the current instance which enforces that the current user must have at least one of the specified roles. |
RequireRole(IEnumerable<String>) |
Adds a RolesAuthorizationRequirement to the current instance which enforces that the current user must have at least one of the specified roles. |
RequireRole(String[])
Adds a RolesAuthorizationRequirement to the current instance which enforces that the current user must have at least one of the specified roles.
public:
Microsoft::AspNetCore::Authorization::AuthorizationPolicyBuilder ^ RequireRole(... cli::array <System::String ^> ^ roles);
public Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder RequireRole (params string[] roles);
member this.RequireRole : string[] -> Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder
Public Function RequireRole (ParamArray roles As String()) As AuthorizationPolicyBuilder
Parameters
- roles
- String[]
The allowed roles.
Returns
A reference to this instance after the operation has completed.
Applies to
RequireRole(IEnumerable<String>)
Adds a RolesAuthorizationRequirement to the current instance which enforces that the current user must have at least one of the specified roles.
public:
Microsoft::AspNetCore::Authorization::AuthorizationPolicyBuilder ^ RequireRole(System::Collections::Generic::IEnumerable<System::String ^> ^ roles);
public Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder RequireRole (System.Collections.Generic.IEnumerable<string> roles);
member this.RequireRole : seq<string> -> Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder
Public Function RequireRole (roles As IEnumerable(Of String)) As AuthorizationPolicyBuilder
Parameters
- roles
- IEnumerable<String>
The allowed roles.
Returns
A reference to this instance after the operation has completed.