Ejemplo n.º 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);
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 3
0
 public AuthAgentStartup(AuthAgentProtocolHeadConfig config)
 {
     this.config = config;
 }