/** * Creates a new HTTP authorization {@link Service} decorator using the specified * {@link Authorizer}s. * * @param authorizers the array of {@link Authorizer}s. */ @SafeVarargs public static Function<Service<HttpRequest, HttpResponse>, HttpAuthService> newDecorator(Authorizer<HttpRequest>... authorizers) { return newDecorator(ImmutableList.copyOf(requireNonNull(authorizers, "authorizers"))); }
private void configureThriftService(ServerBuilder sb, ProjectManager pm, CommandExecutor executor, WatchService watchService, MetadataService mds) { final CentralDogmaServiceImpl service = new CentralDogmaServiceImpl(pm, executor, watchService, mds); Service<HttpRequest, HttpResponse> thriftService = ThriftCallService.of(service) .decorate(CentralDogmaTimeoutScheduler::new) .decorate(CentralDogmaExceptionTranslator::new) .decorate(THttpService.newDecorator()); if (cfg.isCsrfTokenRequiredForThrift()) { thriftService = thriftService.decorate(HttpAuthService.newDecorator(new CsrfTokenAuthorizer())); } else { thriftService = thriftService.decorate(TokenlessClientLogger::new); } // Enable content compression for API responses. thriftService = thriftService.decorate(contentEncodingDecorator()); sb.service("/cd/thrift/v1", thriftService); }
private void configureThriftService(ServerBuilder sb, ProjectManager pm, CommandExecutor executor, WatchService watchService, MetadataService mds) { final CentralDogmaServiceImpl service = new CentralDogmaServiceImpl(pm, executor, watchService, mds); Service<HttpRequest, HttpResponse> thriftService = ThriftCallService.of(service) .decorate(CentralDogmaTimeoutScheduler::new) .decorate(CentralDogmaExceptionTranslator::new) .decorate(THttpService.newDecorator()); if (cfg.isCsrfTokenRequiredForThrift()) { thriftService = thriftService.decorate(HttpAuthService.newDecorator(new CsrfTokenAuthorizer())); } else { thriftService = thriftService.decorate(TokenlessClientLogger::new); } // Enable content compression for API responses. thriftService = thriftService.decorate(contentEncodingDecorator()); sb.service("/cd/thrift/v1", thriftService); }
decorator = MetadataServiceInjector .newDecorator(mds) .andThen(HttpAuthService.newDecorator(new CsrfTokenAuthorizer()));
private void configureThriftService(ServerBuilder sb, ProjectManager pm, CommandExecutor executor, WatchService watchService, MetadataService mds) { final CentralDogmaServiceImpl service = new CentralDogmaServiceImpl(pm, executor, watchService, mds); Service<HttpRequest, HttpResponse> thriftService = ThriftCallService.of(service) .decorate(CentralDogmaTimeoutScheduler::new) .decorate(CentralDogmaExceptionTranslator::new) .decorate(THttpService.newDecorator()); if (cfg.isCsrfTokenRequiredForThrift()) { thriftService = thriftService.decorate(HttpAuthService.newDecorator(new CsrfTokenAuthorizer())); } else { thriftService = thriftService.decorate(TokenlessClientLogger::new); } // Enable content compression for API responses. thriftService = thriftService.decorate(contentEncodingDecorator()); sb.service("/cd/thrift/v1", thriftService); }
decorator = MetadataServiceInjector .newDecorator(mds) .andThen(HttpAuthService.newDecorator(new CsrfTokenAuthorizer()));
.andThen(HttpAuthService.newDecorator(ata, sta)); } else { .andThen(HttpAuthService.newDecorator( new CsrfTokenAuthorizer()));
MetadataServiceInjector.newDecorator(mds).andThen(HttpAuthService.newDecorator( new ApplicationTokenAuthorizer(mds::findTokenBySecret))); sb.annotatedService(new Object() {