Language

AuthorizeAttribute Class

.NET Framework 4.5

Apply to Hubs and Hub methods to authorize client connections to Hubs and authorize client invocations of Hub methods.

Inheritance Hierarchy

System.Object   System.Attribute     Microsoft.AspNet.SignalR.AuthorizeAttribute

Namespace:  Microsoft.AspNet.SignalR Assembly:  Microsoft.AspNet.SignalR.Core (in Microsoft.AspNet.SignalR.Core.dll)

Syntax

'Declaration
<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Method, Inherited := True,  _
    AllowMultiple := True)> _
Public Class AuthorizeAttribute _
    Inherits Attribute _
    Implements IAuthorizeHubConnection, IAuthorizeHubMethodInvocation
'Usage
Dim instance As AuthorizeAttribute
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Method, Inherited = true,
    AllowMultiple = true)]
public class AuthorizeAttribute : Attribute,
    IAuthorizeHubConnection, IAuthorizeHubMethodInvocation
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Method, Inherited = true,
    AllowMultiple = true)]
public ref class AuthorizeAttribute : public Attribute,
    IAuthorizeHubConnection, IAuthorizeHubMethodInvocation
[<AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Method, Inherited = true,
    AllowMultiple = true)>]
type AuthorizeAttribute =
    class 
        inherit Attribute 
        interface IAuthorizeHubConnection 
        interface IAuthorizeHubMethodInvocation 
    end
public class AuthorizeAttribute extends Attribute implements IAuthorizeHubConnection, IAuthorizeHubMethodInvocation

The AuthorizeAttribute type exposes the following members.

Constructors

Name Description
AuthorizeAttribute

Top

Properties

Name Description
RequireOutgoing Set to false to apply authorization only to the invocations of any of the Hub's server-side methods. This property only affects attributes applied to the Hub class. This property cannot be read.
Roles Gets or sets the user roles.
TypeId (Inherited from Attribute.)
Users Gets or sets the authorized users.

Top

Methods

Name Description
AuthorizeHubConnection Determines whether client is authorized to connect to IHub.
AuthorizeHubMethodInvocation Determines whether client is authorized to invoke the IHub method.
Equals (Inherited from Attribute.)
Finalize (Inherited from Object.)
GetHashCode (Inherited from Attribute.)
GetType (Inherited from Object.)
IsDefaultAttribute (Inherited from Attribute.)
Match (Inherited from Attribute.)
MemberwiseClone (Inherited from Object.)
ToString (Inherited from Object.)
UserAuthorized When overridden, provides an entry point for custom authorization checks. Called by AuthorizeHubConnection(HubDescriptor, IRequest) and AuthorizeHubMethodInvocation(IHubIncomingInvokerContext, Boolean).

Top

Fields

Name Description
_requireOutgoing

Top

Explicit Interface Implementations

Name Description
_Attribute.GetIDsOfNames (Inherited from Attribute.)
_Attribute.GetTypeInfo (Inherited from Attribute.)
_Attribute.GetTypeInfoCount (Inherited from Attribute.)
_Attribute.Invoke (Inherited from Attribute.)

Top

Thread Safety

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

See Also

Reference

Microsoft.AspNet.SignalR Namespace