public NegotiateHandler(
     IOptions <HubOptions> globalHubOptions,
     IOptions <HubOptions <THub> > hubOptions,
     IServiceEndpointManager endpointManager,
     IEndpointRouter router,
     IUserIdProvider userIdProvider,
     IServerNameProvider nameProvider,
     IConnectionRequestIdProvider connectionRequestIdProvider,
     IOptions <ServiceOptions> options,
     IBlazorDetector blazorDetector,
     ILogger <NegotiateHandler <THub> > logger)
 {
     _logger                      = logger ?? throw new ArgumentNullException(nameof(logger));
     _endpointManager             = endpointManager ?? throw new ArgumentNullException(nameof(endpointManager));
     _router                      = router ?? throw new ArgumentNullException(nameof(router));
     _serverName                  = nameProvider?.GetName();
     _userIdProvider              = userIdProvider ?? throw new ArgumentNullException(nameof(userIdProvider));
     _connectionRequestIdProvider = connectionRequestIdProvider ?? throw new ArgumentNullException(nameof(connectionRequestIdProvider));
     _claimsProvider              = options?.Value?.ClaimsProvider;
     _diagnosticClientFilter      = options?.Value?.DiagnosticClientFilter;
     _blazorDetector              = blazorDetector ?? new DefaultBlazorDetector();
     _mode = options.Value.ServerStickyMode;
     _enableDetailedErrors   = globalHubOptions.Value.EnableDetailedErrors == true;
     _endpointsCount         = options.Value.Endpoints.Length;
     _maxPollInterval        = options.Value.MaxPollIntervalInSeconds;
     _transportTypeDetector  = options.Value.TransportTypeDetector;
     _customHandshakeTimeout = GetCustomHandshakeTimeout(hubOptions.Value.HandshakeTimeout ?? globalHubOptions.Value.HandshakeTimeout);
     _hubName = typeof(THub).Name;
 }
 public NegotiateHandler(IServiceEndpointManager endpointManager, IEndpointRouter router, IUserIdProvider userIdProvider, IServerNameProvider nameProvider, IConnectionRequestIdProvider connectionRequestIdProvider, IOptions <ServiceOptions> options)
 {
     _endpointManager             = endpointManager ?? throw new ArgumentNullException(nameof(endpointManager));
     _router                      = router ?? throw new ArgumentNullException(nameof(router));
     _serverName                  = nameProvider?.GetName();
     _userIdProvider              = userIdProvider ?? throw new ArgumentNullException(nameof(userIdProvider));
     _connectionRequestIdProvider = connectionRequestIdProvider ?? throw new ArgumentNullException(nameof(connectionRequestIdProvider));
     _claimsProvider              = options?.Value?.ClaimsProvider;
     _mode = options.Value.ServerStickyMode;
 }
Exemple #3
0
 public NegotiateMiddleware(OwinMiddleware next, HubConfiguration configuration, string appName, IServiceEndpointManager endpointManager, IEndpointRouter router, ServiceOptions options, IServerNameProvider serverNameProvider, IConnectionRequestIdProvider connectionRequestIdProvider, ILoggerFactory loggerFactory)
     : base(next)
 {
     _configuration               = configuration;
     _provider                    = configuration.Resolver.Resolve <IUserIdProvider>();
     _appName                     = appName ?? throw new ArgumentNullException(nameof(appName));
     _claimsProvider              = options?.ClaimsProvider;
     _endpointManager             = endpointManager ?? throw new ArgumentNullException(nameof(endpointManager));
     _router                      = router ?? throw new ArgumentNullException(nameof(router));
     _connectionRequestIdProvider = connectionRequestIdProvider ?? throw new ArgumentNullException(nameof(connectionRequestIdProvider));
     _logger                      = loggerFactory?.CreateLogger <NegotiateMiddleware>() ?? throw new ArgumentNullException(nameof(loggerFactory));
     _serverName                  = serverNameProvider?.GetName();
     _mode = options.ServerStickyMode;
 }
        private string GetQueryString(IConnectionRequestIdProvider provider, string originalQueryString)
        {
            var clientRequestId = _connectionRequestIdProvider.GetRequestId();

            if (clientRequestId != null)
            {
                clientRequestId = WebUtility.UrlEncode(clientRequestId);
            }
            if (originalQueryString != null)
            {
                return($"{originalQueryString}&{Constants.QueryParameter.ConnectionRequestId}={clientRequestId}");
            }

            return($"{Constants.QueryParameter.ConnectionRequestId}={clientRequestId}");
        }
 public NegotiateHandler(
     IOptions <HubOptions> hubOptions,
     IServiceEndpointManager endpointManager, IEndpointRouter router, IUserIdProvider userIdProvider, IServerNameProvider nameProvider, IConnectionRequestIdProvider connectionRequestIdProvider, IOptions <ServiceOptions> options)
 {
     _endpointManager             = endpointManager ?? throw new ArgumentNullException(nameof(endpointManager));
     _router                      = router ?? throw new ArgumentNullException(nameof(router));
     _serverName                  = nameProvider?.GetName();
     _userIdProvider              = userIdProvider ?? throw new ArgumentNullException(nameof(userIdProvider));
     _connectionRequestIdProvider = connectionRequestIdProvider ?? throw new ArgumentNullException(nameof(connectionRequestIdProvider));
     _claimsProvider              = options?.Value?.ClaimsProvider;
     _mode = options.Value.ServerStickyMode;
     _enableDetailedErrors = hubOptions.Value.EnableDetailedErrors == true;
     _endpointsCount       = options.Value.Endpoints.Length;
     _maxPollInterval      = options.Value.MaxPollIntervalInSeconds;
 }
Exemple #6
0
 public NegotiateMiddleware(OwinMiddleware next, HubConfiguration configuration, string appName, IServiceEndpointManager endpointManager, IEndpointRouter router, ServiceOptions options, IServerNameProvider serverNameProvider, IConnectionRequestIdProvider connectionRequestIdProvider, ILoggerFactory loggerFactory)
     : base(next)
 {
     _configuration          = configuration;
     _provider               = configuration.Resolver.Resolve <IUserIdProvider>();
     _appName                = appName ?? throw new ArgumentNullException(nameof(appName));
     _claimsProvider         = options?.ClaimsProvider;
     _diagnosticClientFilter = options?.DiagnosticClientFilter;
     _endpointManager        = endpointManager ?? throw new ArgumentNullException(nameof(endpointManager));
     _router = router ?? throw new ArgumentNullException(nameof(router));
     _connectionRequestIdProvider = connectionRequestIdProvider ?? throw new ArgumentNullException(nameof(connectionRequestIdProvider));
     _logger               = loggerFactory?.CreateLogger <NegotiateMiddleware>() ?? throw new ArgumentNullException(nameof(loggerFactory));
     _serverName           = serverNameProvider?.GetName();
     _mode                 = options.ServerStickyMode;
     _enableDetailedErrors = configuration.EnableDetailedErrors;
     _endpointsCount       = options.Endpoints.Length;
     _maxPollInterval      = options.MaxPollIntervalInSeconds;
 }