Пример #1
0
 public AuthAgentProtocolHead(
     IAuthenticator authenticator,
     IUsernameParser usernameParser,
     IClientCredentialsFactory clientCredentialsFactory,
     ISystemComponentIdProvider systemComponentIdProvider,
     AuthAgentProtocolHeadConfig config)
 {
     this.authenticator             = Preconditions.CheckNotNull(authenticator, nameof(authenticator));
     this.usernameParser            = Preconditions.CheckNotNull(usernameParser, nameof(usernameParser));
     this.clientCredentialsFactory  = Preconditions.CheckNotNull(clientCredentialsFactory, nameof(clientCredentialsFactory));
     this.systemComponentIdProvider = Preconditions.CheckNotNull(systemComponentIdProvider);
     this.config = Preconditions.CheckNotNull(config);
 }
Пример #2
0
 static IWebHost CreateWebHostBuilder(
     IAuthenticator authenticator,
     IUsernameParser usernameParser,
     IClientCredentialsFactory clientCredentialsFactory,
     ISystemComponentIdProvider systemComponentIdProvider,
     AuthAgentProtocolHeadConfig config)
 {
     return(WebHost.CreateDefaultBuilder()
            .UseStartup <AuthAgentStartup>()
            .UseKestrel(serverOptions => serverOptions.Limits.MaxRequestBufferSize = 64 * 1024)
            .UseUrls($"http://*:{config.Port}")
            .ConfigureServices(s => s.TryAddSingleton(authenticator))
            .ConfigureServices(s => s.TryAddSingleton(usernameParser))
            .ConfigureServices(s => s.TryAddSingleton(clientCredentialsFactory))
            .ConfigureServices(s => s.TryAddSingleton(systemComponentIdProvider))
            .ConfigureServices(s => s.TryAddSingleton(config))
            .ConfigureServices(s => s.AddControllers().AddNewtonsoftJson())
            .ConfigureLogging(c => c.ClearProviders())
            .Build());
 }
Пример #3
0
 public AuthAgentStartup(AuthAgentProtocolHeadConfig config)
 {
     this.config = config;
 }