AuthorizeModule Class
.NET Framework 4
Applies authorization attributes from the Hub class to determine whether to allow clients to receive messages sent from the hub.
Inheritance Hierarchy
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)
Syntax
'Declaration
Public Class AuthorizeModule _
Inherits HubPipelineModule
'Usage
Dim instance As AuthorizeModule
public class AuthorizeModule : HubPipelineModule
public ref class AuthorizeModule : public HubPipelineModule
type AuthorizeModule =
class
inherit HubPipelineModule
end
public class AuthorizeModule extends HubPipelineModule
The AuthorizeModule type exposes the following members.
Constructors
Name | Description | |
---|---|---|
AuthorizeModule() | ||
AuthorizeModule(IAuthorizeHubConnection, IAuthorizeHubMethodInvocation) |
Top
Methods
Name | Description | |
---|---|---|
BuildAuthorizeConnect | Wraps 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>).) | |
BuildConnect | Wraps 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.) | |
BuildDisconnect | Wraps 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.) | |
BuildIncoming | Wraps 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>>).) | |
BuildOutgoing | Wraps a function that invokes a client-side hub method. (Inherited from HubPipelineModule.) | |
BuildReconnect | Wraps 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.) | |
BuildRejoiningGroups | Wraps 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.) | |
Equals | (Inherited from Object.) | |
Finalize | (Inherited from Object.) | |
GetHashCode | (Inherited from Object.) | |
GetType | (Inherited from Object.) | |
MemberwiseClone | (Inherited from Object.) | |
OnAfterConnect | This 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.) | |
OnAfterDisconnect | This 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.) | |
OnAfterIncoming | This 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.) | |
OnAfterOutgoing | This 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.) | |
OnAfterReconnect | This 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.) | |
OnBeforeAuthorizeConnect | This 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.) | |
OnBeforeConnect | This 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.) | |
OnBeforeDisconnect | This 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.) | |
OnBeforeIncoming | This 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.) | |
OnBeforeOutgoing | This 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.) | |
OnBeforeReconnect | This 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.) | |
OnIncomingError | This 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.) | |
ToString | (Inherited from Object.) |
Top
Remarks
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.
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.