private static AuthContext auth(RequestContext requestContext, RequestAuthenticator authenticator) { return authenticator.authenticate(requestContext.request()); }
new SchedulerResource(stateManager, trigger, storage, time, workflowValidator, workflowActionAuthorizer); final RequestAuthenticator requestAuthenticator = new RequestAuthenticator( authenticatorFactory.apply(AuthenticatorConfiguration.fromConfig(config, serviceName))); environment.routingEngine()
() -> configSupplier.get().clientBlacklist(); final RequestAuthenticator requestAuthenticator = new RequestAuthenticator(authenticatorFactory.apply( AuthenticatorConfiguration.fromConfig(config, serviceName)));
private CompletionStage<Response<ByteString>> haltBackfill(String id, RequestContext rc, RequestAuthenticator authenticator) { final AuthContext authContext = authenticator.authenticate(rc.request()); try { // TODO: run in transction final Optional<Backfill> backfillOptional = storage.backfill(id); if (backfillOptional.isPresent()) { final Backfill backfill = backfillOptional.get(); workflowActionAuthorizer.authorizeWorkflowAction(authContext, backfill.workflowId()); storage.storeBackfill(backfill.builder().halted(true).build()); return haltActiveBackfillInstances(backfill, rc.requestScopedClient()); } else { return CompletableFuture.completedFuture( Response.forStatus(Status.NOT_FOUND.withReasonPhrase("backfill not found"))); } } catch (IOException e) { return CompletableFuture.completedFuture(Response.forStatus( Status.INTERNAL_SERVER_ERROR .withReasonPhrase("could not halt backfill: " + e.getMessage()))); } }