/// <summary>
        /// Requiring Authentication adds an <see cref="AuthorizeModule"/> to the <see cref="HubOptions" /> with <see cref="IAuthorizeHubConnection"/>
        /// and <see cref="IAuthorizeHubMethodInvocation"/> authorizers that will be applied globally to all hubs and hub methods.
        /// These authorizers require that the <see cref="System.Security.Principal.IPrincipal"/>'s <see cref="System.Security.Principal.IIdentity"/>
        /// IsAuthenticated for any clients that invoke server-side hub methods or receive client-side hub method invocations.
        /// </summary>
        /// <param name="options">The <see cref="HubOptions" /> to which the <see cref="AuthorizeModule" /> will be added.</param>
        public static void RequireAuthentication(this HubOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            var authorizer = new AuthorizeAttribute();

            options.PipelineModules.Add(new AuthorizeModule(globalConnectionAuthorizer: authorizer, globalInvocationAuthorizer: authorizer));
        }
        /// <summary>
        /// Requiring Authentication adds an <see cref="AuthorizeModule"/> to the <see cref="HubOptions" /> with <see cref="IAuthorizeHubConnection"/>
        /// and <see cref="IAuthorizeHubMethodInvocation"/> authorizers that will be applied globally to all hubs and hub methods.
        /// These authorizers require that the <see cref="System.Security.Principal.IPrincipal"/>'s <see cref="System.Security.Principal.IIdentity"/>
        /// IsAuthenticated for any clients that invoke server-side hub methods or receive client-side hub method invocations.
        /// </summary>
        /// <param name="options">The <see cref="HubOptions" /> to which the <see cref="AuthorizeModule" /> will be added.</param>
        public static void RequireAuthentication([NotNull] this HubOptions options)
        {
            var authorizer = new AuthorizeAttribute();

            options.PipelineModules.Add(new AuthorizeModule(globalConnectionAuthorizer: authorizer, globalInvocationAuthorizer: authorizer));
        }
예제 #3
0
 public SignalROptions()
 {
     Hubs = new HubOptions();
     MessageBus = new MessageBusOptions();
     Transports = new TransportOptions();
 }
 public SignalROptions()
 {
     Hubs       = new HubOptions();
     MessageBus = new MessageBusOptions();
     Transports = new TransportOptions();
 }