Udostępnij za pośrednictwem


AuthorizeAttribute Class

.NET Framework 4

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
Public method AuthorizeAttribute

Top

Properties

  Name Description
Public property 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.
Public property Roles Gets or sets the user roles.
Public property TypeId (Inherited from Attribute.)
Public property Users Gets or sets the authorized users.

Top

Methods

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

Top

Fields

  Name Description
Protected field _requireOutgoing

Top

Explicit Interface Implementations

  Name Description
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 method _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