/** * Returns a newly-created {@link HttpAuthService} based on the {@link Authorizer}s added to this builder. */ public HttpAuthService build(Service<HttpRequest, HttpResponse> delegate) { return new HttpAuthService(requireNonNull(delegate, "delegate"), authorizer(), successHandler, failureHandler); }
/** * Returns a newly-created decorator that decorates a {@link Service} with a new {@link HttpAuthService} * based on the {@link Authorizer}s added to this builder. */ public Function<Service<HttpRequest, HttpResponse>, HttpAuthService> newDecorator() { final Authorizer<HttpRequest> authorizer = authorizer(); final AuthSuccessHandler<HttpRequest, HttpResponse> successHandler = this.successHandler; final AuthFailureHandler<HttpRequest, HttpResponse> failureHandler = this.failureHandler; return service -> new HttpAuthService(service, authorizer, successHandler, failureHandler); }