Export (0) Print
Expand All

AuthorizeAttribute Class

Specifies the authorization filter that verifies the request's IPrincipal.

Namespace:  System.Web.Http
Assembly:  System.Web.Http (in System.Web.Http.dll)

[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Method, Inherited = true, 
	AllowMultiple = true)]
public class AuthorizeAttribute : AuthorizationFilterAttribute

The AuthorizeAttribute type exposes the following members.

  NameDescription
Public methodAuthorizeAttributeInitializes a new instance of the AuthorizeAttribute class.
Top

  NameDescription
Public propertyAllowMultipleGets a value that indicates whether multiple filters are allowed. (Inherited from FilterAttribute.)
Public propertyRolesGets or sets the authorized roles.
Public propertyTypeIdGets a unique identifier for this attribute. (Overrides Attribute.TypeId.)
Public propertyUsersGets or sets the authorized users.
Top

  NameDescription
Public methodEquals (Inherited from Attribute.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Attribute.)
Public methodGetType (Inherited from Object.)
Protected methodHandleUnauthorizedRequestProcesses requests that fail authorization.
Protected methodIsAuthorizedIndicates whether the specified control is authorized.
Public methodIsDefaultAttribute (Inherited from Attribute.)
Public methodMatch (Inherited from Attribute.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodOnAuthorizationCalls when an action is being authorized. (Overrides AuthorizationFilterAttribute.OnAuthorization(HttpActionContext).)
Public methodToString (Inherited from Object.)
Top

  NameDescription
Explicit interface implemetationPrivate method_Attribute.GetIDsOfNames (Inherited from Attribute.)
Explicit interface implemetationPrivate method_Attribute.GetTypeInfo (Inherited from Attribute.)
Explicit interface implemetationPrivate method_Attribute.GetTypeInfoCount (Inherited from Attribute.)
Explicit interface implemetationPrivate methodIAuthorizationFilter.ExecuteAuthorizationFilterAsyncExecutes the authorization filter during synchronization. (Inherited from AuthorizationFilterAttribute.)
Explicit interface implemetationPrivate method_Attribute.Invoke (Inherited from Attribute.)
Top

You can declare multiple AuthorizeAttribute per action. You can also use AllowAnonymousAttribute to disable authorization for a specific action.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft