Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
AuthorizeModule Class
Collapse the table of content
Expand the table of content

AuthorizeModule Class

.NET Framework 4
.NET Framework 4

Applies authorization attributes from the Hub class to determine whether to allow clients to receive messages sent from the hub.

System.Object
  Microsoft.AspNet.SignalR.Hubs.HubPipelineModule
    Microsoft.AspNet.SignalR.Hubs.AuthorizeModule

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

public class AuthorizeModule : HubPipelineModule

The AuthorizeModule type exposes the following members.

  NameDescription
Public methodBuildAuthorizeConnectWraps a function to be called before a client subscribes to signals belonging to the hub described by the HubDescriptor. By default, the AuthorizeModule will look for attributes on the hub to help determine if the client is authorized to subscribe to method invocations for the described hub. The function returns true if the client is authorized to subscribe to client-side hub method invocations; false, otherwise. (Overrides HubPipelineModule.BuildAuthorizeConnect(Func<HubDescriptor, IRequest, Boolean>).)
Public methodBuildConnectWraps a function that is called when a client connects to the HubDispatcher for each IHub the client connects to. By default, this results in the IHub 's OnConnected method being invoked. (Inherited from HubPipelineModule.)
Public methodBuildDisconnectWraps a function that is called when a client disconnects from the HubDispatcher for each IHub the client was connected to. By default, this results in the IHub 's OnDisconnected method being invoked. (Inherited from HubPipelineModule.)
Public methodBuildIncomingWraps a function that invokes a server-side hub method. Even if a client has not been authorized to connect to a hub, it will still be authorized to invoke server-side methods on that hub unless it is prevented in BuildIncoming(Func<IHubIncomingInvokerContext, Task<Object>>) by not executing the invoke parameter. (Overrides HubPipelineModule.BuildIncoming(Func<IHubIncomingInvokerContext, Task<Object>>).)
Public methodBuildOutgoingWraps a function that invokes a client-side hub method. (Inherited from HubPipelineModule.)
Public methodBuildReconnectWraps a function that is called when a client reconnects to the HubDispatcher for each IHub the client connects to. By default, this results in the IHub 's OnReconnected method being invoked. (Inherited from HubPipelineModule.)
Public methodBuildRejoiningGroupsWraps a function that determines which of the groups belonging to the hub described by the HubDescriptor the client should be allowed to rejoin. By default, clients that are reconnecting to the server will be removed from all groups they may have previously been a member of, because untrusted clients may claim to be a member of groups they were never authorized to join. (Inherited from HubPipelineModule.)
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Protected methodOnAfterConnectThis method is called after the connect components of any modules added later to the IHubPipeline are executed and after OnConnected() is executed, if at all. (Inherited from HubPipelineModule.)
Protected methodOnAfterDisconnectThis method is called after the disconnect components of any modules added later to the IHubPipeline are executed and after OnDisconnected() is executed, if at all. (Inherited from HubPipelineModule.)
Protected methodOnAfterIncomingThis method is called after the incoming components of any modules added later to the IHubPipeline and the server-side hub method have completed execution. (Inherited from HubPipelineModule.)
Protected methodOnAfterOutgoingThis method is called after the outgoing components of any modules added later to the IHubPipeline are executed. This does not mean that all the clients have received the hub method invocation, but it does indicate a hub invocation message has successfully been published to a message bus. (Inherited from HubPipelineModule.)
Protected methodOnAfterReconnectThis method is called after the reconnect components of any modules added later to the IHubPipeline are executed and after OnReconnected() is executed, if at all. (Inherited from HubPipelineModule.)
Protected methodOnBeforeAuthorizeConnectThis method is called before the AuthorizeConnect components of any modules added later to the IHubPipeline are executed. If this returns false, then those later-added modules will not run and the client will not be allowed to subscribe to client-side invocations of methods belonging to the hub defined by the HubDescriptor . (Inherited from HubPipelineModule.)
Protected methodOnBeforeConnectThis method is called before the connect components of any modules added later to the IHubPipeline are executed. If this returns false, then those later-added modules and the OnConnected() method will not be run. (Inherited from HubPipelineModule.)
Protected methodOnBeforeDisconnectThis method is called before the disconnect components of any modules added later to the IHubPipeline are executed. If this returns false, then those later-added modules and the OnDisconnected() method will not be run. (Inherited from HubPipelineModule.)
Protected methodOnBeforeIncomingThis method is called before the incoming components of any modules added later to the IHubPipeline are executed. If this returns false, then those later-added modules and the server-side hub method invocation will not be executed. Even if a client has not been authorized to connect to a hub, it will still be authorized to invoke server-side methods on that hub unless it is prevented in BuildIncoming(Func<IHubIncomingInvokerContext, Task<Object>>) by not executing the invoke parameter or prevented in OnBeforeIncoming(IHubIncomingInvokerContext) by returning false. (Inherited from HubPipelineModule.)
Protected methodOnBeforeOutgoingThis method is called before the outgoing components of any modules added later to the IHubPipeline are executed. If this returns false, then those later-added modules and the client-side hub method invocation(s) will not be executed. (Inherited from HubPipelineModule.)
Protected methodOnBeforeReconnectThis method is called before the reconnect components of any modules added later to the IHubPipeline are executed. If this returns false, then those later-added modules and the OnReconnected() method will not be run. (Inherited from HubPipelineModule.)
Protected methodOnIncomingErrorThis is called when an uncaught exception is thrown by a server-side hub method or the incoming component of a module added later to the IHubPipeline . Observing the exception using this method will not prevent it from bubbling up to other modules. (Inherited from HubPipelineModule.)
Public methodToString (Inherited from Object.)
Top

An AuthorizeModule instance is added to the IHubPipeline by default. Hub level attributes that implement IAuthorizeHubConnection such as AuthorizeAttribute are applied to determine whether to allow potential clients to receive messages sent from that hub using a HubContext or a HubConnectionContext. All applicable hub attributes must allow hub connection for the connection to be authorized. Hub and method level attributes that implement IAuthorizeHubMethodInvocation such as AuthorizeAttribute are applied to determine whether to allow callers to invoke hub methods. All applicable hub level and method level attributes must allow hub method invocation for the invocation to be authorized. Optionally, this module may be instantiated with IAuthorizeHubConnection and IAuthorizeHubMethodInvocation authorizers that will be applied globally to all hubs and hub methods.

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:
© 2015 Microsoft