diff --git a/extensions/funqy/funqy-http/deployment/src/main/java/io/quarkus/funqy/deployment/bindings/http/FunqyHttpBuildStep.java b/extensions/funqy/funqy-http/deployment/src/main/java/io/quarkus/funqy/deployment/bindings/http/FunqyHttpBuildStep.java index 0751cbaa7672a..34c86767bc33c 100644 --- a/extensions/funqy/funqy-http/deployment/src/main/java/io/quarkus/funqy/deployment/bindings/http/FunqyHttpBuildStep.java +++ b/extensions/funqy/funqy-http/deployment/src/main/java/io/quarkus/funqy/deployment/bindings/http/FunqyHttpBuildStep.java @@ -50,7 +50,7 @@ public void staticInit(FunqyHttpBindingRecorder binding, return; // The context path + the resources path - String rootPath = httpConfig.rootPath; + String rootPath = httpConfig.rootPath(); binding.init(); } @@ -71,7 +71,7 @@ public void boot(ShutdownContextBuildItem shutdown, return; feature.produce(new FeatureBuildItem(FUNQY_HTTP_FEATURE)); - String rootPath = httpConfig.rootPath; + String rootPath = httpConfig.rootPath(); Handler handler = binding.start(rootPath, vertx.getVertx(), shutdown, diff --git a/extensions/funqy/funqy-knative-events/deployment/src/main/java/io/quarkus/funqy/deployment/bindings/knative/events/FunqyKnativeEventsBuildStep.java b/extensions/funqy/funqy-knative-events/deployment/src/main/java/io/quarkus/funqy/deployment/bindings/knative/events/FunqyKnativeEventsBuildStep.java index cbaa4ae12a25e..ede48353cd7e9 100644 --- a/extensions/funqy/funqy-knative-events/deployment/src/main/java/io/quarkus/funqy/deployment/bindings/knative/events/FunqyKnativeEventsBuildStep.java +++ b/extensions/funqy/funqy-knative-events/deployment/src/main/java/io/quarkus/funqy/deployment/bindings/knative/events/FunqyKnativeEventsBuildStep.java @@ -73,7 +73,7 @@ public void boot(ShutdownContextBuildItem shutdown, feature.produce(new FeatureBuildItem(FUNQY_KNATIVE_FEATURE)); - String rootPath = httpConfig.rootPath; + String rootPath = httpConfig.rootPath(); if (rootPath == null) { rootPath = "/"; } else if (!rootPath.endsWith("/")) { diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/devui/GrpcJsonRPCService.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/devui/GrpcJsonRPCService.java index dc4f09e115730..47cbd6988b9e2 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/devui/GrpcJsonRPCService.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/devui/GrpcJsonRPCService.java @@ -50,9 +50,9 @@ public void init() { this.port = serverConfig.port; this.ssl = serverConfig.ssl.certificate.isPresent() || serverConfig.ssl.keyStore.isPresent(); } else { - this.host = httpConfiguration.host; - this.port = httpConfiguration.port; - this.ssl = httpConfiguration.insecureRequests != HttpConfiguration.InsecureRequests.ENABLED; + this.host = httpConfiguration.host(); + this.port = httpConfiguration.port(); + this.ssl = httpConfiguration.insecureRequests() != HttpConfiguration.InsecureRequests.ENABLED; } } diff --git a/extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/KeycloakPolicyEnforcerRecorder.java b/extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/KeycloakPolicyEnforcerRecorder.java index 7165eb7e39c79..15a926be3e1d1 100644 --- a/extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/KeycloakPolicyEnforcerRecorder.java +++ b/extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/KeycloakPolicyEnforcerRecorder.java @@ -47,7 +47,7 @@ public Supplier setup(OidcConfig oidcConfig, KeycloakPol @Override public PolicyEnforcerResolver get() { return new PolicyEnforcerResolver(defaultPolicyEnforcer, policyEnforcerTenants, - httpConfiguration.readTimeout.toMillis()); + httpConfiguration.readTimeout().toMillis()); } }; } diff --git a/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/OidcBuildStep.java b/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/OidcBuildStep.java index daa6a390ee240..ae84cfb80aa24 100644 --- a/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/OidcBuildStep.java +++ b/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/OidcBuildStep.java @@ -162,7 +162,7 @@ public void produceTenantResolverInterceptors(CombinedIndexBuildItem indexBuildI Capabilities capabilities, OidcRecorder recorder, BuildProducer producer, HttpBuildTimeConfig buildTimeConfig) { - if (!buildTimeConfig.auth.proactive + if (!buildTimeConfig.auth().proactive() && (capabilities.isPresent(Capability.RESTEASY_REACTIVE) || capabilities.isPresent(Capability.RESTEASY))) { // provide method interceptor that will be run before security checks diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/devui/OidcDevJsonRpcService.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/devui/OidcDevJsonRpcService.java index e54c728dbe077..4d7416315cab7 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/devui/OidcDevJsonRpcService.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/devui/OidcDevJsonRpcService.java @@ -47,7 +47,7 @@ public OidcDevJsonRpcService(HttpConfiguration httpConfiguration, SmallRyeConfig // 'KeycloakDevServicesProcessor' is created with combined index OidcDevUiRpcSvcPropertiesBean props = Arc.container().instance(OidcDevUiRpcSvcPropertiesBean.class).get(); - this.httpPort = httpConfiguration.port; + this.httpPort = httpConfiguration.port(); this.config = config; this.vertx = vertx; this.authorizationUrl = props.getAuthorizationUrl(); diff --git a/extensions/reactive-routes/deployment/src/main/java/io/quarkus/vertx/web/deployment/ReactiveRoutesProcessor.java b/extensions/reactive-routes/deployment/src/main/java/io/quarkus/vertx/web/deployment/ReactiveRoutesProcessor.java index 3f6872a54ac88..b9cfc856b0f94 100644 --- a/extensions/reactive-routes/deployment/src/main/java/io/quarkus/vertx/web/deployment/ReactiveRoutesProcessor.java +++ b/extensions/reactive-routes/deployment/src/main/java/io/quarkus/vertx/web/deployment/ReactiveRoutesProcessor.java @@ -227,7 +227,7 @@ void validateBeanDeployment( // access the SecurityIdentity in a synchronous manner final boolean blocking = annotationStore.hasAnnotation(method, DotNames.BLOCKING); final boolean alwaysAuthenticateRoute; - if (!httpBuildTimeConfig.auth.proactive && !blocking) { + if (!httpBuildTimeConfig.auth().proactive() && !blocking) { final DotName returnTypeName = method.returnType().name(); // method either returns 'something' in a synchronous manner or void (in which case we can't tell) final boolean possiblySynchronousResponse = !returnTypeName.equals(DotNames.UNI) diff --git a/extensions/reactive-routes/runtime/src/main/java/io/quarkus/vertx/web/runtime/VertxWebRecorder.java b/extensions/reactive-routes/runtime/src/main/java/io/quarkus/vertx/web/runtime/VertxWebRecorder.java index 6fd9f8519fc71..3a492db431ae0 100644 --- a/extensions/reactive-routes/runtime/src/main/java/io/quarkus/vertx/web/runtime/VertxWebRecorder.java +++ b/extensions/reactive-routes/runtime/src/main/java/io/quarkus/vertx/web/runtime/VertxWebRecorder.java @@ -52,10 +52,10 @@ public Handler createHandler(String handlerClassName) { } public Handler compressRouteHandler(Handler routeHandler, HttpCompression compression) { - if (httpBuildTimeConfig.enableCompression) { + if (httpBuildTimeConfig.enableCompression()) { return new HttpCompressionHandler(routeHandler, compression, compression == HttpCompression.UNDEFINED - ? Set.copyOf(httpBuildTimeConfig.compressMediaTypes.orElse(List.of())) + ? Set.copyOf(httpBuildTimeConfig.compressMediaTypes().orElse(List.of())) : Set.of()); } else { return routeHandler; diff --git a/extensions/resteasy-classic/resteasy/deployment/src/main/java/io/quarkus/resteasy/deployment/ResteasyStandaloneBuildStep.java b/extensions/resteasy-classic/resteasy/deployment/src/main/java/io/quarkus/resteasy/deployment/ResteasyStandaloneBuildStep.java index 73b99d8406866..44b2e019c80ec 100644 --- a/extensions/resteasy-classic/resteasy/deployment/src/main/java/io/quarkus/resteasy/deployment/ResteasyStandaloneBuildStep.java +++ b/extensions/resteasy-classic/resteasy/deployment/src/main/java/io/quarkus/resteasy/deployment/ResteasyStandaloneBuildStep.java @@ -111,7 +111,7 @@ public void boot(ShutdownContextBuildItem shutdown, final boolean noCustomAuthCompletionExMapper; final boolean noCustomAuthFailureExMapper; final boolean noCustomAuthRedirectExMapper; - if (vertxConfig.auth.proactive) { + if (vertxConfig.auth().proactive()) { noCustomAuthCompletionExMapper = notFoundCustomExMapper(AuthenticationCompletionException.class.getName(), AuthenticationCompletionExceptionMapper.class.getName(), combinedIndexBuildItem.getIndex()); noCustomAuthFailureExMapper = notFoundCustomExMapper(AuthenticationFailedException.class.getName(), @@ -129,7 +129,7 @@ public void boot(ShutdownContextBuildItem shutdown, // so that user can define failure handlers that precede exception mappers final Handler failureHandler = recorder.vertxFailureHandler(vertx.getVertx(), executorBuildItem.getExecutorProxy(), resteasyVertxConfig, noCustomAuthCompletionExMapper, - noCustomAuthFailureExMapper, noCustomAuthRedirectExMapper, vertxConfig.auth.proactive); + noCustomAuthFailureExMapper, noCustomAuthRedirectExMapper, vertxConfig.auth().proactive()); filterBuildItemBuildProducer.produce(FilterBuildItem.ofAuthenticationFailureHandler(failureHandler)); // Exact match for resources matched to the root path diff --git a/extensions/resteasy-classic/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/ResteasyStandaloneRecorder.java b/extensions/resteasy-classic/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/ResteasyStandaloneRecorder.java index 074519e4a4298..6a06404fc4c3b 100644 --- a/extensions/resteasy-classic/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/ResteasyStandaloneRecorder.java +++ b/extensions/resteasy-classic/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/ResteasyStandaloneRecorder.java @@ -77,10 +77,10 @@ public Handler vertxRequestHandler(Supplier vertx, Execut if (deployment != null) { Handler handler = new VertxRequestHandler(vertx.get(), deployment, contextPath, new ResteasyVertxAllocator(config.responseBufferSize), executor, - readTimeout.getValue().readTimeout.toMillis()); + readTimeout.getValue().readTimeout().toMillis()); - Set compressMediaTypes = httpBuildTimeConfig.compressMediaTypes.map(Set::copyOf).orElse(Set.of()); - if (httpBuildTimeConfig.enableCompression && !compressMediaTypes.isEmpty()) { + Set compressMediaTypes = httpBuildTimeConfig.compressMediaTypes().map(Set::copyOf).orElse(Set.of()); + if (httpBuildTimeConfig.enableCompression() && !compressMediaTypes.isEmpty()) { // If compression is enabled and the set of compressed media types is not empty then wrap the standalone handler handler = new HttpCompressionHandler(handler, compressMediaTypes); } @@ -99,7 +99,7 @@ public Handler vertxFailureHandler(Supplier vertx, Execut // used when auth failed before RESTEasy Classic began processing the request return new VertxRequestHandler(vertx.get(), deployment, contextPath, new ResteasyVertxAllocator(config.responseBufferSize), executor, - readTimeout.getValue().readTimeout.toMillis()) { + readTimeout.getValue().readTimeout().toMillis()) { @Override public void handle(RoutingContext request) { diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/CompressionScanner.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/CompressionScanner.java index 2d23b70a6250d..68517881770ad 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/CompressionScanner.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/CompressionScanner.java @@ -34,7 +34,7 @@ public CompressionScanner(HttpBuildTimeConfig httpBuildTimeConfig) { @Override public List scan(MethodInfo method, ClassInfo actualEndpointClass, Map methodContext) { - if (!httpBuildTimeConfig.enableCompression) { + if (!httpBuildTimeConfig.enableCompression()) { return Collections.emptyList(); } @@ -58,7 +58,7 @@ public List scan(MethodInfo method, ClassInfo actualEndp return Collections.emptyList(); } ResteasyReactiveCompressionHandler handler = new ResteasyReactiveCompressionHandler( - Set.copyOf(httpBuildTimeConfig.compressMediaTypes.orElse(Collections.emptyList()))); + Set.copyOf(httpBuildTimeConfig.compressMediaTypes().orElse(Collections.emptyList()))); handler.setCompression(compression); String[] produces = (String[]) methodContext.get(EndpointIndexer.METHOD_PRODUCES); if ((produces != null) && (produces.length > 0)) { diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/ResteasyReactiveProcessor.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/ResteasyReactiveProcessor.java index 667cfd0f69b31..bc89dc610f42f 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/ResteasyReactiveProcessor.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/ResteasyReactiveProcessor.java @@ -1272,7 +1272,7 @@ public void setupDeployment(BeanContainerBuildItem beanContainerBuildItem, final boolean noCustomAuthCompletionExMapper; final boolean noCustomAuthFailureExMapper; final boolean noCustomAuthRedirectExMapper; - if (vertxConfig.auth.proactive) { + if (vertxConfig.auth().proactive()) { noCustomAuthCompletionExMapper = notFoundCustomExMapper(AuthenticationCompletionException.class.getName(), AuthenticationCompletionExceptionMapper.class.getName(), exceptionMapping); noCustomAuthFailureExMapper = notFoundCustomExMapper(AuthenticationFailedException.class.getName(), @@ -1287,7 +1287,7 @@ public void setupDeployment(BeanContainerBuildItem beanContainerBuildItem, } Handler failureHandler = recorder.failureHandler(restInitialHandler, noCustomAuthCompletionExMapper, - noCustomAuthFailureExMapper, noCustomAuthRedirectExMapper, vertxConfig.auth.proactive); + noCustomAuthFailureExMapper, noCustomAuthRedirectExMapper, vertxConfig.auth().proactive()); // we add failure handler right before QuarkusErrorHandler // so that user can define failure handlers that precede exception mappers @@ -1506,10 +1506,10 @@ public List scan(MethodInfo method, ClassInfo actualEndp List securityHandlerList = consumeStandardSecurityAnnotations(method, actualEndpointClass, index, (c) -> Collections.singletonList( - EagerSecurityHandler.Customizer.newInstance(httpBuildTimeConfig.auth.proactive))); + EagerSecurityHandler.Customizer.newInstance(httpBuildTimeConfig.auth().proactive()))); if (securityHandlerList == null && (denyJaxRs || hasDefaultJaxRsRolesAllowed)) { securityHandlerList = Collections - .singletonList(EagerSecurityHandler.Customizer.newInstance(httpBuildTimeConfig.auth.proactive)); + .singletonList(EagerSecurityHandler.Customizer.newInstance(httpBuildTimeConfig.auth().proactive())); } if (applySecurityInterceptors && eagerSecurityInterceptors.get().applyInterceptorOn(method)) { List nextSecurityHandlerList = new ArrayList<>(); diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/ResteasyReactiveRecorder.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/ResteasyReactiveRecorder.java index 3a74e78586a49..f2c1cfca2f9fa 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/ResteasyReactiveRecorder.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/ResteasyReactiveRecorder.java @@ -131,7 +131,7 @@ public ResteasyReactiveRequestContext createContext(Deployment deployment, RuntimeDeploymentManager runtimeDeploymentManager = new RuntimeDeploymentManager(info, EXECUTOR_SUPPLIER, VirtualThreadsRecorder::getCurrent, closeTaskHandler, contextFactory, new ArcThreadSetupAction(beanContainer.requestContext()), - vertxConfig.rootPath); + vertxConfig.rootPath()); Deployment deployment = runtimeDeploymentManager.deploy(); DisabledRestEndpoints.set(deployment.getDisabledEndpoints()); initClassFactory.createInstance().getInstance().init(deployment); diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/ResteasyReactiveRuntimeRecorder.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/ResteasyReactiveRuntimeRecorder.java index fc7feb6161b7e..30772c618e8fe 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/ResteasyReactiveRuntimeRecorder.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/ResteasyReactiveRuntimeRecorder.java @@ -27,17 +27,17 @@ public Supplier runtimeConfiguration(RuntimeValue maxBodySize; - if (httpConf.limits.maxBodySize.isPresent()) { - maxBodySize = Optional.of(httpConf.limits.maxBodySize.get().asLongValue()); + if (httpConf.limits().maxBodySize().isPresent()) { + maxBodySize = Optional.of(httpConf.limits().maxBodySize().get().asLongValue()); } else { maxBodySize = Optional.empty(); } - RuntimeConfiguration runtimeConfiguration = new DefaultRuntimeConfiguration(httpConf.readTimeout, - httpConf.body.deleteUploadedFilesOnEnd, httpConf.body.uploadsDirectory, - httpConf.body.multipart.fileContentTypes.orElse(null), + RuntimeConfiguration runtimeConfiguration = new DefaultRuntimeConfiguration(httpConf.readTimeout(), + httpConf.body().deleteUploadedFilesOnEnd(), httpConf.body().uploadsDirectory(), + httpConf.body().multipart().fileContentTypes().orElse(null), runtimeConf.multipart().inputPart().defaultCharset(), maxBodySize, - httpConf.limits.maxFormAttributeSize.asLongValue()); + httpConf.limits().maxFormAttributeSize().asLongValue()); deployment.getValue().setRuntimeConfiguration(runtimeConfiguration); diff --git a/extensions/security-webauthn/runtime/src/main/java/io/quarkus/security/webauthn/WebAuthnRecorder.java b/extensions/security-webauthn/runtime/src/main/java/io/quarkus/security/webauthn/WebAuthnRecorder.java index d61bf70b3522c..72fd4f3c6155a 100644 --- a/extensions/security-webauthn/runtime/src/main/java/io/quarkus/security/webauthn/WebAuthnRecorder.java +++ b/extensions/security-webauthn/runtime/src/main/java/io/quarkus/security/webauthn/WebAuthnRecorder.java @@ -53,7 +53,7 @@ public Supplier setupWebAuthnAuthenticationMech @Override public WebAuthnAuthenticationMechanism get() { String key; - if (!httpConfiguration.getValue().encryptionKey.isPresent()) { + if (!httpConfiguration.getValue().encryptionKey().isPresent()) { if (encryptionKey != null) { //persist across dev mode restarts key = encryptionKey; @@ -64,7 +64,7 @@ public WebAuthnAuthenticationMechanism get() { log.warn("Encryption key was not specified for persistent WebAuthn auth, using temporary key " + key); } } else { - key = httpConfiguration.getValue().encryptionKey.get(); + key = httpConfiguration.getValue().encryptionKey().get(); } WebAuthnRunTimeConfig config = WebAuthnRecorder.this.config.getValue(); PersistentLoginManager loginManager = new PersistentLoginManager(key, config.cookieName, diff --git a/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java b/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java index 1281337f62a5f..e26b0c7da8f33 100644 --- a/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java +++ b/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java @@ -310,7 +310,7 @@ public void includeInOpenAPIEndpoint(BuildProducer startupPathItemProducer, BuildProducer port) { - if (managementInterfaceBuildTimeConfig.enabled) { + if (managementInterfaceBuildTimeConfig.enabled()) { // Switch to the "management" port port.produce(new KubernetesProbePortNameBuildItem("management", selectSchemeForManagement())); } diff --git a/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java b/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java index 59504bc294d33..d034b9d894d29 100644 --- a/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java +++ b/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java @@ -338,7 +338,7 @@ private String getManagementRoot(LaunchModeBuildItem launch, String managementRoot = nonApplicationRootPathBuildItem.resolveManagementPath("/", managementInterfaceBuildTimeConfig, launch, openApiConfig.managementEnabled); - return managementRoot.split(managementInterfaceBuildTimeConfig.rootPath)[0]; + return managementRoot.split(managementInterfaceBuildTimeConfig.rootPath())[0]; } @@ -435,7 +435,7 @@ void addAutoFilters(BuildProducer addToOpenAPID private boolean isManagement(ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig, SmallRyeOpenApiConfig smallRyeOpenApiConfig, LaunchModeBuildItem launchModeBuildItem) { - return managementInterfaceBuildTimeConfig.enabled && smallRyeOpenApiConfig.managementEnabled + return managementInterfaceBuildTimeConfig.enabled() && smallRyeOpenApiConfig.managementEnabled && launchModeBuildItem.getLaunchMode().equals(LaunchMode.DEVELOPMENT); } diff --git a/extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/OpenApiRecorder.java b/extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/OpenApiRecorder.java index 41d10839c2aec..212d2e8b72e58 100644 --- a/extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/OpenApiRecorder.java +++ b/extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/OpenApiRecorder.java @@ -30,7 +30,7 @@ public OpenApiRecorder(RuntimeValue configuration) { } public Consumer corsFilter(Filter filter) { - if (configuration.getValue().corsEnabled && filter.getHandler() != null) { + if (configuration.getValue().corsEnabled() && filter.getHandler() != null) { return new Consumer() { @Override public void accept(Route route) { diff --git a/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java b/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java index 06fd8dd5d7169..341bfc95cebb5 100644 --- a/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java +++ b/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java @@ -412,7 +412,7 @@ public ServletDeploymentManagerBuildItem build(List servlets, knownPaths.knownDirectories, launchMode.getLaunchMode(), shutdownContext, httpRootPath.relativePath(contextPath), servletConfig.defaultCharset, webMetaData.getRequestCharacterEncoding(), - webMetaData.getResponseCharacterEncoding(), httpBuildTimeConfig.auth.proactive, + webMetaData.getResponseCharacterEncoding(), httpBuildTimeConfig.auth().proactive(), webMetaData.getWelcomeFileList() != null ? webMetaData.getWelcomeFileList().getWelcomeFiles() : null, hasSecurityCapability(capabilities)); diff --git a/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/UndertowDeploymentRecorder.java b/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/UndertowDeploymentRecorder.java index b2c0692265d0d..3a4a46341cf6f 100644 --- a/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/UndertowDeploymentRecorder.java +++ b/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/UndertowDeploymentRecorder.java @@ -386,8 +386,8 @@ public void run() { undertowOptions.set(UndertowOptions.MAX_PARAMETERS, servletRuntimeConfig.maxParameters); UndertowOptionMap undertowOptionMap = undertowOptions.getMap(); - Set compressMediaTypes = httpBuildTimeConfig.enableCompression - ? Set.copyOf(httpBuildTimeConfig.compressMediaTypes.get()) + Set compressMediaTypes = httpBuildTimeConfig.enableCompression() + ? Set.copyOf(httpBuildTimeConfig.compressMediaTypes().get()) : Collections.emptySet(); return new Handler() { @@ -418,11 +418,11 @@ public void handle(AsyncResult result) { }); } - Optional maxBodySize = httpConfiguration.getValue().limits.maxBodySize; + Optional maxBodySize = httpConfiguration.getValue().limits().maxBodySize(); if (maxBodySize.isPresent()) { exchange.setMaxEntitySize(maxBodySize.get().asLongValue()); } - Duration readTimeout = httpConfiguration.getValue().readTimeout; + Duration readTimeout = httpConfiguration.getValue().readTimeout(); exchange.setReadTimeout(readTimeout.toMillis()); exchange.setUndertowOptions(undertowOptionMap); diff --git a/extensions/vertx-http/deployment/pom.xml b/extensions/vertx-http/deployment/pom.xml index 1c718f24ae0ed..90fd6328e4ab6 100644 --- a/extensions/vertx-http/deployment/pom.xml +++ b/extensions/vertx-http/deployment/pom.xml @@ -140,6 +140,11 @@ quarkus-junit5 test + + org.mockito + mockito-core + test + io.rest-assured rest-assured diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/HttpSecurityProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/HttpSecurityProcessor.java index 124bd5dc59e57..aa29d6ea1d849 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/HttpSecurityProcessor.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/HttpSecurityProcessor.java @@ -1,7 +1,6 @@ package io.quarkus.vertx.http.deployment; import static io.quarkus.arc.processor.DotNames.APPLICATION_SCOPED; -import static org.jboss.jandex.AnnotationTarget.Kind.CLASS; import java.security.Permission; import java.util.HashMap; @@ -72,19 +71,19 @@ public void builtins(BuildProducer producer, producer.produce(new HttpSecurityPolicyBuildItem("permit", new SupplierImpl<>(new PermitSecurityPolicy()))); producer.produce( new HttpSecurityPolicyBuildItem("authenticated", new SupplierImpl<>(new AuthenticatedHttpSecurityPolicy()))); - if (!buildTimeConfig.auth.permissions.isEmpty()) { + if (!buildTimeConfig.auth().permissions().isEmpty()) { beanProducer.produce(AdditionalBeanBuildItem.unremovableOf(PathMatchingHttpSecurityPolicy.class)); } Map> permClassToCreator = new HashMap<>(); - for (Map.Entry e : buildTimeConfig.auth.rolePolicy.entrySet()) { + for (Map.Entry e : buildTimeConfig.auth().rolePolicy().entrySet()) { PolicyConfig policyConfig = e.getValue(); - if (policyConfig.permissions.isEmpty()) { + if (policyConfig.permissions().isEmpty()) { producer.produce(new HttpSecurityPolicyBuildItem(e.getKey(), - new SupplierImpl<>(new RolesAllowedHttpSecurityPolicy(e.getValue().rolesAllowed)))); + new SupplierImpl<>(new RolesAllowedHttpSecurityPolicy(e.getValue().rolesAllowed())))); } else { // create HTTP Security policy that checks allowed roles and grants SecurityIdentity permissions to // requests that this policy allows to proceed - var permissionCreator = permClassToCreator.computeIfAbsent(policyConfig.permissionClass, + var permissionCreator = permClassToCreator.computeIfAbsent(policyConfig.permissionClass(), new Function>() { @Override public BiFunction apply(String s) { @@ -92,11 +91,11 @@ public BiFunction apply(String s) { return recorder.stringPermissionCreator(); } boolean constructorAcceptsActions = validateConstructor(combinedIndexBuildItem.getIndex(), - policyConfig.permissionClass); + policyConfig.permissionClass()); return recorder.customPermissionCreator(s, constructorAcceptsActions); } }); - var policy = recorder.createRolesAllowedPolicy(policyConfig.rolesAllowed, policyConfig.permissions, + var policy = recorder.createRolesAllowedPolicy(policyConfig.rolesAllowed(), policyConfig.permissions(), permissionCreator); producer.produce(new HttpSecurityPolicyBuildItem(e.getKey(), policy)); } @@ -166,11 +165,11 @@ SyntheticBeanBuildItem initFormAuth( HttpSecurityRecorder recorder, HttpBuildTimeConfig buildTimeConfig, BuildProducer filterBuildItemBuildProducer) { - if (!buildTimeConfig.auth.proactive) { - filterBuildItemBuildProducer.produce(RouteBuildItem.builder().route(buildTimeConfig.auth.form.postLocation) + if (!buildTimeConfig.auth().proactive()) { + filterBuildItemBuildProducer.produce(RouteBuildItem.builder().route(buildTimeConfig.auth().form().postLocation()) .handler(recorder.formAuthPostHandler()).build()); } - if (buildTimeConfig.auth.form.enabled) { + if (buildTimeConfig.auth().form().enabled()) { return SyntheticBeanBuildItem.configure(FormAuthenticationMechanism.class) .types(HttpAuthenticationMechanism.class) .setRuntimeInit() @@ -212,8 +211,8 @@ SyntheticBeanBuildItem initBasicAuth( .setRuntimeInit() .scope(Singleton.class) .supplier(recorder.setupBasicAuth(buildTimeConfig)); - if (!buildTimeConfig.auth.form.enabled && !isMtlsClientAuthenticationEnabled(buildTimeConfig) - && !buildTimeConfig.auth.basic.orElse(false)) { + if (!buildTimeConfig.auth().form().enabled() && !isMtlsClientAuthenticationEnabled(buildTimeConfig) + && !buildTimeConfig.auth().basic().orElse(false)) { //if not explicitly enabled we make this a default bean, so it is the fallback if nothing else is defined configurator.defaultBean(); securityInformationProducer.produce(SecurityInformationBuildItem.BASIC()); @@ -225,12 +224,12 @@ SyntheticBeanBuildItem initBasicAuth( public static boolean applicationBasicAuthRequired(HttpBuildTimeConfig buildTimeConfig, ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig) { //basic auth explicitly disabled - if (buildTimeConfig.auth.basic.isPresent() && !buildTimeConfig.auth.basic.get()) { + if (buildTimeConfig.auth().basic().isPresent() && !buildTimeConfig.auth().basic().get()) { return false; } - if (!buildTimeConfig.auth.basic.orElse(false)) { - if ((buildTimeConfig.auth.form.enabled || isMtlsClientAuthenticationEnabled(buildTimeConfig)) - || managementInterfaceBuildTimeConfig.auth.basic.orElse(false)) { + if (!buildTimeConfig.auth().basic().orElse(false)) { + if ((buildTimeConfig.auth().form().enabled() || isMtlsClientAuthenticationEnabled(buildTimeConfig)) + || managementInterfaceBuildTimeConfig.auth().basic().orElse(false)) { //if form auth is enabled and we are not then we don't install return false; } @@ -258,7 +257,7 @@ void setupAuthenticationMechanisms( policyMap.put(e.getName(), e.policySupplier); } - if (!buildTimeConfig.auth.form.enabled && buildTimeConfig.auth.basic.orElse(false)) { + if (!buildTimeConfig.auth().form().enabled() && buildTimeConfig.auth().basic().orElse(false)) { securityInformationProducer.produce(SecurityInformationBuildItem.BASIC()); } @@ -271,17 +270,17 @@ void setupAuthenticationMechanisms( .addBeanClass(HttpAuthorizer.class).build()); filterBuildItemBuildProducer .produce(new FilterBuildItem( - recorder.authenticationMechanismHandler(buildTimeConfig.auth.proactive), + recorder.authenticationMechanismHandler(buildTimeConfig.auth().proactive()), FilterBuildItem.AUTHENTICATION)); filterBuildItemBuildProducer .produce(new FilterBuildItem(recorder.permissionCheckHandler(), FilterBuildItem.AUTHORIZATION)); - if (!buildTimeConfig.auth.permissions.isEmpty()) { + if (!buildTimeConfig.auth().permissions().isEmpty()) { beanContainerListenerBuildItemBuildProducer .produce(new BeanContainerListenerBuildItem(recorder.initPermissions(buildTimeConfig, policyMap))); } } else { - if (!buildTimeConfig.auth.permissions.isEmpty()) { + if (!buildTimeConfig.auth().permissions().isEmpty()) { throw new IllegalStateException("HTTP permissions have been set however security is not enabled"); } } @@ -291,7 +290,7 @@ void setupAuthenticationMechanisms( void collectEagerSecurityInterceptors(List interceptorCandidates, HttpBuildTimeConfig buildTimeConfig, Capabilities capabilities, BuildProducer interceptorsProducer) { - if (!buildTimeConfig.auth.proactive && capabilities.isPresent(Capability.SECURITY) + if (!buildTimeConfig.auth().proactive() && capabilities.isPresent(Capability.SECURITY) && !interceptorCandidates.isEmpty()) { List allInterceptedMethodInfos = interceptorCandidates .stream() @@ -322,6 +321,6 @@ void produceEagerSecurityInterceptorStorage(HttpSecurityRecorder recorder, } private static boolean isMtlsClientAuthenticationEnabled(HttpBuildTimeConfig buildTimeConfig) { - return !ClientAuth.NONE.equals(buildTimeConfig.tlsClientAuth); + return !ClientAuth.NONE.equals(buildTimeConfig.tlsClientAuth()); } } diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/ManagementInterfaceSecurityProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/ManagementInterfaceSecurityProcessor.java index 07d36632f97ae..d296a55be2bd1 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/ManagementInterfaceSecurityProcessor.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/ManagementInterfaceSecurityProcessor.java @@ -36,7 +36,7 @@ public class ManagementInterfaceSecurityProcessor { @BuildStep public void builtins(ManagementInterfaceBuildTimeConfig buildTimeConfig, BuildProducer beanProducer) { - if (!buildTimeConfig.auth.permissions.isEmpty()) { + if (!buildTimeConfig.auth().permissions().isEmpty()) { beanProducer.produce(AdditionalBeanBuildItem.unremovableOf(ManagementPathMatchingHttpSecurityPolicy.class)); } } @@ -51,7 +51,7 @@ SyntheticBeanBuildItem initBasicAuth( return null; } - if (managementInterfaceBuildTimeConfig.auth.basic.orElse(false)) { + if (managementInterfaceBuildTimeConfig.auth().basic().orElse(false)) { SyntheticBeanBuildItem.ExtendedBeanConfigurator configurator = SyntheticBeanBuildItem .configure(BasicAuthenticationMechanism.class) .types(HttpAuthenticationMechanism.class) @@ -75,15 +75,15 @@ void setupAuthenticationMechanisms( ManagementInterfaceBuildTimeConfig buildTimeConfig) { Map> policyMap = new HashMap<>(); - for (Map.Entry e : buildTimeConfig.auth.rolePolicy.entrySet()) { + for (Map.Entry e : buildTimeConfig.auth().rolePolicy().entrySet()) { policyMap.put(e.getKey(), - new SupplierImpl<>(new RolesAllowedHttpSecurityPolicy(e.getValue().rolesAllowed))); + new SupplierImpl<>(new RolesAllowedHttpSecurityPolicy(e.getValue().rolesAllowed()))); } policyMap.put("deny", new SupplierImpl<>(new DenySecurityPolicy())); policyMap.put("permit", new SupplierImpl<>(new PermitSecurityPolicy())); policyMap.put("authenticated", new SupplierImpl<>(new AuthenticatedHttpSecurityPolicy())); - if (buildTimeConfig.auth.basic.orElse(false) + if (buildTimeConfig.auth().basic().orElse(false) && capabilities.isPresent(Capability.SECURITY)) { beanProducer .produce(AdditionalBeanBuildItem.builder().setUnremovable() @@ -91,17 +91,17 @@ void setupAuthenticationMechanisms( .addBeanClass(ManagementInterfaceHttpAuthorizer.class).build()); filterBuildItemBuildProducer .produce(new ManagementInterfaceFilterBuildItem( - recorder.authenticationMechanismHandler(buildTimeConfig.auth.proactive), + recorder.authenticationMechanismHandler(buildTimeConfig.auth().proactive()), ManagementInterfaceFilterBuildItem.AUTHENTICATION)); filterBuildItemBuildProducer .produce(new ManagementInterfaceFilterBuildItem(recorder.permissionCheckHandler(buildTimeConfig, policyMap), ManagementInterfaceFilterBuildItem.AUTHORIZATION)); - if (!buildTimeConfig.auth.permissions.isEmpty()) { + if (!buildTimeConfig.auth().permissions().isEmpty()) { beanContainerListenerBuildItemBuildProducer .produce(new BeanContainerListenerBuildItem(recorder.initPermissions(buildTimeConfig, policyMap))); } } else { - if (!buildTimeConfig.auth.permissions.isEmpty()) { + if (!buildTimeConfig.auth().permissions().isEmpty()) { throw new IllegalStateException("HTTP permissions have been set however security is not enabled"); } } diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/NonApplicationRootPathBuildItem.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/NonApplicationRootPathBuildItem.java index 1eea2aa28a267..917e1f07da444 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/NonApplicationRootPathBuildItem.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/NonApplicationRootPathBuildItem.java @@ -177,7 +177,7 @@ public String resolveManagementPath(String path, ManagementInterfaceBuildTimeCon if (path == null || path.trim().isEmpty()) { throw new IllegalArgumentException("Specified path can not be empty"); } - if (managementInterfaceBuildTimeConfig.enabled && extensionOverride) { + if (managementInterfaceBuildTimeConfig.enabled() && extensionOverride) { // Best effort String prefix = getManagementUrlPrefix(mode); if (managementRootPath != null) { diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxHttpProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxHttpProcessor.java index fd8ec2b3ce36e..43e490696f8e6 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxHttpProcessor.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxHttpProcessor.java @@ -92,17 +92,17 @@ LogCategoryBuildItem logging() { @BuildStep HttpRootPathBuildItem httpRoot(HttpBuildTimeConfig httpBuildTimeConfig) { - return new HttpRootPathBuildItem(httpBuildTimeConfig.rootPath); + return new HttpRootPathBuildItem(httpBuildTimeConfig.rootPath()); } @BuildStep NonApplicationRootPathBuildItem frameworkRoot(HttpBuildTimeConfig httpBuildTimeConfig, ManagementInterfaceBuildTimeConfig managementBuildTimeConfig) { String mrp = null; - if (managementBuildTimeConfig.enabled) { - mrp = managementBuildTimeConfig.rootPath; + if (managementBuildTimeConfig.enabled()) { + mrp = managementBuildTimeConfig.rootPath(); } - return new NonApplicationRootPathBuildItem(httpBuildTimeConfig.rootPath, httpBuildTimeConfig.nonApplicationRootPath, + return new NonApplicationRootPathBuildItem(httpBuildTimeConfig.rootPath(), httpBuildTimeConfig.nonApplicationRootPath(), mrp); } @@ -153,7 +153,7 @@ UnremovableBeanBuildItem shouldNotRemoveHttpServerOptionsCustomizers() { @BuildStep UseManagementInterfaceBuildItem useManagementInterfaceBuildItem(ManagementInterfaceBuildTimeConfig config) { - if (config.enabled) { + if (config.enabled()) { return new UseManagementInterfaceBuildItem(); } return null; @@ -183,7 +183,7 @@ public void kubernetes(BuildProducer kubernetesPorts) { public KubernetesPortBuildItem kubernetesForManagement( ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig) { return KubernetesPortBuildItem.fromRuntimeConfiguration("management", "quarkus.management.port", 9000, - managementInterfaceBuildTimeConfig.enabled); + managementInterfaceBuildTimeConfig.enabled()); } @BuildStep @@ -239,7 +239,7 @@ VertxWebRouterBuildItem initializeRouter(VertxHttpRecorder recorder, boolean mainRouterCreated = false; boolean managementRouterCreated = false; - boolean isManagementInterfaceEnabled = managementBuildTimeConfig.enabled; + boolean isManagementInterfaceEnabled = managementBuildTimeConfig.enabled(); for (RouteBuildItem route : routes) { if (route.isManagement() && isManagementInterfaceEnabled) { @@ -272,7 +272,7 @@ VertxWebRouterBuildItem initializeRouter(VertxHttpRecorder recorder, * To create mainrouter when `${quarkus.http.root-path}` is not {@literal /} * Refer https://github.com/quarkusio/quarkus/issues/34261 */ - if (!httpBuildTimeConfig.rootPath.equals("/") && !mainRouterCreated) { + if (!httpBuildTimeConfig.rootPath().equals("/") && !mainRouterCreated) { mainRouter = recorder.initializeRouter(vertx.getVertx()); } @@ -399,7 +399,7 @@ void openSocket(ApplicationStartBuildItem start, List websocketSubProtocols, Capabilities capabilities, VertxHttpRecorder recorder) throws IOException { - boolean startVirtual = requireVirtual.isPresent() || httpBuildTimeConfig.virtual; + boolean startVirtual = requireVirtual.isPresent() || httpBuildTimeConfig.virtual(); if (startVirtual) { reflectiveClass .produce(ReflectiveClassBuildItem.builder(VirtualServerChannel.class) diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/ConfiguredPathInfo.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/ConfiguredPathInfo.java index cea49d8df6854..b19f44dfb769f 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/ConfiguredPathInfo.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/ConfiguredPathInfo.java @@ -33,7 +33,7 @@ public String getEndpointPath(HttpRootPathBuildItem httpRoot) { public String getEndpointPath(NonApplicationRootPathBuildItem nonAppRoot, ManagementInterfaceBuildTimeConfig mibt, LaunchModeBuildItem mode) { - if (management && mibt.enabled) { + if (management && mibt.enabled()) { var prefix = NonApplicationRootPathBuildItem.getManagementUrlPrefix(mode); return prefix + endpointPath; } diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/cors/CORSWildcardSecurityTestCase.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/cors/CORSWildcardSecurityTestCase.java index e364866570885..852dce392609a 100644 --- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/cors/CORSWildcardSecurityTestCase.java +++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/cors/CORSWildcardSecurityTestCase.java @@ -21,7 +21,7 @@ public class CORSWildcardSecurityTestCase { private static final String APP_PROPS = "" + - "quarkus.http.cors=true\n" + + "quarkus.http.cors.enabled=true\n" + "quarkus.http.cors.origins=*\n" + "quarkus.http.auth.basic=true\n" + "quarkus.http.auth.policy.r1.roles-allowed=test\n" + diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/deployment/NonApplicationRootPathBuildItemTest.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/deployment/NonApplicationRootPathBuildItemTest.java index 90796a00e584c..db5e778c2eadf 100644 --- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/deployment/NonApplicationRootPathBuildItemTest.java +++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/deployment/NonApplicationRootPathBuildItemTest.java @@ -1,5 +1,8 @@ package io.quarkus.vertx.http.deployment; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import java.util.Optional; import org.junit.jupiter.api.Assertions; @@ -108,15 +111,15 @@ void testResolvePathWithSlashWithSlashQWithWildcards() { @Test void testResolveManagementPathWithRelativeRootPath() { - ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig = new ManagementInterfaceBuildTimeConfig(); - managementInterfaceBuildTimeConfig.enabled = true; - managementInterfaceBuildTimeConfig.rootPath = "management"; + ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig = mock(ManagementInterfaceBuildTimeConfig.class); + when(managementInterfaceBuildTimeConfig.enabled()).thenReturn(true); + when(managementInterfaceBuildTimeConfig.rootPath()).thenReturn("management"); LaunchModeBuildItem launchModeBuildItem = new LaunchModeBuildItem(LaunchMode.NORMAL, Optional.empty(), false, Optional.empty(), false); NonApplicationRootPathBuildItem buildItem = new NonApplicationRootPathBuildItem("/", "q", - managementInterfaceBuildTimeConfig.rootPath); + managementInterfaceBuildTimeConfig.rootPath()); Assertions.assertEquals("/management/", buildItem.getManagementRootPath()); Assertions.assertEquals("http://0.0.0.0:9000/management/foo", buildItem.resolveManagementPath("foo", managementInterfaceBuildTimeConfig, launchModeBuildItem)); @@ -134,15 +137,15 @@ void testResolveManagementPathWithRelativeRootPath() { @Test void testResolveManagementPathWithRelativeRootPathInTestMode() { - ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig = new ManagementInterfaceBuildTimeConfig(); - managementInterfaceBuildTimeConfig.enabled = true; - managementInterfaceBuildTimeConfig.rootPath = "management"; + ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig = mock(ManagementInterfaceBuildTimeConfig.class); + when(managementInterfaceBuildTimeConfig.enabled()).thenReturn(true); + when(managementInterfaceBuildTimeConfig.rootPath()).thenReturn("management"); LaunchModeBuildItem launchModeBuildItem = new LaunchModeBuildItem(LaunchMode.NORMAL, Optional.empty(), false, Optional.empty(), true); NonApplicationRootPathBuildItem buildItem = new NonApplicationRootPathBuildItem("/", "q", - managementInterfaceBuildTimeConfig.rootPath); + managementInterfaceBuildTimeConfig.rootPath()); Assertions.assertEquals("/management/", buildItem.getManagementRootPath()); Assertions.assertEquals("http://0.0.0.0:9001/management/foo", buildItem.resolveManagementPath("foo", managementInterfaceBuildTimeConfig, launchModeBuildItem)); @@ -160,9 +163,9 @@ void testResolveManagementPathWithRelativeRootPathInTestMode() { @Test void testResolveManagementPathWithRelativeRootPathAndWithManagementDisabled() { - ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig = new ManagementInterfaceBuildTimeConfig(); - managementInterfaceBuildTimeConfig.enabled = false; - managementInterfaceBuildTimeConfig.rootPath = "management"; + ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig = mock(ManagementInterfaceBuildTimeConfig.class); + when(managementInterfaceBuildTimeConfig.enabled()).thenReturn(false); + when(managementInterfaceBuildTimeConfig.rootPath()).thenReturn("management"); LaunchModeBuildItem launchModeBuildItem = new LaunchModeBuildItem(LaunchMode.NORMAL, Optional.empty(), false, Optional.empty(), false); @@ -186,15 +189,15 @@ void testResolveManagementPathWithRelativeRootPathAndWithManagementDisabled() { @Test void testResolveManagementPathWithAbsoluteRootPath() { - ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig = new ManagementInterfaceBuildTimeConfig(); - managementInterfaceBuildTimeConfig.enabled = true; - managementInterfaceBuildTimeConfig.rootPath = "/management"; + ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig = mock(ManagementInterfaceBuildTimeConfig.class); + when(managementInterfaceBuildTimeConfig.enabled()).thenReturn(true); + when(managementInterfaceBuildTimeConfig.rootPath()).thenReturn("/management"); LaunchModeBuildItem launchModeBuildItem = new LaunchModeBuildItem(LaunchMode.NORMAL, Optional.empty(), false, Optional.empty(), false); NonApplicationRootPathBuildItem buildItem = new NonApplicationRootPathBuildItem("/", "/q", - managementInterfaceBuildTimeConfig.rootPath); + managementInterfaceBuildTimeConfig.rootPath()); Assertions.assertEquals("/management/", buildItem.getManagementRootPath()); Assertions.assertEquals("http://0.0.0.0:9000/management/foo", buildItem.resolveManagementPath("foo", managementInterfaceBuildTimeConfig, launchModeBuildItem)); @@ -212,15 +215,15 @@ void testResolveManagementPathWithAbsoluteRootPath() { @Test void testResolveManagementPathWithEmptyRootPath() { - ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig = new ManagementInterfaceBuildTimeConfig(); - managementInterfaceBuildTimeConfig.enabled = true; - managementInterfaceBuildTimeConfig.rootPath = ""; + ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig = mock(ManagementInterfaceBuildTimeConfig.class); + when(managementInterfaceBuildTimeConfig.enabled()).thenReturn(true); + when(managementInterfaceBuildTimeConfig.rootPath()).thenReturn(""); LaunchModeBuildItem launchModeBuildItem = new LaunchModeBuildItem(LaunchMode.NORMAL, Optional.empty(), false, Optional.empty(), false); NonApplicationRootPathBuildItem buildItem = new NonApplicationRootPathBuildItem("/", "/q", - managementInterfaceBuildTimeConfig.rootPath); + managementInterfaceBuildTimeConfig.rootPath()); Assertions.assertEquals("/", buildItem.getManagementRootPath()); Assertions.assertEquals("http://0.0.0.0:9000/foo", buildItem.resolveManagementPath("foo", managementInterfaceBuildTimeConfig, launchModeBuildItem)); @@ -238,15 +241,15 @@ void testResolveManagementPathWithEmptyRootPath() { @Test void testResolveManagementPathWithWithWildcards() { - ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig = new ManagementInterfaceBuildTimeConfig(); - managementInterfaceBuildTimeConfig.enabled = true; - managementInterfaceBuildTimeConfig.rootPath = "/management"; + ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig = mock(ManagementInterfaceBuildTimeConfig.class); + when(managementInterfaceBuildTimeConfig.enabled()).thenReturn(true); + when(managementInterfaceBuildTimeConfig.rootPath()).thenReturn("/management"); LaunchModeBuildItem launchModeBuildItem = new LaunchModeBuildItem(LaunchMode.NORMAL, Optional.empty(), false, Optional.empty(), false); NonApplicationRootPathBuildItem buildItem = new NonApplicationRootPathBuildItem("/", "/q", - managementInterfaceBuildTimeConfig.rootPath); + managementInterfaceBuildTimeConfig.rootPath()); Assertions.assertEquals("http://0.0.0.0:9000/management/foo/*", buildItem.resolveManagementPath("foo/*", managementInterfaceBuildTimeConfig, launchModeBuildItem)); Assertions.assertEquals("http://0.0.0.0:9000/foo/*", diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/BodyHandlerBean.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/BodyHandlerBean.java index 7d355f2aa9a2d..016f4329c718d 100644 --- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/BodyHandlerBean.java +++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/BodyHandlerBean.java @@ -2,26 +2,34 @@ import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.event.Observes; +import jakarta.inject.Inject; import io.quarkus.runtime.RuntimeValue; -import io.quarkus.runtime.configuration.ConfigInstantiator; import io.quarkus.vertx.http.runtime.HttpBuildTimeConfig; import io.quarkus.vertx.http.runtime.HttpConfiguration; import io.quarkus.vertx.http.runtime.VertxHttpRecorder; import io.quarkus.vertx.http.runtime.management.ManagementInterfaceBuildTimeConfig; +import io.quarkus.vertx.http.runtime.management.ManagementInterfaceConfiguration; import io.vertx.core.Handler; import io.vertx.ext.web.Router; import io.vertx.ext.web.RoutingContext; @ApplicationScoped public class BodyHandlerBean { + @Inject + HttpConfiguration httpConfiguration; + @Inject + HttpBuildTimeConfig httpBuildTimeConfig; + @Inject + ManagementInterfaceConfiguration managementInterfaceConfiguration; + @Inject + ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig; void setup(@Observes Router router) { - HttpConfiguration httpConfiguration = new HttpConfiguration(); - ConfigInstantiator.handleObject(httpConfiguration); - Handler bodyHandler = new VertxHttpRecorder(new HttpBuildTimeConfig(), - new ManagementInterfaceBuildTimeConfig(), - new RuntimeValue<>(httpConfiguration), null) + Handler bodyHandler = new VertxHttpRecorder(httpBuildTimeConfig, + managementInterfaceBuildTimeConfig, + new RuntimeValue<>(httpConfiguration), + new RuntimeValue<>(managementInterfaceConfiguration)) .createBodyHandler(); router.route().order(Integer.MIN_VALUE + 1).handler(new Handler() { @Override diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devmode/ArcEndpointTest.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devmode/ArcEndpointTest.java index a2644f677996e..2b950c476d2d6 100644 --- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devmode/ArcEndpointTest.java +++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devmode/ArcEndpointTest.java @@ -60,7 +60,6 @@ public void testBeans() { @Named @ApplicationScoped public static class Foo { - @Inject HttpBuildTimeConfig httpConfig; @@ -68,8 +67,7 @@ void onStart(@Observes StartupEvent event) { } void addConfigRoute(@Observes Router router) { - router.route("/console-path").handler(rc -> rc.response().end(httpConfig.nonApplicationRootPath)); + router.route("/console-path").handler(rc -> rc.response().end(httpConfig.nonApplicationRootPath())); } - } } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/AccessLogConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/AccessLogConfig.java index 7c21a31bccfe1..762dcd9fe4605 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/AccessLogConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/AccessLogConfig.java @@ -2,23 +2,19 @@ import java.util.Optional; -import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; - -@ConfigGroup -public class AccessLogConfig { +import io.smallrye.config.WithDefault; +public interface AccessLogConfig { /** * If access logging is enabled. By default this will log via the standard logging facility */ - @ConfigItem(defaultValue = "false") - public boolean enabled; + @WithDefault("false") + boolean enabled(); /** * A regular expression that can be used to exclude some paths from logging. */ - @ConfigItem - Optional excludePattern; + Optional excludePattern(); /** * The access log pattern. @@ -33,48 +29,46 @@ public class AccessLogConfig { * * @asciidoclet */ - @ConfigItem(defaultValue = "common") - public String pattern; + @WithDefault("common") + String pattern(); /** * If logging should be done to a separate file. */ - @ConfigItem(defaultValue = "false") - public boolean logToFile; + @WithDefault("false") + boolean logToFile(); /** * The access log file base name, defaults to 'quarkus' which will give a log file * name of 'quarkus.log'. * */ - @ConfigItem(defaultValue = "quarkus") - public String baseFileName; + @WithDefault("quarkus") + String baseFileName(); /** * The log directory to use when logging access to a file * * If this is not set then the current working directory is used. */ - @ConfigItem - public Optional logDirectory; + Optional logDirectory(); /** * The log file suffix */ - @ConfigItem(defaultValue = ".log") - public String logSuffix; + @WithDefault(".log") + String logSuffix(); /** * The log category to use if logging is being done via the standard log mechanism (i.e. if base-file-name is empty). * */ - @ConfigItem(defaultValue = "io.quarkus.http.access-log") - public String category; + @WithDefault("io.quarkus.http.access-log") + String category(); /** * If the log should be rotated daily */ - @ConfigItem(defaultValue = "true") - public boolean rotate; - + @WithDefault("true") + boolean rotate(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/AuthConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/AuthConfig.java index 3e609d66f9825..7bba5d0245741 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/AuthConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/AuthConfig.java @@ -3,46 +3,42 @@ import java.util.Map; import java.util.Optional; -import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; +import io.smallrye.config.WithDefault; +import io.smallrye.config.WithName; /** * Authentication mechanism and SecurityRealm name information used for configuring HTTP auth * instance for the deployment. */ -@ConfigGroup -public class AuthConfig { +public interface AuthConfig { /** * If basic auth should be enabled. If both basic and form auth is enabled then basic auth will be enabled in silent mode. * * If no authentication mechanisms are configured basic auth is the default. */ - @ConfigItem - public Optional basic; + Optional basic(); /** * Form Auth config */ - @ConfigItem - public FormAuthConfig form; + FormAuthConfig form(); /** * The authentication realm */ - @ConfigItem - public Optional realm; + Optional realm(); /** * The HTTP permissions */ - @ConfigItem(name = "permission") - public Map permissions; + @WithName("permission") + Map permissions(); /** * The HTTP role based policies */ - @ConfigItem(name = "policy") - public Map rolePolicy; + @WithName("policy") + Map rolePolicy(); /** * If this is true and credentials are present then a user will always be authenticated @@ -51,6 +47,6 @@ public class AuthConfig { * If this is false then an attempt will only be made to authenticate the user if a permission * check is performed or the current user is required for some other reason. */ - @ConfigItem(defaultValue = "true") - public boolean proactive; + @WithDefault("true") + boolean proactive(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/BodyConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/BodyConfig.java index 1c8723f7f33e4..b404a052b0111 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/BodyConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/BodyConfig.java @@ -1,14 +1,11 @@ package io.quarkus.vertx.http.runtime; -import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; +import io.smallrye.config.WithDefault; /** * Request body related settings */ -@ConfigGroup -public class BodyConfig { - +public interface BodyConfig { /** * Whether the files sent using {@code multipart/form-data} will be stored locally. *

@@ -18,16 +15,16 @@ public class BodyConfig { * will always return an empty collection. Note that even with this option being set to {@code false}, the * {@code multipart/form-data} requests will be accepted. */ - @ConfigItem(defaultValue = "true") - public boolean handleFileUploads; + @WithDefault("true") + boolean handleFileUploads(); /** * The directory where the files sent using {@code multipart/form-data} should be stored. *

* Either an absolute path or a path relative to the current directory of the application process. */ - @ConfigItem(defaultValue = "${java.io.tmpdir}/uploads") - public String uploadsDirectory; + @WithDefault("${java.io.tmpdir}/uploads") + String uploadsDirectory(); /** * Whether the form attributes should be added to the request parameters. @@ -35,8 +32,8 @@ public class BodyConfig { * If {@code true}, the form attributes will be added to the request parameters; otherwise the form parameters will * not be added to the request parameters */ - @ConfigItem(defaultValue = "true") - public boolean mergeFormAttributes; + @WithDefault("true") + boolean mergeFormAttributes(); /** * Whether the uploaded files should be removed after serving the request. @@ -44,8 +41,8 @@ public class BodyConfig { * If {@code true} the uploaded files stored in {@code quarkus.http.body-handler.uploads-directory} will be removed * after handling the request. Otherwise, the files will be left there forever. */ - @ConfigItem(defaultValue = "true") - public boolean deleteUploadedFilesOnEnd; + @WithDefault("true") + boolean deleteUploadedFilesOnEnd(); /** * Whether the body buffer should pre-allocated based on the {@code Content-Length} header value. @@ -53,12 +50,11 @@ public class BodyConfig { * If {@code true} the body buffer is pre-allocated according to the size read from the {@code Content-Length} * header. Otherwise, the body buffer is pre-allocated to 1KB, and is resized dynamically */ - @ConfigItem - public boolean preallocateBodyBuffer; + @WithDefault("false") + boolean preallocateBodyBuffer(); /** * HTTP multipart request related settings */ - @ConfigItem - public MultiPartConfig multipart; + MultiPartConfig multipart(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/CertificateConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/CertificateConfig.java index 1d8fa0a4f5936..f28028bbfbd87 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/CertificateConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/CertificateConfig.java @@ -4,18 +4,13 @@ import java.util.List; import java.util.Optional; -import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; -import io.quarkus.runtime.annotations.ConvertWith; import io.quarkus.runtime.configuration.TrimmedStringConverter; +import io.smallrye.config.WithConverter; /** * A certificate configuration. Either the certificate and key files must be given, or a key store must be given. */ -@ConfigGroup -@SuppressWarnings("OptionalUsedAsFieldOrParameterType") -public class CertificateConfig { - +public interface CertificateConfig { /** * The {@linkplain CredentialsProvider}. * If this property is configured then a matching 'CredentialsProvider' will be used @@ -24,9 +19,8 @@ public class CertificateConfig { * Please note that using MicroProfile {@linkplain ConfigSource} which is directly supported by Quarkus Configuration * should be preferred unless using `CredentialsProvider` provides for some additional security and dynamism. */ - @ConfigItem - @ConvertWith(TrimmedStringConverter.class) - public Optional credentialsProvider = Optional.empty(); + @WithConverter(TrimmedStringConverter.class) + Optional credentialsProvider(); /** * The credentials provider bean name. @@ -36,16 +30,14 @@ public class CertificateConfig { * It is recommended to set this property even if there is only one credentials provider currently available * to ensure the same provider is always found in deployments where more than one provider may be available. */ - @ConfigItem - @ConvertWith(TrimmedStringConverter.class) - public Optional credentialsProviderName = Optional.empty(); + @WithConverter(TrimmedStringConverter.class) + Optional credentialsProviderName(); /** * The list of path to server certificates using the PEM format. * Specifying multiple files require SNI to be enabled. */ - @ConfigItem - public Optional> files; + Optional> files(); /** * The list of path to server certificates private key file using the PEM format. @@ -53,28 +45,24 @@ public class CertificateConfig { * * The order of the key files must match the order of the certificates. */ - @ConfigItem - public Optional> keyFiles; + Optional> keyFiles(); /** * An optional key store which holds the certificate information instead of specifying separate files. */ - @ConfigItem - public Optional keyStoreFile; + Optional keyStoreFile(); /** * An optional parameter to specify type of the key store file. If not given, the type is automatically detected * based on the file name. */ - @ConfigItem - public Optional keyStoreFileType; + Optional keyStoreFileType(); /** * An optional parameter to specify a provider of the key store file. If not given, the provider is automatically detected * based on the key store file type. */ - @ConfigItem - public Optional keyStoreProvider; + Optional keyStoreProvider(); /** * A parameter to specify the password of the key store file. If not given, and if it can not be retrieved from @@ -82,8 +70,7 @@ public class CertificateConfig { * * @see {@link #credentialsProvider} */ - @ConfigItem(defaultValueDocumentation = "password") - public Optional keyStorePassword; + Optional keyStorePassword(); /** * A parameter to specify a {@linkplain CredentialsProvider} property key which can be used to get the password of the key @@ -92,15 +79,13 @@ public class CertificateConfig { * * @see {@link #credentialsProvider} */ - @ConfigItem - public Optional keyStorePasswordKey; + Optional keyStorePasswordKey(); /** * An optional parameter to select a specific key in the key store. When SNI is disabled, if the key store contains multiple * keys and no alias is specified, the behavior is undefined. */ - @ConfigItem - public Optional keyStoreKeyAlias; + Optional keyStoreKeyAlias(); /** * An optional parameter to define the password for the key, in case it's different from {@link #keyStorePassword} @@ -108,8 +93,7 @@ public class CertificateConfig { * * @see {@link #credentialsProvider}. */ - @ConfigItem - public Optional keyStoreKeyPassword; + Optional keyStoreKeyPassword(); /** * A parameter to specify a {@linkplain CredentialsProvider} property key which can be used to get the password for the key @@ -117,28 +101,24 @@ public class CertificateConfig { * * @see {@link #credentialsProvider} */ - @ConfigItem - public Optional keyStoreKeyPasswordKey; + Optional keyStoreKeyPasswordKey(); /** * An optional trust store which holds the certificate information of the certificates to trust. */ - @ConfigItem - public Optional trustStoreFile; + Optional trustStoreFile(); /** * An optional parameter to specify type of the trust store file. If not given, the type is automatically detected * based on the file name. */ - @ConfigItem - public Optional trustStoreFileType; + Optional trustStoreFileType(); /** * An optional parameter to specify a provider of the trust store file. If not given, the provider is automatically detected * based on the trust store file type. */ - @ConfigItem - public Optional trustStoreProvider; + Optional trustStoreProvider(); /** * A parameter to specify the password of the trust store file. @@ -146,8 +126,7 @@ public class CertificateConfig { * * @see {@link #credentialsProvider}. */ - @ConfigItem - public Optional trustStorePassword; + Optional trustStorePassword(); /** * A parameter to specify a {@linkplain CredentialsProvider} property key which can be used to get the password of the trust @@ -156,13 +135,11 @@ public class CertificateConfig { * * @see {@link #credentialsProvider} */ - @ConfigItem - public Optional trustStorePasswordKey; + Optional trustStorePasswordKey(); /** * An optional parameter to trust only one specific certificate in the trust store (instead of trusting all certificates in * the store). */ - @ConfigItem - public Optional trustStoreCertAlias; + Optional trustStoreCertAlias(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/FilterConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/FilterConfig.java index 285a581d7759f..33a0fe44ea739 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/FilterConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/FilterConfig.java @@ -5,32 +5,25 @@ import java.util.Optional; import java.util.OptionalInt; -import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; - -@ConfigGroup -public class FilterConfig { +public interface FilterConfig { /** * A regular expression for the paths matching this configuration */ - @ConfigItem - public String matches; + String matches(); /** * Additional HTTP Headers always sent in the response */ - @ConfigItem - public Map header; + Map header(); /** * The HTTP methods for this path configuration */ - @ConfigItem - public Optional> methods; + Optional> methods(); /** * Order in which this path config is applied. Higher priority takes precedence */ - public OptionalInt order; + OptionalInt order(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/FormAuthConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/FormAuthConfig.java index e08e6595129ba..bd47b3d99ef94 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/FormAuthConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/FormAuthConfig.java @@ -3,18 +3,16 @@ import java.time.Duration; import java.util.Optional; -import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; +import io.smallrye.config.WithDefault; /** * config for the form authentication mechanism */ -@ConfigGroup -public class FormAuthConfig { +public interface FormAuthConfig { /** * SameSite attribute values for the session and location cookies. */ - public enum CookieSameSite { + enum CookieSameSite { STRICT, LAX, NONE @@ -23,45 +21,45 @@ public enum CookieSameSite { /** * If form authentication is enabled. */ - @ConfigItem - public boolean enabled; + @WithDefault("false") + boolean enabled(); /** * The login page. Redirect to login page can be disabled by setting `quarkus.http.auth.form.login-page=`. */ - @ConfigItem(defaultValue = "/login.html") - public Optional loginPage; + @WithDefault("/login.html") + Optional loginPage(); /** * The post location. */ - @ConfigItem(defaultValue = "/j_security_check") - public String postLocation; + @WithDefault("/j_security_check") + String postLocation(); /** * The username field name. */ - @ConfigItem(defaultValue = "j_username") - public String usernameParameter; + @WithDefault("j_username") + String usernameParameter(); /** * The password field name. */ - @ConfigItem(defaultValue = "j_password") - public String passwordParameter; + @WithDefault("j_password") + String passwordParameter(); /** * The error page. Redirect to error page can be disabled by setting `quarkus.http.auth.form.error-page=`. */ - @ConfigItem(defaultValue = "/error.html") - public Optional errorPage; + @WithDefault("/error.html") + Optional errorPage(); /** * The landing page to redirect to if there is no saved page to redirect back to. * Redirect to landing page can be disabled by setting `quarkus.http.auth.form.landing-page=`. */ - @ConfigItem(defaultValue = "/index.html") - public Optional landingPage; + @WithDefault("/index.html") + Optional landingPage(); /** * Option to disable redirect to landingPage if there is no saved page to redirect back to. Form Auth POST is followed @@ -71,24 +69,24 @@ public enum CookieSameSite { * (via `quarkus.http.auth.form.landing-page=`). Quarkus will ignore this configuration property * if there is no landing page. */ - @ConfigItem(defaultValue = "true") + @WithDefault("true") @Deprecated - public boolean redirectAfterLogin; + boolean redirectAfterLogin(); /** * Option to control the name of the cookie used to redirect the user back * to where he wants to get access to. */ - @ConfigItem(defaultValue = "quarkus-redirect-location") - public String locationCookie; + @WithDefault("quarkus-redirect-location") + String locationCookie(); /** * The inactivity (idle) timeout * * When inactivity timeout is reached, cookie is not renewed and a new login is enforced. */ - @ConfigItem(defaultValue = "PT30M") - public Duration timeout; + @WithDefault("PT30M") + Duration timeout(); /** * How old a cookie can get before it will be replaced with a new cookie with an updated timeout, also @@ -105,30 +103,30 @@ public enum CookieSameSite { * In other words no timeout is tracked on the server side; the timestamp is encoded and encrypted in the cookie itself, * and it is decrypted and parsed with each request. */ - @ConfigItem(defaultValue = "PT1M") - public Duration newCookieInterval; + @WithDefault("PT1M") + Duration newCookieInterval(); /** * The cookie that is used to store the persistent session */ - @ConfigItem(defaultValue = "quarkus-credential") - public String cookieName; + @WithDefault("quarkus-credential") + String cookieName(); /** * The cookie path for the session and location cookies. */ - @ConfigItem(defaultValue = "/") - public Optional cookiePath = Optional.of("/"); + @WithDefault("/") + Optional cookiePath(); /** * Set the HttpOnly attribute to prevent access to the cookie via JavaScript. */ - @ConfigItem(defaultValue = "false") - public boolean httpOnlyCookie; + @WithDefault("false") + boolean httpOnlyCookie(); /** * SameSite attribute for the session and location cookies. */ - @ConfigItem(defaultValue = "strict") - public CookieSameSite cookieSameSite = CookieSameSite.STRICT; + @WithDefault("strict") + CookieSameSite cookieSameSite(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardingProxyOptions.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardingProxyOptions.java index e7c0cf032a6fb..38de21a30e306 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardingProxyOptions.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardingProxyOptions.java @@ -35,17 +35,17 @@ public ForwardingProxyOptions(final boolean proxyAddressForwarding, } public static ForwardingProxyOptions from(ProxyConfig proxy) { - final boolean proxyAddressForwarding = proxy.proxyAddressForwarding; - final boolean allowForwarded = proxy.allowForwarded; - final boolean allowXForwarded = proxy.allowXForwarded.orElse(!allowForwarded); + final boolean proxyAddressForwarding = proxy.proxyAddressForwarding(); + final boolean allowForwarded = proxy.allowForwarded(); + final boolean allowXForwarded = proxy.allowXForwarded().orElse(!allowForwarded); - final boolean enableForwardedHost = proxy.enableForwardedHost; - final boolean enableForwardedPrefix = proxy.enableForwardedPrefix; - final AsciiString forwardedPrefixHeader = AsciiString.cached(proxy.forwardedPrefixHeader); - final AsciiString forwardedHostHeader = AsciiString.cached(proxy.forwardedHostHeader); + final boolean enableForwardedHost = proxy.enableForwardedHost(); + final boolean enableForwardedPrefix = proxy.enableForwardedPrefix(); + final AsciiString forwardedPrefixHeader = AsciiString.cached(proxy.forwardedPrefixHeader()); + final AsciiString forwardedHostHeader = AsciiString.cached(proxy.forwardedHostHeader()); - final List parts = proxy.trustedProxies - .isPresent() ? List.copyOf(proxy.trustedProxies.get()) : List.of(); + final List parts = proxy.trustedProxies() + .isPresent() ? List.copyOf(proxy.trustedProxies().get()) : List.of(); final var proxyCheckBuilder = (!allowXForwarded && !allowForwarded) || parts.isEmpty() ? null : TrustedProxyCheckBuilder.builder(parts); diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/HeaderConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/HeaderConfig.java index 98a247bf2f0cd..3996865b37a8f 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/HeaderConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/HeaderConfig.java @@ -3,30 +3,26 @@ import java.util.List; import java.util.Optional; -import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; +import io.smallrye.config.WithDefault; /** * Configuration that allows for setting an HTTP header */ -@ConfigGroup -public class HeaderConfig { +public interface HeaderConfig { /** * The path this header should be applied */ - @ConfigItem(defaultValue = "/*") - public String path; + @WithDefault("/*") + String path(); /** * The value for this header configuration */ - @ConfigItem - public String value; + String value(); /** * The HTTP methods for this header configuration */ - @ConfigItem - public Optional> methods; + Optional> methods(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/HttpBuildTimeConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/HttpBuildTimeConfig.java index e672c5e7e0769..a269e2f216600 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/HttpBuildTimeConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/HttpBuildTimeConfig.java @@ -5,40 +5,46 @@ import java.util.Optional; import java.util.OptionalInt; -import io.quarkus.runtime.annotations.ConfigItem; import io.quarkus.runtime.annotations.ConfigPhase; import io.quarkus.runtime.annotations.ConfigRoot; -import io.quarkus.runtime.annotations.ConvertWith; import io.quarkus.runtime.configuration.NormalizeRootHttpPathConverter; import io.quarkus.vertx.http.Compressed; import io.quarkus.vertx.http.Uncompressed; +import io.smallrye.config.ConfigMapping; +import io.smallrye.config.WithConverter; +import io.smallrye.config.WithDefault; +import io.smallrye.config.WithName; import io.vertx.core.http.ClientAuth; -@ConfigRoot(name = "http", phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED) -public class HttpBuildTimeConfig { - +@ConfigMapping(prefix = "quarkus.http") +@ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED) +public interface HttpBuildTimeConfig { /** * The HTTP root path. All web content will be served relative to this root path. */ - @ConfigItem(defaultValue = "/") - @ConvertWith(NormalizeRootHttpPathConverter.class) - public String rootPath; + @WithDefault("/") + @WithConverter(NormalizeRootHttpPathConverter.class) + String rootPath(); - public AuthConfig auth; + /** + * Authentication configuration. + */ + AuthConfig auth(); /** * Configures the engine to require/request client authentication. * NONE, REQUEST, REQUIRED */ - @ConfigItem(name = "ssl.client-auth", defaultValue = "NONE") - public ClientAuth tlsClientAuth; + @WithName("ssl.client-auth") + @WithDefault("NONE") + ClientAuth tlsClientAuth(); /** * If this is true then only a virtual channel will be set up for vertx web. * We have this switch for testing purposes. */ - @ConfigItem - public boolean virtual; + @WithDefault("false") + boolean virtual(); /** * A common root path for non-application endpoints. Various extension-provided endpoints such as metrics, health, @@ -57,14 +63,14 @@ public class HttpBuildTimeConfig { * * @asciidoclet */ - @ConfigItem(defaultValue = "q") - public String nonApplicationRootPath; + @WithDefault("q") + String nonApplicationRootPath(); /** * The REST Assured client timeout for testing. */ - @ConfigItem(defaultValue = "30s") - public Duration testTimeout; + @WithDefault("30s") + Duration testTimeout(); /** * If enabled then the response body is compressed if the {@code Content-Type} header is set and the value is a compressed @@ -74,8 +80,8 @@ public class HttpBuildTimeConfig { * declaratively using the annotations {@link io.quarkus.vertx.http.Compressed} and * {@link io.quarkus.vertx.http.Uncompressed}. */ - @ConfigItem - public boolean enableCompression; + @WithDefault("false") + boolean enableCompression(); /** * When enabled, vert.x will decompress the request's body if it's compressed. @@ -83,19 +89,18 @@ public class HttpBuildTimeConfig { * Note that the compression format (e.g., gzip) must be specified in the Content-Encoding header * in the request. */ - @ConfigItem - public boolean enableDecompression; + @WithDefault("false") + boolean enableDecompression(); /** * List of media types for which the compression should be enabled automatically, unless declared explicitly via * {@link Compressed} or {@link Uncompressed}. */ - @ConfigItem(defaultValue = "text/html,text/plain,text/xml,text/css,text/javascript,application/javascript") - public Optional> compressMediaTypes; + @WithDefault("text/html,text/plain,text/xml,text/css,text/javascript,application/javascript") + Optional> compressMediaTypes(); /** * The compression level used when compression support is enabled. */ - @ConfigItem - public OptionalInt compressionLevel; + OptionalInt compressionLevel(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/HttpConfiguration.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/HttpConfiguration.java index c301b99754848..01f67056940bc 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/HttpConfiguration.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/HttpConfiguration.java @@ -6,31 +6,34 @@ import java.util.OptionalInt; import io.quarkus.runtime.LaunchMode; -import io.quarkus.runtime.annotations.ConfigItem; import io.quarkus.runtime.annotations.ConfigPhase; import io.quarkus.runtime.annotations.ConfigRoot; import io.quarkus.vertx.http.runtime.cors.CORSConfig; +import io.smallrye.config.ConfigMapping; +import io.smallrye.config.WithDefault; +import io.smallrye.config.WithName; +@ConfigMapping(prefix = "quarkus.http") @ConfigRoot(phase = ConfigPhase.RUN_TIME) -public class HttpConfiguration { - +public interface HttpConfiguration { /** * Enable the CORS filter. */ - @ConfigItem(name = "cors") - public boolean corsEnabled; + @WithName("cors.enabled") + @WithDefault("${quarkus.http.cors:false}") + boolean corsEnabled(); /** * The HTTP port */ - @ConfigItem(defaultValue = "8080") - public int port; + @WithDefault("8080") + int port(); /** * The HTTP port used to run tests */ - @ConfigItem(defaultValue = "8081") - public int testPort; + @WithDefault("8081") + int testPort(); /** * The HTTP host @@ -41,40 +44,37 @@ public class HttpConfiguration { * is not suitable for dev/test mode as other people on the network can connect to your * development machine. */ - @ConfigItem - public String host; + String host(); /** * Used when {@code QuarkusIntegrationTest} is meant to execute against an application that is already running and * listening on the host specified by this property. */ - @ConfigItem - public Optional testHost; + Optional testHost(); /** * Enable listening to host:port */ - @ConfigItem(defaultValue = "true") - public boolean hostEnabled; + @WithDefault("true") + boolean hostEnabled(); /** * The HTTPS port */ - @ConfigItem(defaultValue = "8443") - public int sslPort; + @WithDefault("8443") + int sslPort(); /** * The HTTPS port used to run tests */ - @ConfigItem(defaultValue = "8444") - public int testSslPort; + @WithDefault("8444") + int testSslPort(); /** * Used when {@code QuarkusIntegrationTest} is meant to execute against an application that is already running * to configure the test to use SSL. */ - @ConfigItem - public Optional testSslEnabled; + Optional testSslEnabled(); /** * If insecure (i.e. http rather than https) requests are allowed. If this is {@code enabled} @@ -82,8 +82,8 @@ public class HttpConfiguration { * all requests will be redirected to the HTTPS port. {@code disabled} will prevent the HTTP * port from opening at all. */ - @ConfigItem(defaultValue = "enabled") - public InsecureRequests insecureRequests; + @WithDefault("enabled") + InsecureRequests insecureRequests(); /** * If this is true (the default) then HTTP/2 will be enabled. @@ -92,38 +92,39 @@ public class HttpConfiguration { * and you must be running on JDK11 or above, as JDK8 does not support * ALPN. */ - @ConfigItem(defaultValue = "true") - public boolean http2; + @WithDefault("true") + boolean http2(); /** * Enables or Disable the HTTP/2 Push feature. * This setting can be used to disable server push. The server will not send a {@code PUSH_PROMISE} frame if it * receives this parameter set to @{code false}. */ - @ConfigItem(defaultValue = "true") - public boolean http2PushEnabled; + @WithDefault("true") + boolean http2PushEnabled(); /** * The CORS config */ - public CORSConfig cors; + CORSConfig cors(); /** * The SSL config */ - public ServerSslConfig ssl; + ServerSslConfig ssl(); /** * The Static Resources config */ - public StaticResourcesConfig staticResources; + StaticResourcesConfig staticResources(); /** * When set to {@code true}, the HTTP server automatically sends `100 CONTINUE` * response when the request expects it (with the `Expect: 100-Continue` header). */ - @ConfigItem(defaultValue = "false", name = "handle-100-continue-automatically") - public boolean handle100ContinueAutomatically; + @WithName("handle-100-continue-automatically") + @WithDefault("false") + boolean handle100ContinueAutomatically(); /** * The number if IO threads used to perform IO. This will be automatically set to a reasonable value based on @@ -133,19 +134,19 @@ public class HttpConfiguration { * In general this should be controlled by setting quarkus.vertx.event-loops-pool-size, this setting should only * be used if you want to limit the number of HTTP io threads to a smaller number than the total number of IO threads. */ - @ConfigItem - public OptionalInt ioThreads; + OptionalInt ioThreads(); /** * Server limits configuration */ - public ServerLimitsConfig limits; + ServerLimitsConfig limits(); /** * Http connection idle timeout */ - @ConfigItem(defaultValue = "30M", name = "idle-timeout") - public Duration idleTimeout; + @WithName("idle-timeout") + @WithDefault("30M") + Duration idleTimeout(); /** * Http connection read timeout for blocking IO. This is the maximum amount of time @@ -153,13 +154,14 @@ public class HttpConfiguration { * closed. * */ - @ConfigItem(defaultValue = "60s", name = "read-timeout") - public Duration readTimeout; + @WithName("read-timeout") + @WithDefault("60s") + Duration readTimeout(); /** * Request body related settings */ - public BodyConfig body; + BodyConfig body(); /** * The encryption key that is used to store persistent logins (e.g. for form auth). Logins are stored in a persistent @@ -168,74 +170,75 @@ public class HttpConfiguration { * If no key is provided then an in-memory one will be generated, this will change on every restart though so it * is not suitable for production environments. This must be more than 16 characters long for security reasons */ - @ConfigItem(name = "auth.session.encryption-key") - public Optional encryptionKey; + @WithName("auth.session.encryption-key") + Optional encryptionKey(); /** * Enable socket reuse port (linux/macOs native transport only) */ - @ConfigItem - public boolean soReusePort; + @WithDefault("false") + boolean soReusePort(); /** * Enable tcp quick ack (linux native transport only) */ - @ConfigItem - public boolean tcpQuickAck; + @WithDefault("false") + boolean tcpQuickAck(); /** * Enable tcp cork (linux native transport only) */ - @ConfigItem - public boolean tcpCork; + @WithDefault("false") + boolean tcpCork(); /** * Enable tcp fast open (linux native transport only) */ - @ConfigItem - public boolean tcpFastOpen; + @WithDefault("false") + boolean tcpFastOpen(); /** * The accept backlog, this is how many connections can be waiting to be accepted before connections start being rejected */ - @ConfigItem(defaultValue = "-1") - public int acceptBacklog; + @WithDefault("-1") + int acceptBacklog(); /** * Set the SETTINGS_INITIAL_WINDOW_SIZE HTTP/2 setting. * Indicates the sender's initial window size (in octets) for stream-level flow control. * The initial value is {@code 2^16-1} (65,535) octets. */ - @ConfigItem - public OptionalInt initialWindowSize; + OptionalInt initialWindowSize(); /** * Path to a unix domain socket */ - @ConfigItem(defaultValue = "/var/run/io.quarkus.app.socket") - public String domainSocket; + @WithDefault("/var/run/io.quarkus.app.socket") + String domainSocket(); /** * Enable listening to host:port */ - @ConfigItem - public boolean domainSocketEnabled; + @WithDefault("false") + boolean domainSocketEnabled(); /** * If this is true then the request start time will be recorded to enable logging of total request time. * * This has a small performance penalty, so is disabled by default. */ - @ConfigItem - public boolean recordRequestStartTime; + @WithDefault("false") + boolean recordRequestStartTime(); - AccessLogConfig accessLog; + /** + * Access log configuration. + */ + AccessLogConfig accessLog(); /** * Configuration that allows setting the same site attributes for cookies. */ - @ConfigItem - public Map sameSiteCookie; + Map sameSiteCookie(); /** * Provides a hint (optional) for the default content type of responses generated for @@ -248,38 +251,38 @@ public class HttpConfiguration { * Otherwise, it will default to the content type configured here. *

*/ - @ConfigItem - public Optional unhandledErrorContentTypeDefault; + Optional unhandledErrorContentTypeDefault(); /** * Additional HTTP Headers always sent in the response */ - @ConfigItem - public Map header; + Map header(); /** * Additional HTTP configuration per path */ - @ConfigItem - public Map filter; + Map filter(); - public ProxyConfig proxy; + /** + * Proxy configuration. + */ + ProxyConfig proxy(); - public int determinePort(LaunchMode launchMode) { - return launchMode == LaunchMode.TEST ? testPort : port; + default int determinePort(LaunchMode launchMode) { + return launchMode == LaunchMode.TEST ? testPort() : port(); } - public int determineSslPort(LaunchMode launchMode) { - return launchMode == LaunchMode.TEST ? testSslPort : sslPort; + default int determineSslPort(LaunchMode launchMode) { + return launchMode == LaunchMode.TEST ? testSslPort() : sslPort(); } - public enum InsecureRequests { + enum InsecureRequests { ENABLED, REDIRECT, DISABLED; } - public enum PayloadHint { + enum PayloadHint { JSON, HTML, } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/MultiPartConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/MultiPartConfig.java index 43cfe26f7ed3a..588b2cf74074b 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/MultiPartConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/MultiPartConfig.java @@ -4,16 +4,13 @@ import java.util.Optional; import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; -import io.quarkus.runtime.annotations.ConvertWith; import io.quarkus.runtime.configuration.TrimmedStringConverter; +import io.smallrye.config.WithConverter; /** * A {@link ConfigGroup} for the settings related to HTTP multipart request handling. */ -@ConfigGroup -public class MultiPartConfig { - +public interface MultiPartConfig { /** * A comma-separated list of {@code ContentType} to indicate whether a given multipart field should be handled as a file * part. @@ -22,7 +19,6 @@ public class MultiPartConfig { * * For now, this setting only works when using RESTEasy Reactive. */ - @ConfigItem - @ConvertWith(TrimmedStringConverter.class) - public Optional> fileContentTypes; + @WithConverter(TrimmedStringConverter.class) + Optional> fileContentTypes(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/PolicyConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/PolicyConfig.java index 7d16bc2f4e392..9ebad5f0baf66 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/PolicyConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/PolicyConfig.java @@ -4,22 +4,18 @@ import java.util.Map; import io.quarkus.runtime.annotations.ConfigDocMapKey; -import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; -import io.quarkus.runtime.annotations.ConvertWith; import io.quarkus.runtime.configuration.TrimmedStringConverter; -import io.quarkus.security.StringPermission; - -@ConfigGroup -public class PolicyConfig { +import io.smallrye.config.WithConverter; +import io.smallrye.config.WithDefault; +public interface PolicyConfig { /** * The roles that are allowed to access resources protected by this policy. * By default, access is allowed to any authenticated user. */ - @ConfigItem(defaultValue = "**") - @ConvertWith(TrimmedStringConverter.class) - public List rolesAllowed; + @WithDefault("**") + @WithConverter(TrimmedStringConverter.class) + List rolesAllowed(); /** * Permissions granted to the `SecurityIdentity` if this policy is applied successfully @@ -29,15 +25,13 @@ public class PolicyConfig { * Granted permissions are used for authorization with the `@PermissionsAllowed` annotation. */ @ConfigDocMapKey("role1") - @ConfigItem - public Map> permissions; + Map> permissions(); /** * Permissions granted by this policy will be created with a `java.security.Permission` implementation * specified by this configuration property. The permission class must declare exactly one constructor * that accepts permission name (`String`) or permission name and actions (`String`, `String[]`). */ - @ConfigItem(defaultValue = "io.quarkus.security.StringPermission") - public String permissionClass = StringPermission.class.getName(); - + @WithDefault("io.quarkus.security.StringPermission") + String permissionClass(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/PolicyMappingConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/PolicyMappingConfig.java index d78640f6913f6..5bad6b162d114 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/PolicyMappingConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/PolicyMappingConfig.java @@ -3,19 +3,13 @@ import java.util.List; import java.util.Optional; -import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; - -@ConfigGroup -public class PolicyMappingConfig { - +public interface PolicyMappingConfig { /** * Determines whether the entire permission set is enabled, or not. * * By default, if the permission set is defined, it is enabled. */ - @ConfigItem - public Optional enabled; + Optional enabled(); /** * The HTTP policy that this permission set is linked to. @@ -23,8 +17,7 @@ public class PolicyMappingConfig { * There are 3 built in policies: permit, deny and authenticated. Role based * policies can be defined, and extensions can add their own policies. */ - @ConfigItem - public String policy; + String policy(); /** * The methods that this permission set applies to. If this is not set then they apply to all methods. @@ -38,8 +31,7 @@ public class PolicyMappingConfig { * and no other permissions are configured PUT requests to /admin will be denied. * */ - @ConfigItem - public Optional> methods; + Optional> methods(); /** * The paths that this permission check applies to. If the path ends in /* then this is treated @@ -51,13 +43,11 @@ public class PolicyMappingConfig { * over matches without methods set, otherwise the most restrictive permissions are applied. * */ - @ConfigItem - public Optional> paths; + Optional> paths(); /** * Path specific authentication mechanism which must be used to authenticate a user. * It needs to match {@link HttpCredentialTransport} authentication scheme such as 'basic', 'bearer', 'form', etc. */ - @ConfigItem - public Optional authMechanism; + Optional authMechanism(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ProxyConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ProxyConfig.java index 8ed4a2a621dac..e2d4d5cc5fa27 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ProxyConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ProxyConfig.java @@ -3,22 +3,20 @@ import java.util.List; import java.util.Optional; -import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; -import io.quarkus.runtime.annotations.ConvertWith; import io.quarkus.vertx.http.runtime.TrustedProxyCheck.TrustedProxyCheckPart; +import io.smallrye.config.WithConverter; +import io.smallrye.config.WithDefault; /** * Holds configuration related with proxy addressing forward. */ -@ConfigGroup -public class ProxyConfig { +public interface ProxyConfig { /** * If this is true then the address, scheme etc. will be set from headers forwarded by the proxy server, such as * {@code X-Forwarded-For}. This should only be set if you are behind a proxy that sets these headers. */ - @ConfigItem - public boolean proxyAddressForwarding; + @WithDefault("false") + boolean proxyAddressForwarding(); /** * If this is true and proxy address forwarding is enabled then the standard {@code Forwarded} header will be used. @@ -28,8 +26,8 @@ public class ProxyConfig { * requests with a forwarded header that is not overwritten by the proxy. Therefore, proxies should strip unexpected * `X-Forwarded` or `X-Forwarded-*` headers from the client. */ - @ConfigItem - public boolean allowForwarded; + @WithDefault("false") + boolean allowForwarded(); /** * If either this or {@code allow-forwarded} are true and proxy address forwarding is enabled then the not standard @@ -40,32 +38,31 @@ public class ProxyConfig { * requests with a forwarded header that is not overwritten by the proxy. Therefore, proxies should strip unexpected * `X-Forwarded` or `X-Forwarded-*` headers from the client. */ - @ConfigItem - public Optional allowXForwarded; + Optional allowXForwarded(); /** * Enable override the received request's host through a forwarded host header. */ - @ConfigItem(defaultValue = "false") - public boolean enableForwardedHost; + @WithDefault("false") + boolean enableForwardedHost(); /** * Configure the forwarded host header to be used if override enabled. */ - @ConfigItem(defaultValue = "X-Forwarded-Host") - public String forwardedHostHeader; + @WithDefault("X-Forwarded-Host") + String forwardedHostHeader(); /** * Enable prefix the received request's path with a forwarded prefix header. */ - @ConfigItem(defaultValue = "false") - public boolean enableForwardedPrefix; + @WithDefault("false") + boolean enableForwardedPrefix(); /** * Configure the forwarded prefix header to be used if prefixing enabled. */ - @ConfigItem(defaultValue = "X-Forwarded-Prefix") - public String forwardedPrefixHeader; + @WithDefault("X-Forwarded-Prefix") + String forwardedPrefixHeader(); /** * Configure the list of trusted proxy addresses. @@ -95,8 +92,5 @@ public class ProxyConfig { * * Please bear in mind that IPv4 CIDR won't match request sent from the IPv6 address and the other way around. */ - @ConfigItem(defaultValueDocumentation = "All proxy addresses are trusted") - @ConvertWith(TrustedProxyCheckPartConverter.class) - public Optional> trustedProxies; - + Optional> trustedProxies(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/SameSiteCookieConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/SameSiteCookieConfig.java index cad1b8b44edb4..37fa0eba96aea 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/SameSiteCookieConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/SameSiteCookieConfig.java @@ -1,7 +1,6 @@ package io.quarkus.vertx.http.runtime; -import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; +import io.smallrye.config.WithDefault; import io.vertx.core.http.CookieSameSite; /** @@ -10,31 +9,28 @@ * As some API's (Servlet, JAX-RS) don't current support this attribute this config allows * it to be set based on the cookie name pattern. */ -@ConfigGroup -public class SameSiteCookieConfig { - +public interface SameSiteCookieConfig { /** * If the cookie pattern is case-sensitive */ - @ConfigItem - public boolean caseSensitive; + @WithDefault("false") + boolean caseSensitive(); /** * The value to set in the samesite attribute */ - @ConfigItem - public CookieSameSite value; + CookieSameSite value(); /** * Some User Agents break when sent SameSite=None, this will detect them and avoid sending the value */ - @ConfigItem(defaultValue = "true") - public boolean enableClientChecker; + @WithDefault("true") + boolean enableClientChecker(); /** * If this is true then the 'secure' attribute will automatically be sent on * cookies with a SameSite attribute of None. */ - @ConfigItem(defaultValue = "true") - public boolean addSecureForNone; + @WithDefault("true") + boolean addSecureForNone(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ServerLimitsConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ServerLimitsConfig.java index 1d8e91e323eed..d015cac8979b6 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ServerLimitsConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ServerLimitsConfig.java @@ -4,48 +4,45 @@ import java.util.OptionalInt; import java.util.OptionalLong; -import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; import io.quarkus.runtime.configuration.MemorySize; +import io.smallrye.config.WithDefault; -@ConfigGroup -public class ServerLimitsConfig { +public interface ServerLimitsConfig { /** * The maximum length of all headers. */ - @ConfigItem(defaultValue = "20K") - public MemorySize maxHeaderSize; + @WithDefault("20K") + MemorySize maxHeaderSize(); /** * The maximum size of a request body. */ - @ConfigItem(defaultValue = "10240K") - public Optional maxBodySize; + @WithDefault("10240K") + Optional maxBodySize(); /** * The max HTTP chunk size */ - @ConfigItem(defaultValue = "8192") - public MemorySize maxChunkSize; + @WithDefault("8192") + MemorySize maxChunkSize(); /** * The maximum length of the initial line (e.g. {@code "GET / HTTP/1.0"}). */ - @ConfigItem(defaultValue = "4096") - public int maxInitialLineLength; + @WithDefault("4096") + int maxInitialLineLength(); /** * The maximum length of a form attribute. */ - @ConfigItem(defaultValue = "2048") - public MemorySize maxFormAttributeSize; + @WithDefault("2048") + MemorySize maxFormAttributeSize(); /** * The maximum number of connections that are allowed at any one time. If this is set * it is recommended to set a short idle timeout. */ - @ConfigItem - public OptionalInt maxConnections; + OptionalInt maxConnections(); /** * Set the SETTINGS_HEADER_TABLE_SIZE HTTP/2 setting. @@ -55,8 +52,7 @@ public class ServerLimitsConfig { * specific to the header compression format inside a header block. * The initial value is {@code 4,096} octets. */ - @ConfigItem - public OptionalLong headerTableSize; + OptionalLong headerTableSize(); /** * Set SETTINGS_MAX_CONCURRENT_STREAMS HTTP/2 setting. @@ -65,16 +61,14 @@ public class ServerLimitsConfig { * applies to the number of streams that the sender permits the receiver to create. Initially, there is no limit to * this value. It is recommended that this value be no smaller than 100, to not unnecessarily limit parallelism. */ - @ConfigItem - public OptionalLong maxConcurrentStreams; + OptionalLong maxConcurrentStreams(); /** * Set the SETTINGS_MAX_FRAME_SIZE HTTP/2 setting. * Indicates the size of the largest frame payload that the sender is willing to receive, in octets. * The initial value is {@code 2^14} (16,384) octets. */ - @ConfigItem - public OptionalInt maxFrameSize; + OptionalInt maxFrameSize(); /** * Set the SETTINGS_MAX_HEADER_LIST_SIZE HTTP/2 setting. @@ -83,7 +77,5 @@ public class ServerLimitsConfig { * value in octets plus an overhead of 32 octets for each header field. * The default value is {@code 8192} */ - @ConfigItem - public OptionalLong maxHeaderListSize; - + OptionalLong maxHeaderListSize(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ServerSslConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ServerSslConfig.java index bcab41197df6f..a298f4acadc3e 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ServerSslConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ServerSslConfig.java @@ -4,25 +4,21 @@ import java.util.Optional; import java.util.Set; -import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; -import io.quarkus.runtime.annotations.DefaultConverter; +import io.smallrye.config.WithDefault; /** * Shared configuration for setting up server-side SSL. */ -@ConfigGroup -public class ServerSslConfig { +public interface ServerSslConfig { /** * The server certificate configuration. */ - public CertificateConfig certificate; + CertificateConfig certificate(); /** * The cipher suites to use. If none is given, a reasonable default is selected. */ - @ConfigItem - public Optional> cipherSuites; + Optional> cipherSuites(); /** * Sets the ordered list of enabled SSL/TLS protocols. @@ -34,15 +30,13 @@ public class ServerSslConfig { * Note that setting an empty list, and enabling SSL/TLS is invalid. * You must at least have one protocol. */ - @DefaultConverter - @ConfigItem(defaultValue = "TLSv1.3,TLSv1.2") - public Set protocols; + @WithDefault("TLSv1.3,TLSv1.2") + Set protocols(); /** * Enables Server Name Indication (SNI), an TLS extension allowing the server to use multiple certificates. * The client indicate the server name during the TLS handshake, allowing the server to select the right certificate. */ - @ConfigItem(defaultValue = "false") - public boolean sni; - + @WithDefault("false") + boolean sni(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/StaticResourcesConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/StaticResourcesConfig.java index 94ff031402d81..f460d5ab7ffdb 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/StaticResourcesConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/StaticResourcesConfig.java @@ -2,52 +2,48 @@ import java.time.Duration; -import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; - -@ConfigGroup -public class StaticResourcesConfig { +import io.smallrye.config.WithDefault; +public interface StaticResourcesConfig { /** * Set the index page when serving static resources. */ - @ConfigItem(defaultValue = "index.html") - public String indexPage; + @WithDefault("index.html") + String indexPage(); /** * Set whether hidden files should be served. */ - @ConfigItem(defaultValue = "true") - public boolean includeHidden; + @WithDefault("true") + boolean includeHidden(); /** * Set whether range requests (resumable downloads; media streaming) should be enabled. */ - @ConfigItem(defaultValue = "true") - public boolean enableRangeSupport; + @WithDefault("true") + boolean enableRangeSupport(); /** * Set whether cache handling is enabled. */ - @ConfigItem(defaultValue = "true") - public boolean cachingEnabled; + @WithDefault("true") + boolean cachingEnabled(); /** * Set the cache entry timeout. The default is {@code 30} seconds. */ - @ConfigItem(defaultValue = "30S") - public Duration cacheEntryTimeout; + @WithDefault("30S") + Duration cacheEntryTimeout(); /** * Set value for max age in caching headers. The default is {@code 24} hours. */ - @ConfigItem(defaultValue = "24H") - public Duration maxAge; + @WithDefault("24H") + Duration maxAge(); /** * Set the max cache size. */ - @ConfigItem(defaultValue = "10000") - public int maxCacheSize; - + @WithDefault("10000") + int maxCacheSize(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/StaticResourcesRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/StaticResourcesRecorder.java index 7738d9bfe34cd..e900e09166b9a 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/StaticResourcesRecorder.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/StaticResourcesRecorder.java @@ -39,11 +39,11 @@ public static void setHotDeploymentResources(List resources) { } public Consumer start(Set knownPaths) { - if (httpBuildTimeConfig.enableCompression && httpBuildTimeConfig.compressMediaTypes.isPresent()) { - this.compressMediaTypes = Set.copyOf(httpBuildTimeConfig.compressMediaTypes.get()); + if (httpBuildTimeConfig.enableCompression() && httpBuildTimeConfig.compressMediaTypes().isPresent()) { + this.compressMediaTypes = Set.copyOf(httpBuildTimeConfig.compressMediaTypes().get()); } List> handlers = new ArrayList<>(); - StaticResourcesConfig config = httpConfiguration.getValue().staticResources; + StaticResourcesConfig config = httpConfiguration.getValue().staticResources(); if (hotDeploymentResourcePaths != null && !hotDeploymentResourcePaths.isEmpty()) { for (Path resourcePath : hotDeploymentResourcePaths) { @@ -51,9 +51,9 @@ public Consumer start(Set knownPaths) { StaticHandler staticHandler = StaticHandler.create(FileSystemAccess.ROOT, root) .setDefaultContentEncoding("UTF-8") .setCachingEnabled(false) - .setIndexPage(config.indexPage) - .setIncludeHidden(config.includeHidden) - .setEnableRangeSupport(config.enableRangeSupport); + .setIndexPage(config.indexPage()) + .setIncludeHidden(config.includeHidden()) + .setEnableRangeSupport(config.enableRangeSupport()); handlers.add(new Handler<>() { @Override public void handle(RoutingContext ctx) { @@ -73,18 +73,18 @@ public void handle(RoutingContext ctx) { ClassLoader currentCl = Thread.currentThread().getContextClassLoader(); StaticHandler staticHandler = StaticHandler.create(META_INF_RESOURCES) .setDefaultContentEncoding("UTF-8") - .setCachingEnabled(config.cachingEnabled) - .setIndexPage(config.indexPage) - .setIncludeHidden(config.includeHidden) - .setEnableRangeSupport(config.enableRangeSupport) - .setMaxCacheSize(config.maxCacheSize) - .setCacheEntryTimeout(config.cacheEntryTimeout.toMillis()) - .setMaxAgeSeconds(config.maxAge.toSeconds()); + .setCachingEnabled(config.cachingEnabled()) + .setIndexPage(config.indexPage()) + .setIncludeHidden(config.includeHidden()) + .setEnableRangeSupport(config.enableRangeSupport()) + .setMaxCacheSize(config.maxCacheSize()) + .setCacheEntryTimeout(config.cacheEntryTimeout().toMillis()) + .setMaxAgeSeconds(config.maxAge().toSeconds()); // normalize index page like StaticHandler because its not expose // TODO: create a converter to normalize filename in config.indexPage? - final String indexPage = (config.indexPage.charAt(0) == '/') - ? config.indexPage.substring(1) - : config.indexPage; + final String indexPage = (config.indexPage().charAt(0) == '/') + ? config.indexPage().substring(1) + : config.indexPage(); handlers.add(new Handler<>() { @Override public void handle(RoutingContext ctx) { @@ -122,7 +122,7 @@ public void accept(Route route) { } private void compressIfNeeded(RoutingContext ctx, String path) { - if (httpBuildTimeConfig.enableCompression && isCompressed(path)) { + if (httpBuildTimeConfig.enableCompression() && isCompressed(path)) { // VertxHttpRecorder is adding "Content-Encoding: identity" to all requests if compression is enabled. // Handlers can remove the "Content-Encoding: identity" header to enable compression. ctx.response().headers().remove(HttpHeaders.CONTENT_ENCODING); diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java index a2dd06ae56a58..c6066e29c3890 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java @@ -74,6 +74,7 @@ import io.quarkus.vertx.http.runtime.options.HttpServerCommonHandlers; import io.quarkus.vertx.http.runtime.options.HttpServerOptionsUtils; import io.smallrye.common.vertx.VertxContext; +import io.smallrye.config.SmallRyeConfig; import io.vertx.core.AbstractVerticle; import io.vertx.core.AsyncResult; import io.vertx.core.Context; @@ -205,7 +206,8 @@ private boolean uriValid(HttpServerRequest httpServerRequest) { final RuntimeValue managementConfiguration; private static volatile Handler managementRouter; - public VertxHttpRecorder(HttpBuildTimeConfig httpBuildTimeConfig, + public VertxHttpRecorder( + HttpBuildTimeConfig httpBuildTimeConfig, ManagementInterfaceBuildTimeConfig managementBuildTimeConfig, RuntimeValue httpConfiguration, RuntimeValue managementConfiguration) { @@ -254,18 +256,21 @@ public static void startServerAfterFailedStart() { } try { - HttpBuildTimeConfig buildConfig = new HttpBuildTimeConfig(); - ConfigInstantiator.handleObject(buildConfig); - ManagementInterfaceBuildTimeConfig managementBuildTimeConfig = new ManagementInterfaceBuildTimeConfig(); - ConfigInstantiator.handleObject(managementBuildTimeConfig); - HttpConfiguration config = new HttpConfiguration(); - ConfigInstantiator.handleObject(config); - ManagementInterfaceConfiguration managementConfig = new ManagementInterfaceConfiguration(); - ConfigInstantiator.handleObject(managementConfig); - if (config.host == null) { - //HttpHostConfigSource does not come into play here - config.host = "localhost"; - } + SmallRyeConfig config = ConfigUtils.emptyConfigBuilder() + .addDiscoveredSources() + .withMapping(HttpBuildTimeConfig.class) + .withMapping(HttpConfiguration.class) + .withMapping(ManagementInterfaceBuildTimeConfig.class) + .withMapping(ManagementInterfaceConfiguration.class) + .withDefaultValue("quarkus.http.host", "localhost") + .build(); + + HttpBuildTimeConfig httpBuildConfig = config.getConfigMapping(HttpBuildTimeConfig.class); + ManagementInterfaceBuildTimeConfig managementBuildTimeConfig = config + .getConfigMapping(ManagementInterfaceBuildTimeConfig.class); + HttpConfiguration httpConfig = config.getConfigMapping(HttpConfiguration.class); + ManagementInterfaceConfiguration managementConfig = config.getConfigMapping(ManagementInterfaceConfiguration.class); + Router router = Router.router(vertx); if (hotReplacementHandler != null) { router.route().order(Integer.MIN_VALUE).blockingHandler(hotReplacementHandler); @@ -281,7 +286,8 @@ public static void startServerAfterFailedStart() { rootHandler = root; //we can't really do - doServerStart(vertx, buildConfig, managementBuildTimeConfig, null, config, managementConfig, LaunchMode.DEVELOPMENT, + doServerStart(vertx, httpBuildConfig, managementBuildTimeConfig, null, httpConfig, managementConfig, + LaunchMode.DEVELOPMENT, new Supplier() { @Override public Integer get() { @@ -330,8 +336,8 @@ public void startServer(Supplier vertx, ShutdownContext shutdown, HttpConfiguration httpConfiguration = this.httpConfiguration.getValue(); ManagementInterfaceConfiguration managementConfig = this.managementConfiguration == null ? null : this.managementConfiguration.getValue(); - if (startSocket && (httpConfiguration.hostEnabled || httpConfiguration.domainSocketEnabled - || managementConfig.hostEnabled || managementConfig.domainSocketEnabled)) { + if (startSocket && (httpConfiguration.hostEnabled() || httpConfiguration.domainSocketEnabled() + || managementConfig.hostEnabled() || managementConfig.domainSocketEnabled())) { // Start the server if (closeTask == null) { doServerStart(vertx.get(), httpBuildTimeConfig, managementBuildTimeConfig, managementRouter, @@ -400,9 +406,9 @@ public void finalizeRouter(BeanContainer container, Consumer defaultRoute defaultRouteHandler.accept(httpRouteRouter.route().order(DEFAULT_ROUTE_ORDER)); } - applyCompression(httpBuildTimeConfig.enableCompression, httpRouteRouter); + applyCompression(httpBuildTimeConfig.enableCompression(), httpRouteRouter); httpRouteRouter.route().last().failureHandler( - new QuarkusErrorHandler(launchMode.isDevOrTest(), httpConfiguration.unhandledErrorContentTypeDefault)); + new QuarkusErrorHandler(launchMode.isDevOrTest(), httpConfiguration.unhandledErrorContentTypeDefault())); if (requireBodyHandler) { //if this is set then everything needs the body handler installed @@ -416,12 +422,12 @@ public void handle(RoutingContext routingContext) { }); } - HttpServerCommonHandlers.enforceMaxBodySize(httpConfiguration.limits, httpRouteRouter); + HttpServerCommonHandlers.enforceMaxBodySize(httpConfiguration.limits(), httpRouteRouter); // Filter Configuration per path - var filtersInConfig = httpConfiguration.filter; + var filtersInConfig = httpConfiguration.filter(); HttpServerCommonHandlers.applyFilters(filtersInConfig, httpRouteRouter); // Headers sent on any request, regardless of the response - HttpServerCommonHandlers.applyHeaders(httpConfiguration.header, httpRouteRouter); + HttpServerCommonHandlers.applyHeaders(httpConfiguration.header(), httpRouteRouter); Handler root; if (rootPath.equals("/")) { @@ -455,8 +461,8 @@ public void handle(RoutingContext event) { root = mainRouter; } - warnIfProxyAddressForwardingAllowedWithMultipleHeaders(httpConfiguration.proxy); - root = HttpServerCommonHandlers.applyProxy(httpConfiguration.proxy, root, vertx); + warnIfProxyAddressForwardingAllowedWithMultipleHeaders(httpConfiguration.proxy()); + root = HttpServerCommonHandlers.applyProxy(httpConfiguration.proxy(), root, vertx); boolean quarkusWrapperNeeded = false; @@ -466,18 +472,18 @@ public void handle(RoutingContext event) { quarkusWrapperNeeded = true; } - AccessLogConfig accessLog = httpConfiguration.accessLog; - if (accessLog.enabled) { + AccessLogConfig accessLog = httpConfiguration.accessLog(); + if (accessLog.enabled()) { AccessLogReceiver receiver; - if (accessLog.logToFile) { - File outputDir = accessLog.logDirectory.isPresent() ? new File(accessLog.logDirectory.get()) : new File(""); - receiver = new DefaultAccessLogReceiver(executor, outputDir, accessLog.baseFileName, accessLog.logSuffix, - accessLog.rotate); + if (accessLog.logToFile()) { + File outputDir = accessLog.logDirectory().isPresent() ? new File(accessLog.logDirectory().get()) : new File(""); + receiver = new DefaultAccessLogReceiver(executor, outputDir, accessLog.baseFileName(), accessLog.logSuffix(), + accessLog.rotate()); } else { - receiver = new JBossLoggingAccessLogReceiver(accessLog.category); + receiver = new JBossLoggingAccessLogReceiver(accessLog.category()); } - AccessLogHandler handler = new AccessLogHandler(receiver, accessLog.pattern, getClass().getClassLoader(), - accessLog.excludePattern); + AccessLogHandler handler = new AccessLogHandler(receiver, accessLog.pattern(), getClass().getClassLoader(), + accessLog.excludePattern()); if (rootPath.equals("/") || nonRootPath.equals("/")) { mainRouterRuntimeValue.orElse(httpRouterRuntimeValue).getValue().route().order(Integer.MIN_VALUE) .handler(handler); @@ -494,8 +500,8 @@ public void handle(RoutingContext event) { } BiConsumer cookieFunction = null; - if (!httpConfiguration.sameSiteCookie.isEmpty()) { - cookieFunction = processSameSiteConfig(httpConfiguration.sameSiteCookie); + if (!httpConfiguration.sameSiteCookie().isEmpty()) { + cookieFunction = processSameSiteConfig(httpConfiguration.sameSiteCookie()); quarkusWrapperNeeded = true; } BiConsumer cookieConsumer = cookieFunction; @@ -512,7 +518,7 @@ public void handle(HttpServerRequest event) { Handler delegate = root; root = HttpServerCommonHandlers.enforceDuplicatedContext(delegate); - if (httpConfiguration.recordRequestStartTime) { + if (httpConfiguration.recordRequestStartTime()) { httpRouteRouter.route().order(Integer.MIN_VALUE).handler(new Handler() { @Override public void handle(RoutingContext event) { @@ -532,23 +538,23 @@ public void handle(RoutingContext event) { var mr = managementRouter.getValue(); mr.route().last().failureHandler( - new QuarkusErrorHandler(launchMode.isDevOrTest(), httpConfiguration.unhandledErrorContentTypeDefault)); + new QuarkusErrorHandler(launchMode.isDevOrTest(), httpConfiguration.unhandledErrorContentTypeDefault())); mr.route().order(Integer.MIN_VALUE).handler(createBodyHandlerForManagementInterface()); // We can use "*" here as the management interface is not expected to be used publicly. mr.route().order(Integer.MIN_VALUE).handler(CorsHandler.create().addOrigin("*")); - HttpServerCommonHandlers.applyFilters(managementConfiguration.getValue().filter, mr); + HttpServerCommonHandlers.applyFilters(managementConfiguration.getValue().filter(), mr); for (Filter filter : managementInterfaceFilterList) { mr.route().order(filter.getPriority()).handler(filter.getHandler()); } - HttpServerCommonHandlers.applyHeaders(managementConfiguration.getValue().header, mr); - HttpServerCommonHandlers.enforceMaxBodySize(managementConfiguration.getValue().limits, mr); - applyCompression(managementBuildTimeConfig.enableCompression, mr); + HttpServerCommonHandlers.applyHeaders(managementConfiguration.getValue().header(), mr); + HttpServerCommonHandlers.enforceMaxBodySize(managementConfiguration.getValue().limits(), mr); + applyCompression(managementBuildTimeConfig.enableCompression(), mr); Handler handler = HttpServerCommonHandlers.enforceDuplicatedContext(mr); - handler = HttpServerCommonHandlers.applyProxy(managementConfiguration.getValue().proxy, handler, vertx); + handler = HttpServerCommonHandlers.applyProxy(managementConfiguration.getValue().proxy(), handler, vertx); event.select(ManagementInterface.class).fire(new ManagementInterfaceImpl(managementRouter.getValue())); @@ -571,9 +577,9 @@ public void handle(RoutingContext ctx) { } private void warnIfProxyAddressForwardingAllowedWithMultipleHeaders(ProxyConfig proxyConfig) { - boolean proxyAddressForwardingActivated = proxyConfig.proxyAddressForwarding; - boolean forwardedActivated = proxyConfig.allowForwarded; - boolean xForwardedActivated = proxyConfig.allowXForwarded.orElse(!forwardedActivated); + boolean proxyAddressForwardingActivated = proxyConfig.proxyAddressForwarding(); + boolean forwardedActivated = proxyConfig.allowForwarded(); + boolean xForwardedActivated = proxyConfig.allowXForwarded().orElse(!forwardedActivated); if (proxyAddressForwardingActivated && forwardedActivated && xForwardedActivated) { LOGGER.warn( @@ -589,7 +595,7 @@ private static CompletableFuture initializeManagementInterfaceWithDo ManagementInterfaceConfiguration managementConfig, List websocketSubProtocols) { CompletableFuture managementInterfaceDomainSocketFuture = new CompletableFuture<>(); - if (!managementBuildTimeConfig.enabled || managementRouter == null || managementConfig == null) { + if (!managementBuildTimeConfig.enabled() || managementRouter == null || managementConfig == null) { managementInterfaceDomainSocketFuture.complete(null); return managementInterfaceDomainSocketFuture; } @@ -624,7 +630,7 @@ private static CompletableFuture initializeManagementInterface(Vertx List websocketSubProtocols) throws IOException { httpManagementServerOptions = null; CompletableFuture managementInterfaceFuture = new CompletableFuture<>(); - if (!managementBuildTimeConfig.enabled || managementRouter == null || managementConfig == null) { + if (!managementBuildTimeConfig.enabled() || managementRouter == null || managementConfig == null) { managementInterfaceFuture.complete(null); return managementInterfaceFuture; } @@ -662,7 +668,7 @@ private static CompletableFuture initializeMainHttpServer(Vertx vertx, H LaunchMode launchMode, Supplier eventLoops, List websocketSubProtocols) throws IOException { - if (!httpConfiguration.hostEnabled && !httpConfiguration.domainSocketEnabled) { + if (!httpConfiguration.hostEnabled() && !httpConfiguration.domainSocketEnabled()) { return CompletableFuture.completedFuture(null); } @@ -699,15 +705,15 @@ private static CompletableFuture initializeMainHttpServer(Vertx vertx, H } httpMainSslServerOptions = tmpSslConfig; - if (httpConfiguration.insecureRequests != HttpConfiguration.InsecureRequests.ENABLED + if (httpConfiguration.insecureRequests() != HttpConfiguration.InsecureRequests.ENABLED && httpMainSslServerOptions == null) { throw new IllegalStateException("Cannot set quarkus.http.redirect-insecure-requests without enabling SSL."); } int eventLoopCount = eventLoops.get(); final int ioThreads; - if (httpConfiguration.ioThreads.isPresent()) { - ioThreads = Math.min(httpConfiguration.ioThreads.getAsInt(), eventLoopCount); + if (httpConfiguration.ioThreads().isPresent()) { + ioThreads = Math.min(httpConfiguration.ioThreads().getAsInt(), eventLoopCount); } else if (launchMode.isDevOrTest()) { ioThreads = Math.min(2, eventLoopCount); //Don't start ~100 threads to run a couple unit tests } else { @@ -721,7 +727,7 @@ private static CompletableFuture initializeMainHttpServer(Vertx vertx, H public Verticle get() { return new WebDeploymentVerticle(httpMainServerOptions, httpMainSslServerOptions, httpMainDomainSocketOptions, launchMode, - httpConfiguration.insecureRequests, httpConfiguration, connectionCount); + httpConfiguration.insecureRequests(), httpConfiguration, connectionCount); } }, new DeploymentOptions().setInstances(ioThreads), new Handler>() { @Override @@ -733,11 +739,11 @@ public void handle(AsyncResult event) { if ((httpMainSslServerOptions == null) && (httpMainServerOptions != null)) { portsUsed = List.of(httpMainServerOptions.getPort()); - } else if ((httpConfiguration.insecureRequests == InsecureRequests.DISABLED) + } else if ((httpConfiguration.insecureRequests() == InsecureRequests.DISABLED) && (httpMainSslServerOptions != null)) { portsUsed = List.of(httpMainSslServerOptions.getPort()); } else if ((httpMainSslServerOptions != null) - && (httpConfiguration.insecureRequests == InsecureRequests.ENABLED) + && (httpConfiguration.insecureRequests() == InsecureRequests.ENABLED) && (httpMainServerOptions != null)) { portsUsed = List.of(httpMainServerOptions.getPort(), httpMainSslServerOptions.getPort()); } @@ -850,7 +856,7 @@ public void handle(AsyncResult event) { throw new RuntimeException("Unable to start HTTP server", e); } - setHttpServerTiming(httpConfiguration.insecureRequests, httpMainServerOptions, httpMainSslServerOptions, + setHttpServerTiming(httpConfiguration.insecureRequests(), httpMainServerOptions, httpMainSslServerOptions, httpMainDomainSocketOptions, auxiliaryApplication, httpManagementServerOptions); } @@ -893,7 +899,7 @@ private static void setHttpServerTiming(InsecureRequests insecureRequests, HttpS private static HttpServerOptions createHttpServerOptions( HttpBuildTimeConfig buildTimeConfig, HttpConfiguration httpConfiguration, LaunchMode launchMode, List websocketSubProtocols) { - if (!httpConfiguration.hostEnabled) { + if (!httpConfiguration.hostEnabled()) { return null; } // TODO other config properties @@ -909,7 +915,7 @@ private static HttpServerOptions createHttpServerOptions( private static HttpServerOptions createHttpServerOptionsForManagementInterface( ManagementInterfaceBuildTimeConfig buildTimeConfig, ManagementInterfaceConfiguration httpConfiguration, LaunchMode launchMode, List websocketSubProtocols) { - if (!httpConfiguration.hostEnabled) { + if (!httpConfiguration.hostEnabled()) { return null; } HttpServerOptions options = new HttpServerOptions(); @@ -925,22 +931,22 @@ private static HttpServerOptions createHttpServerOptionsForManagementInterface( private static HttpServerOptions createDomainSocketOptions( HttpBuildTimeConfig buildTimeConfig, HttpConfiguration httpConfiguration, List websocketSubProtocols) { - if (!httpConfiguration.domainSocketEnabled) { + if (!httpConfiguration.domainSocketEnabled()) { return null; } HttpServerOptions options = new HttpServerOptions(); HttpServerOptionsUtils.applyCommonOptions(options, buildTimeConfig, httpConfiguration, websocketSubProtocols); // Override the host (0.0.0.0 by default) with the configured domain socket. - options.setHost(httpConfiguration.domainSocket); + options.setHost(httpConfiguration.domainSocket()); // Check if we can write into the domain socket directory // We can do this check using a blocking API as the execution is done from the main thread (not an I/O thread) - File file = new File(httpConfiguration.domainSocket); + File file = new File(httpConfiguration.domainSocket()); if (!file.getParentFile().canWrite()) { LOGGER.warnf( "Unable to write in the domain socket directory (`%s`). Binding to the socket is likely going to fail.", - httpConfiguration.domainSocket); + httpConfiguration.domainSocket()); } return options; @@ -949,7 +955,7 @@ private static HttpServerOptions createDomainSocketOptions( private static HttpServerOptions createDomainSocketOptionsForManagementInterface( ManagementInterfaceBuildTimeConfig buildTimeConfig, ManagementInterfaceConfiguration httpConfiguration, List websocketSubProtocols) { - if (!httpConfiguration.domainSocketEnabled) { + if (!httpConfiguration.domainSocketEnabled()) { return null; } HttpServerOptions options = new HttpServerOptions(); @@ -957,15 +963,15 @@ private static HttpServerOptions createDomainSocketOptionsForManagementInterface HttpServerOptionsUtils.applyCommonOptionsForManagementInterface(options, buildTimeConfig, httpConfiguration, websocketSubProtocols); // Override the host (0.0.0.0 by default) with the configured domain socket. - options.setHost(httpConfiguration.domainSocket); + options.setHost(httpConfiguration.domainSocket()); // Check if we can write into the domain socket directory // We can do this check using a blocking API as the execution is done from the main thread (not an I/O thread) - File file = new File(httpConfiguration.domainSocket); + File file = new File(httpConfiguration.domainSocket()); if (!file.getParentFile().canWrite()) { LOGGER.warnf( "Unable to write in the domain socket directory (`%s`). Binding to the socket is likely going to fail.", - httpConfiguration.domainSocket); + httpConfiguration.domainSocket()); } return options; @@ -1136,8 +1142,8 @@ private void setupUnixDomainSocketHttpServer(HttpServer httpServer, HttpServerOp private void setupTcpHttpServer(HttpServer httpServer, HttpServerOptions options, boolean https, Promise startFuture, AtomicInteger remainingCount, AtomicInteger currentConnectionCount) { - if (quarkusConfig.limits.maxConnections.isPresent() && quarkusConfig.limits.maxConnections.getAsInt() > 0) { - final int maxConnections = quarkusConfig.limits.maxConnections.getAsInt(); + if (quarkusConfig.limits().maxConnections().isPresent() && quarkusConfig.limits().maxConnections().getAsInt() > 0) { + final int maxConnections = quarkusConfig.limits().maxConnections().getAsInt(); httpServer.connectionHandler(new Handler() { @Override @@ -1350,11 +1356,11 @@ private static Handler configureAndGetBody(Optional if (maxBodySize.isPresent()) { bodyHandler.setBodyLimit(maxBodySize.get().asLongValue()); } - bodyHandler.setHandleFileUploads(bodyConfig.handleFileUploads); - bodyHandler.setUploadsDirectory(bodyConfig.uploadsDirectory); - bodyHandler.setDeleteUploadedFilesOnEnd(bodyConfig.deleteUploadedFilesOnEnd); - bodyHandler.setMergeFormAttributes(bodyConfig.mergeFormAttributes); - bodyHandler.setPreallocateBodyBuffer(bodyConfig.preallocateBodyBuffer); + bodyHandler.setHandleFileUploads(bodyConfig.handleFileUploads()); + bodyHandler.setUploadsDirectory(bodyConfig.uploadsDirectory()); + bodyHandler.setDeleteUploadedFilesOnEnd(bodyConfig.deleteUploadedFilesOnEnd()); + bodyHandler.setMergeFormAttributes(bodyConfig.mergeFormAttributes()); + bodyHandler.setPreallocateBodyBuffer(bodyConfig.preallocateBodyBuffer()); return new Handler() { @Override public void handle(RoutingContext event) { @@ -1394,13 +1400,13 @@ public void run() { } public Handler createBodyHandler() { - Optional maxBodySize = httpConfiguration.getValue().limits.maxBodySize; - return configureAndGetBody(maxBodySize, httpConfiguration.getValue().body); + Optional maxBodySize = httpConfiguration.getValue().limits().maxBodySize(); + return configureAndGetBody(maxBodySize, httpConfiguration.getValue().body()); } public Handler createBodyHandlerForManagementInterface() { - Optional maxBodySize = managementConfiguration.getValue().limits.maxBodySize; - return configureAndGetBody(maxBodySize, managementConfiguration.getValue().body); + Optional maxBodySize = managementConfiguration.getValue().limits().maxBodySize(); + return configureAndGetBody(maxBodySize, managementConfiguration.getValue().body()); } private static final List CAN_HAVE_BODY = Arrays.asList(HttpMethod.POST, HttpMethod.PUT, HttpMethod.PATCH, @@ -1412,24 +1418,24 @@ private BiConsumer processSameSiteConfig(Map last = null; for (Map.Entry entry : new TreeMap<>(httpConfiguration).entrySet()) { - Pattern p = Pattern.compile(entry.getKey(), entry.getValue().caseSensitive ? 0 : Pattern.CASE_INSENSITIVE); + Pattern p = Pattern.compile(entry.getKey(), entry.getValue().caseSensitive() ? 0 : Pattern.CASE_INSENSITIVE); BiFunction biFunction = new BiFunction() { @Override public Boolean apply(Cookie cookie, HttpServerRequest request) { if (p.matcher(cookie.getName()).matches()) { - if (entry.getValue().value == CookieSameSite.NONE) { - if (entry.getValue().enableClientChecker) { + if (entry.getValue().value() == CookieSameSite.NONE) { + if (entry.getValue().enableClientChecker()) { String userAgent = request.getHeader(HttpHeaders.USER_AGENT); if (userAgent != null && SameSiteNoneIncompatibleClientChecker.isSameSiteNoneIncompatible(userAgent)) { return false; } } - if (entry.getValue().addSecureForNone) { + if (entry.getValue().addSecureForNone()) { cookie.setSecure(true); } } - cookie.setSameSite(entry.getValue().value); + cookie.setSameSite(entry.getValue().value()); return true; } return false; diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSConfig.java index 253ad10984b94..9206e11e204b3 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSConfig.java @@ -4,87 +4,61 @@ import java.util.List; import java.util.Optional; -import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; -import io.quarkus.runtime.annotations.ConvertWith; import io.quarkus.runtime.configuration.TrimmedStringConverter; +import io.smallrye.config.WithConverter; -@ConfigGroup -public class CORSConfig { - +public interface CORSConfig { /** * Origins allowed for CORS - * + *

* Comma separated list of valid URLs, e.g.: http://www.quarkus.io,http://localhost:3000 * In case an entry of the list is surrounded by forward slashes, * it is interpreted as a regular expression. */ - @ConfigItem - @ConvertWith(TrimmedStringConverter.class) - public Optional> origins = Optional.empty(); + Optional> origins(); /** * HTTP methods allowed for CORS - * + *

* Comma separated list of valid methods. ex: GET,PUT,POST * The filter allows any method if this is not set. - * + *

* default: returns any requested method as valid */ - @ConfigItem - @ConvertWith(TrimmedStringConverter.class) - public Optional> methods = Optional.empty(); + Optional> methods(); /** * HTTP headers allowed for CORS - * + *

* Comma separated list of valid headers. ex: X-Custom,Content-Disposition * The filter allows any header if this is not set. - * + *

* default: returns any requested header as valid */ - @ConfigItem - @ConvertWith(TrimmedStringConverter.class) - public Optional> headers = Optional.empty(); + Optional> headers(); /** * HTTP headers exposed in CORS - * + *

* Comma separated list of valid headers. ex: X-Custom,Content-Disposition - * + *

* default: empty */ - @ConfigItem - @ConvertWith(TrimmedStringConverter.class) - public Optional> exposedHeaders = Optional.empty(); + Optional> exposedHeaders(); /** * The `Access-Control-Max-Age` response header value indicating * how long the results of a pre-flight request can be cached. */ - @ConfigItem - public Optional accessControlMaxAge = Optional.empty(); + Optional accessControlMaxAge(); /** * The `Access-Control-Allow-Credentials` header is used to tell the * browsers to expose the response to front-end JavaScript code when * the request’s credentials mode Request.credentials is “include”. - * + *

* The value of this header will default to `true` if `quarkus.http.cors.origins` property is set and * there is a match with the precise `Origin` header. */ - @ConfigItem - public Optional accessControlAllowCredentials = Optional.empty(); - - @Override - public String toString() { - return "CORSConfig{" + - "origins=" + origins + - ", methods=" + methods + - ", headers=" + headers + - ", exposedHeaders=" + exposedHeaders + - ", accessControlMaxAge=" + accessControlMaxAge + - ", accessControlAllowCredentials=" + accessControlAllowCredentials + - '}'; - } + Optional accessControlAllowCredentials(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSFilter.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSFilter.java index b28d0d7a470cb..51252dbe9af34 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSFilter.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSFilter.java @@ -39,13 +39,13 @@ public class CORSFilter implements Handler { public CORSFilter(CORSConfig corsConfig) { this.corsConfig = corsConfig; - this.wildcardOrigin = isOriginConfiguredWithWildcard(this.corsConfig.origins); - this.wildcardMethod = isConfiguredWithWildcard(corsConfig.methods); - this.allowedOriginsRegex = this.wildcardOrigin ? List.of() : parseAllowedOriginsRegex(this.corsConfig.origins); - this.configuredHttpMethods = createConfiguredHttpMethods(this.corsConfig.methods); - this.exposedHeaders = createHeaderString(this.corsConfig.exposedHeaders); - this.allowedHeaders = createHeaderString(this.corsConfig.headers); - this.allowedMethods = createHeaderString(this.corsConfig.methods); + this.wildcardOrigin = isOriginConfiguredWithWildcard(this.corsConfig.origins()); + this.wildcardMethod = isConfiguredWithWildcard(corsConfig.methods()); + this.allowedOriginsRegex = this.wildcardOrigin ? List.of() : parseAllowedOriginsRegex(this.corsConfig.origins()); + this.configuredHttpMethods = createConfiguredHttpMethods(this.corsConfig.methods()); + this.exposedHeaders = createHeaderString(this.corsConfig.exposedHeaders()); + this.allowedHeaders = createHeaderString(this.corsConfig.headers()); + this.allowedMethods = createHeaderString(this.corsConfig.methods()); } private String createHeaderString(Optional> headers) { @@ -141,8 +141,8 @@ public void handle(RoutingContext event) { //for both normal and preflight requests we need to check the origin boolean allowsOrigin = wildcardOrigin; if (!allowsOrigin) { - if (corsConfig.origins.isPresent()) { - allowsOrigin = corsConfig.origins.get().contains(origin) + if (corsConfig.origins().isPresent()) { + allowsOrigin = corsConfig.origins().get().contains(origin) || isOriginAllowedByRegex(allowedOriginsRegex, origin) || isSameOrigin(request, origin); } else { @@ -153,8 +153,8 @@ public void handle(RoutingContext event) { response.setStatusCode(403); response.setStatusMessage("CORS Rejected - Invalid origin"); } else { - boolean allowCredentials = corsConfig.accessControlAllowCredentials - .orElse(corsConfig.origins.isPresent() && corsConfig.origins.get().contains(origin)); + boolean allowCredentials = corsConfig.accessControlAllowCredentials() + .orElse(corsConfig.origins().isPresent() && corsConfig.origins().get().contains(origin)); response.headers().set(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, String.valueOf(allowCredentials)); response.headers().set(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, origin); } @@ -203,9 +203,9 @@ private void handlePreflightRequest(RoutingContext event, String requestedHeader boolean allowsOrigin) { //see https://fetch.spec.whatwg.org/#http-cors-protocol - if (corsConfig.accessControlMaxAge.isPresent()) { + if (corsConfig.accessControlMaxAge().isPresent()) { event.response().putHeader(HttpHeaders.ACCESS_CONTROL_MAX_AGE, - String.valueOf(corsConfig.accessControlMaxAge.get().getSeconds())); + String.valueOf(corsConfig.accessControlMaxAge().get().getSeconds())); } var response = event.response(); if (requestedMethods != null) { @@ -309,7 +309,7 @@ static boolean substringMatch(String str, int pos, String substring, boolean req } private void processPreFlightRequestedHeaders(HttpServerResponse response, String allowHeadersValue) { - if (isConfiguredWithWildcard(corsConfig.headers)) { + if (isConfiguredWithWildcard(corsConfig.headers())) { response.headers().set(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, allowHeadersValue); } else { response.headers().set(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, allowedHeaders); diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSRecorder.java index 18d2b5a4b4d40..edf4161815351 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSRecorder.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSRecorder.java @@ -14,8 +14,8 @@ public CORSRecorder(HttpConfiguration configuration) { } public Handler corsHandler() { - if (configuration.corsEnabled) { - return new CORSFilter(configuration.cors); + if (configuration.corsEnabled()) { + return new CORSFilter(configuration.cors()); } return null; } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/DevConsoleCORSFilter.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/DevConsoleCORSFilter.java index 0ef7e7627bec5..5deeb19c9511a 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/DevConsoleCORSFilter.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/DevConsoleCORSFilter.java @@ -1,5 +1,6 @@ package io.quarkus.vertx.http.runtime.devmode; +import java.time.Duration; import java.util.List; import java.util.Optional; @@ -32,12 +33,38 @@ public DevConsoleCORSFilter() { private static CORSFilter corsFilter() { int httpPort = ConfigProvider.getConfig().getValue(HTTP_PORT_CONFIG_PROP, int.class); int httpsPort = ConfigProvider.getConfig().getValue(HTTPS_PORT_CONFIG_PROP, int.class); - CORSConfig config = new CORSConfig(); - config.origins = Optional.of(List.of( - HTTP_LOCAL_HOST + ":" + httpPort, - HTTP_LOCAL_HOST_IP + ":" + httpPort, - HTTPS_LOCAL_HOST + ":" + httpsPort, - HTTPS_LOCAL_HOST_IP + ":" + httpsPort)); + CORSConfig config = new CORSConfig() { + @Override + public Optional> origins() { + return Optional.of(List.of(HTTP_LOCAL_HOST + ":" + httpPort, HTTP_LOCAL_HOST_IP + ":" + httpPort, + HTTPS_LOCAL_HOST + ":" + httpsPort, HTTPS_LOCAL_HOST_IP + ":" + httpsPort)); + } + + @Override + public Optional> methods() { + return Optional.empty(); + } + + @Override + public Optional> headers() { + return Optional.empty(); + } + + @Override + public Optional> exposedHeaders() { + return Optional.empty(); + } + + @Override + public Optional accessControlMaxAge() { + return Optional.empty(); + } + + @Override + public Optional accessControlAllowCredentials() { + return Optional.empty(); + } + }; return new CORSFilter(config); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/management/ManagementAuthConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/management/ManagementAuthConfig.java index 017fcfe953a66..c0ebcbc868e26 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/management/ManagementAuthConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/management/ManagementAuthConfig.java @@ -3,34 +3,32 @@ import java.util.Map; import java.util.Optional; -import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; import io.quarkus.vertx.http.runtime.PolicyConfig; import io.quarkus.vertx.http.runtime.PolicyMappingConfig; +import io.smallrye.config.WithDefault; +import io.smallrye.config.WithName; /** * Authentication for the management interface. */ -@ConfigGroup -public class ManagementAuthConfig { +public interface ManagementAuthConfig { /** * If basic auth should be enabled. * */ - @ConfigItem - public Optional basic; + Optional basic(); /** * The HTTP permissions */ - @ConfigItem(name = "permission") - public Map permissions; + @WithName("permission") + Map permissions(); /** * The HTTP role based policies */ - @ConfigItem(name = "policy") - public Map rolePolicy; + @WithName("policy") + Map rolePolicy(); /** * If this is true and credentials are present then a user will always be authenticated @@ -39,6 +37,6 @@ public class ManagementAuthConfig { * If this is false then an attempt will only be made to authenticate the user if a permission * check is performed or the current user is required for some other reason. */ - @ConfigItem(defaultValue = "true") - public boolean proactive; + @WithDefault("true") + boolean proactive(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/management/ManagementInterfaceBuildTimeConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/management/ManagementInterfaceBuildTimeConfig.java index b2ca8512199e9..0037ad6b8caaa 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/management/ManagementInterfaceBuildTimeConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/management/ManagementInterfaceBuildTimeConfig.java @@ -2,43 +2,46 @@ import java.util.OptionalInt; -import io.quarkus.runtime.annotations.ConfigItem; import io.quarkus.runtime.annotations.ConfigPhase; import io.quarkus.runtime.annotations.ConfigRoot; +import io.smallrye.config.ConfigMapping; +import io.smallrye.config.WithDefault; +import io.smallrye.config.WithName; import io.vertx.core.http.ClientAuth; /** * Management interface configuration. */ -@ConfigRoot(name = "management", phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED) -public class ManagementInterfaceBuildTimeConfig { - +@ConfigMapping(prefix = "quarkus.management") +@ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED) +public interface ManagementInterfaceBuildTimeConfig { /** * Enables / Disables the usage of a separate interface/port to expose the management endpoints. * If sets to {@code true}, the management endpoints will be exposed to a different HTTP server. * This avoids exposing the management endpoints on a publicly available server. */ - @ConfigItem(defaultValue = "false") - public boolean enabled; + @WithDefault("false") + boolean enabled(); /** * Authentication configuration */ - public ManagementAuthConfig auth; + ManagementAuthConfig auth(); /** * Configures the engine to require/request client authentication. * NONE, REQUEST, REQUIRED */ - @ConfigItem(name = "ssl.client-auth", defaultValue = "NONE") - public ClientAuth tlsClientAuth; + @WithDefault("NONE") + @WithName("ssl.client-auth") + ClientAuth tlsClientAuth(); /** * A common root path for management endpoints. Various extension-provided management endpoints such as metrics * and health are deployed under this path by default. */ - @ConfigItem(defaultValue = "/q") - public String rootPath; + @WithDefault("/q") + String rootPath(); /** * If responses should be compressed. @@ -50,8 +53,8 @@ public class ManagementInterfaceBuildTimeConfig { *

* Which will tell vert.x not to compress the response. */ - @ConfigItem - public boolean enableCompression; + @WithDefault("false") + boolean enableCompression(); /** * When enabled, vert.x will decompress the request's body if it's compressed. @@ -59,12 +62,11 @@ public class ManagementInterfaceBuildTimeConfig { * Note that the compression format (e.g., gzip) must be specified in the Content-Encoding header * in the request. */ - @ConfigItem - public boolean enableDecompression; + @WithDefault("false") + boolean enableDecompression(); /** * The compression level used when compression support is enabled. */ - @ConfigItem - public OptionalInt compressionLevel; + OptionalInt compressionLevel(); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/management/ManagementInterfaceConfiguration.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/management/ManagementInterfaceConfiguration.java index 9d77f458d1c90..447bd8c5da6ac 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/management/ManagementInterfaceConfiguration.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/management/ManagementInterfaceConfiguration.java @@ -5,7 +5,6 @@ import java.util.Optional; import io.quarkus.runtime.LaunchMode; -import io.quarkus.runtime.annotations.ConfigItem; import io.quarkus.runtime.annotations.ConfigPhase; import io.quarkus.runtime.annotations.ConfigRoot; import io.quarkus.vertx.http.runtime.BodyConfig; @@ -14,26 +13,29 @@ import io.quarkus.vertx.http.runtime.ProxyConfig; import io.quarkus.vertx.http.runtime.ServerLimitsConfig; import io.quarkus.vertx.http.runtime.ServerSslConfig; +import io.smallrye.config.ConfigMapping; +import io.smallrye.config.WithDefault; +import io.smallrye.config.WithName; /** * Configures the management interface. * Note that the management interface must be enabled using the * {@link ManagementInterfaceBuildTimeConfig#enabled} build-time property. */ -@ConfigRoot(phase = ConfigPhase.RUN_TIME, name = "management") -public class ManagementInterfaceConfiguration { - +@ConfigMapping(prefix = "quarkus.management") +@ConfigRoot(phase = ConfigPhase.RUN_TIME) +public interface ManagementInterfaceConfiguration { /** * The HTTP port */ - @ConfigItem(defaultValue = "9000") - public int port; + @WithDefault("9000") + int port(); /** * The HTTP port */ - @ConfigItem(defaultValue = "9001") - public int testPort; + @WithDefault("9001") + int testPort(); /** * The HTTP host @@ -44,77 +46,78 @@ public class ManagementInterfaceConfiguration { * is not suitable for dev/test mode as other people on the network can connect to your * development machine. */ - @ConfigItem - public Optional host; + Optional host(); /** * Enable listening to host:port */ - @ConfigItem(defaultValue = "true") - public boolean hostEnabled; + @WithDefault("true") + boolean hostEnabled(); /** * The SSL config */ - public ServerSslConfig ssl; + ServerSslConfig ssl(); /** * When set to {@code true}, the HTTP server automatically sends `100 CONTINUE` * response when the request expects it (with the `Expect: 100-Continue` header). */ - @ConfigItem(defaultValue = "false", name = "handle-100-continue-automatically") - public boolean handle100ContinueAutomatically; + @WithName("handle-100-continue-automatically") + @WithDefault("false") + boolean handle100ContinueAutomatically(); /** * Server limits configuration */ - public ServerLimitsConfig limits; + ServerLimitsConfig limits(); /** * Http connection idle timeout */ - @ConfigItem(defaultValue = "30M", name = "idle-timeout") - public Duration idleTimeout; + @WithName("idle-timeout") + @WithDefault("30M") + Duration idleTimeout(); /** * Request body related settings */ - public BodyConfig body; + BodyConfig body(); /** * The accept backlog, this is how many connections can be waiting to be accepted before connections start being rejected */ - @ConfigItem(defaultValue = "-1") - public int acceptBacklog; + @WithDefault("-1") + int acceptBacklog(); /** * Path to a unix domain socket */ - @ConfigItem(defaultValue = "/var/run/io.quarkus.management.socket") - public String domainSocket; + @WithDefault("/var/run/io.quarkus.management.socket") + String domainSocket(); /** * Enable listening to host:port */ - @ConfigItem - public boolean domainSocketEnabled; + @WithDefault("false") + boolean domainSocketEnabled(); /** * Additional HTTP Headers always sent in the response */ - @ConfigItem - public Map header; + Map header(); /** * Additional HTTP configuration per path */ - @ConfigItem - public Map filter; + Map filter(); - public ProxyConfig proxy; + /** + * Proxy configuration. + */ + ProxyConfig proxy(); - public int determinePort(LaunchMode launchMode) { - return launchMode == LaunchMode.TEST ? testPort : port; + default int determinePort(LaunchMode launchMode) { + return launchMode == LaunchMode.TEST ? testPort() : port(); } - } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/management/ManagementInterfaceSecurityRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/management/ManagementInterfaceSecurityRecorder.java index 03e6be2d83742..70390c5958fdf 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/management/ManagementInterfaceSecurityRecorder.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/management/ManagementInterfaceSecurityRecorder.java @@ -58,7 +58,7 @@ public BeanContainerListener initPermissions(ManagementInterfaceBuildTimeConfig @Override public void created(BeanContainer container) { container.beanInstance(ManagementPathMatchingHttpSecurityPolicy.class) - .init(buildTimeConfig.auth.permissions, policies, buildTimeConfig.rootPath); + .init(buildTimeConfig.auth().permissions(), policies, buildTimeConfig.rootPath()); } }; } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/options/HttpServerCommonHandlers.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/options/HttpServerCommonHandlers.java index 562611de71eb4..44c6cac25d36d 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/options/HttpServerCommonHandlers.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/options/HttpServerCommonHandlers.java @@ -30,8 +30,8 @@ public class HttpServerCommonHandlers { public static void enforceMaxBodySize(ServerLimitsConfig limits, Router httpRouteRouter) { - if (limits.maxBodySize.isPresent()) { - long limit = limits.maxBodySize.get().asLongValue(); + if (limits.maxBodySize().isPresent()) { + long limit = limits.maxBodySize().get().asLongValue(); Long limitObj = limit; httpRouteRouter.route().order(-2).handler(new Handler() { @Override @@ -87,7 +87,7 @@ public void handle(Void x) { public static Handler applyProxy(ProxyConfig proxyConfig, Handler root, Supplier vertx) { - if (proxyConfig.proxyAddressForwarding) { + if (proxyConfig.proxyAddressForwarding()) { final ForwardingProxyOptions forwardingProxyOptions = ForwardingProxyOptions.from(proxyConfig); final TrustedProxyCheck.TrustedProxyCheckBuilder proxyCheckBuilder = forwardingProxyOptions.trustedProxyCheckBuilder; if (proxyCheckBuilder == null) { @@ -111,10 +111,10 @@ public static void applyFilters(Map filtersInConfig, Route if (!filtersInConfig.isEmpty()) { for (var entry : filtersInConfig.entrySet()) { var filterConfig = entry.getValue(); - var matches = filterConfig.matches; - var order = filterConfig.order.orElse(Integer.MIN_VALUE); - var methods = filterConfig.methods; - var headers = filterConfig.header; + var matches = filterConfig.matches(); + var order = filterConfig.order().orElse(Integer.MIN_VALUE); + var methods = filterConfig.methods(); + var headers = filterConfig.header(); if (methods.isEmpty()) { httpRouteRouter.routeWithRegex(matches) .order(order) @@ -148,24 +148,24 @@ public static void applyHeaders(Map headers, Router httpRo for (Map.Entry entry : headers.entrySet()) { var name = entry.getKey(); var config = entry.getValue(); - if (config.methods.isEmpty()) { - httpRouteRouter.route(config.path) + if (config.methods().isEmpty()) { + httpRouteRouter.route(config.path()) .order(Integer.MIN_VALUE) .handler(new Handler() { @Override public void handle(RoutingContext event) { - event.response().headers().set(name, config.value); + event.response().headers().set(name, config.value()); event.next(); } }); } else { - for (String method : config.methods.get()) { - httpRouteRouter.route(HttpMethod.valueOf(method.toUpperCase(Locale.ROOT)), config.path) + for (String method : config.methods().get()) { + httpRouteRouter.route(HttpMethod.valueOf(method.toUpperCase(Locale.ROOT)), config.path()) .order(Integer.MIN_VALUE) .handler(new Handler() { @Override public void handle(RoutingContext event) { - event.response().headers().add(name, config.value); + event.response().headers().add(name, config.value()); event.next(); } }); diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/options/HttpServerOptionsUtils.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/options/HttpServerOptionsUtils.java index 40da5213448a2..77c9e694ea011 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/options/HttpServerOptionsUtils.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/options/HttpServerOptionsUtils.java @@ -38,43 +38,43 @@ public class HttpServerOptionsUtils { public static HttpServerOptions createSslOptions(HttpBuildTimeConfig buildTimeConfig, HttpConfiguration httpConfiguration, LaunchMode launchMode, List websocketSubProtocols) throws IOException { - if (!httpConfiguration.hostEnabled) { + if (!httpConfiguration.hostEnabled()) { return null; } - ServerSslConfig sslConfig = httpConfiguration.ssl; + ServerSslConfig sslConfig = httpConfiguration.ssl(); final List keys = new ArrayList<>(); final List certificates = new ArrayList<>(); - if (sslConfig.certificate.keyFiles.isPresent()) { - keys.addAll(sslConfig.certificate.keyFiles.get()); + if (sslConfig.certificate().keyFiles().isPresent()) { + keys.addAll(sslConfig.certificate().keyFiles().get()); } - if (sslConfig.certificate.files.isPresent()) { - certificates.addAll(sslConfig.certificate.files.get()); + if (sslConfig.certificate().files().isPresent()) { + certificates.addAll(sslConfig.certificate().files().get()); } // credentials provider Map credentials = Map.of(); - if (sslConfig.certificate.credentialsProvider.isPresent()) { - String beanName = sslConfig.certificate.credentialsProviderName.orElse(null); + if (sslConfig.certificate().credentialsProvider().isPresent()) { + String beanName = sslConfig.certificate().credentialsProviderName().orElse(null); CredentialsProvider credentialsProvider = CredentialsProviderFinder.find(beanName); - String name = sslConfig.certificate.credentialsProvider.get(); + String name = sslConfig.certificate().credentialsProvider().get(); credentials = credentialsProvider.getCredentials(name); } - final Optional keyStoreFile = sslConfig.certificate.keyStoreFile; - final Optional keyStorePassword = getCredential(sslConfig.certificate.keyStorePassword, credentials, - sslConfig.certificate.keyStorePasswordKey); - final Optional keyStoreKeyPassword = getCredential(sslConfig.certificate.keyStoreKeyPassword, credentials, - sslConfig.certificate.keyStoreKeyPasswordKey); - final Optional trustStoreFile = sslConfig.certificate.trustStoreFile; - final Optional trustStorePassword = getCredential(sslConfig.certificate.trustStorePassword, credentials, - sslConfig.certificate.trustStorePasswordKey); + final Optional keyStoreFile = sslConfig.certificate().keyStoreFile(); + final Optional keyStorePassword = getCredential(sslConfig.certificate().keyStorePassword(), credentials, + sslConfig.certificate().keyStorePasswordKey()); + final Optional keyStoreKeyPassword = getCredential(sslConfig.certificate().keyStoreKeyPassword(), credentials, + sslConfig.certificate().keyStoreKeyPasswordKey()); + final Optional trustStoreFile = sslConfig.certificate().trustStoreFile(); + final Optional trustStorePassword = getCredential(sslConfig.certificate().trustStorePassword(), credentials, + sslConfig.certificate().trustStorePasswordKey()); final HttpServerOptions serverOptions = new HttpServerOptions(); //ssl if (JdkSSLEngineOptions.isAlpnAvailable()) { - serverOptions.setUseAlpn(httpConfiguration.http2); - if (httpConfiguration.http2) { + serverOptions.setUseAlpn(httpConfiguration.http2()); + if (httpConfiguration.http2()) { serverOptions.setAlpnVersions(Arrays.asList(HttpVersion.HTTP_2, HttpVersion.HTTP_1_1)); } } @@ -86,9 +86,9 @@ public static HttpServerOptions createSslOptions(HttpBuildTimeConfig buildTimeCo KeyStoreOptions options = createKeyStoreOptions( keyStoreFile.get(), keyStorePassword.orElse("password"), - sslConfig.certificate.keyStoreFileType, - sslConfig.certificate.keyStoreProvider, - sslConfig.certificate.keyStoreKeyAlias, + sslConfig.certificate().keyStoreFileType(), + sslConfig.certificate().keyStoreProvider(), + sslConfig.certificate().keyStoreKeyAlias(), keyStoreKeyPassword); serverOptions.setKeyCertOptions(options); } @@ -100,24 +100,24 @@ public static HttpServerOptions createSslOptions(HttpBuildTimeConfig buildTimeCo KeyStoreOptions options = createKeyStoreOptions( trustStoreFile.get(), trustStorePassword.get(), - sslConfig.certificate.trustStoreFileType, - sslConfig.certificate.trustStoreProvider, - sslConfig.certificate.trustStoreCertAlias, + sslConfig.certificate().trustStoreFileType(), + sslConfig.certificate().trustStoreProvider(), + sslConfig.certificate().trustStoreCertAlias(), Optional.empty()); serverOptions.setTrustOptions(options); } - for (String cipher : sslConfig.cipherSuites.orElse(Collections.emptyList())) { + for (String cipher : sslConfig.cipherSuites().orElse(Collections.emptyList())) { serverOptions.addEnabledCipherSuite(cipher); } - serverOptions.setEnabledSecureTransportProtocols(sslConfig.protocols); + serverOptions.setEnabledSecureTransportProtocols(sslConfig.protocols()); serverOptions.setSsl(true); - serverOptions.setSni(sslConfig.sni); + serverOptions.setSni(sslConfig.sni()); int sslPort = httpConfiguration.determineSslPort(launchMode); // -2 instead of -1 (see http) to have vert.x assign two different random ports if both http and https shall be random serverOptions.setPort(sslPort == 0 ? -2 : sslPort); - serverOptions.setClientAuth(buildTimeConfig.tlsClientAuth); + serverOptions.setClientAuth(buildTimeConfig.tlsClientAuth()); applyCommonOptions(serverOptions, buildTimeConfig, httpConfiguration, websocketSubProtocols); @@ -131,37 +131,37 @@ public static HttpServerOptions createSslOptionsForManagementInterface(Managemen ManagementInterfaceConfiguration httpConfiguration, LaunchMode launchMode, List websocketSubProtocols) throws IOException { - if (!httpConfiguration.hostEnabled) { + if (!httpConfiguration.hostEnabled()) { return null; } - ServerSslConfig sslConfig = httpConfiguration.ssl; + ServerSslConfig sslConfig = httpConfiguration.ssl(); final List keys = new ArrayList<>(); final List certificates = new ArrayList<>(); - if (sslConfig.certificate.keyFiles.isPresent()) { - keys.addAll(sslConfig.certificate.keyFiles.get()); + if (sslConfig.certificate().keyFiles().isPresent()) { + keys.addAll(sslConfig.certificate().keyFiles().get()); } - if (sslConfig.certificate.files.isPresent()) { - certificates.addAll(sslConfig.certificate.files.get()); + if (sslConfig.certificate().files().isPresent()) { + certificates.addAll(sslConfig.certificate().files().get()); } // credentials provider Map credentials = Map.of(); - if (sslConfig.certificate.credentialsProvider.isPresent()) { - String beanName = sslConfig.certificate.credentialsProviderName.orElse(null); + if (sslConfig.certificate().credentialsProvider().isPresent()) { + String beanName = sslConfig.certificate().credentialsProviderName().orElse(null); CredentialsProvider credentialsProvider = CredentialsProviderFinder.find(beanName); - String name = sslConfig.certificate.credentialsProvider.get(); + String name = sslConfig.certificate().credentialsProvider().get(); credentials = credentialsProvider.getCredentials(name); } - final Optional keyStoreFile = sslConfig.certificate.keyStoreFile; - final Optional keyStorePassword = getCredential(sslConfig.certificate.keyStorePassword, credentials, - sslConfig.certificate.keyStorePasswordKey); - final Optional keyStoreKeyPassword = getCredential(sslConfig.certificate.keyStoreKeyPassword, credentials, - sslConfig.certificate.keyStoreKeyPasswordKey); - final Optional trustStoreFile = sslConfig.certificate.trustStoreFile; - final Optional trustStorePassword = getCredential(sslConfig.certificate.trustStorePassword, credentials, - sslConfig.certificate.trustStorePasswordKey); + final Optional keyStoreFile = sslConfig.certificate().keyStoreFile(); + final Optional keyStorePassword = getCredential(sslConfig.certificate().keyStorePassword(), credentials, + sslConfig.certificate().keyStorePasswordKey()); + final Optional keyStoreKeyPassword = getCredential(sslConfig.certificate().keyStoreKeyPassword(), credentials, + sslConfig.certificate().keyStoreKeyPasswordKey()); + final Optional trustStoreFile = sslConfig.certificate().trustStoreFile(); + final Optional trustStorePassword = getCredential(sslConfig.certificate().trustStorePassword(), credentials, + sslConfig.certificate().trustStorePasswordKey()); final HttpServerOptions serverOptions = new HttpServerOptions(); //ssl @@ -169,7 +169,7 @@ public static HttpServerOptions createSslOptionsForManagementInterface(Managemen serverOptions.setUseAlpn(true); serverOptions.setAlpnVersions(Arrays.asList(HttpVersion.HTTP_2, HttpVersion.HTTP_1_1)); } - int idleTimeout = (int) httpConfiguration.idleTimeout.toMillis(); + int idleTimeout = (int) httpConfiguration.idleTimeout().toMillis(); serverOptions.setIdleTimeout(idleTimeout); serverOptions.setIdleTimeoutUnit(TimeUnit.MILLISECONDS); @@ -179,9 +179,9 @@ public static HttpServerOptions createSslOptionsForManagementInterface(Managemen KeyStoreOptions options = createKeyStoreOptions( keyStoreFile.get(), keyStorePassword.orElse("password"), - sslConfig.certificate.keyStoreFileType, - sslConfig.certificate.keyStoreProvider, - sslConfig.certificate.keyStoreKeyAlias, + sslConfig.certificate().keyStoreFileType(), + sslConfig.certificate().keyStoreProvider(), + sslConfig.certificate().keyStoreKeyAlias(), keyStoreKeyPassword); serverOptions.setKeyCertOptions(options); } @@ -193,25 +193,25 @@ public static HttpServerOptions createSslOptionsForManagementInterface(Managemen KeyStoreOptions options = createKeyStoreOptions( trustStoreFile.get(), trustStorePassword.get(), - sslConfig.certificate.trustStoreFileType, - sslConfig.certificate.trustStoreProvider, - sslConfig.certificate.trustStoreCertAlias, + sslConfig.certificate().trustStoreFileType(), + sslConfig.certificate().trustStoreProvider(), + sslConfig.certificate().trustStoreCertAlias(), Optional.empty()); serverOptions.setTrustOptions(options); } - for (String cipher : sslConfig.cipherSuites.orElse(Collections.emptyList())) { + for (String cipher : sslConfig.cipherSuites().orElse(Collections.emptyList())) { serverOptions.addEnabledCipherSuite(cipher); } - serverOptions.setEnabledSecureTransportProtocols(sslConfig.protocols); + serverOptions.setEnabledSecureTransportProtocols(sslConfig.protocols()); serverOptions.setSsl(true); - serverOptions.setSni(sslConfig.sni); + serverOptions.setSni(sslConfig.sni()); int sslPort = httpConfiguration.determinePort(launchMode); // -2 instead of -1 (see http) to have vert.x assign two different random ports if both http and https shall be random serverOptions.setPort(sslPort == 0 ? -2 : sslPort); - serverOptions.setClientAuth(buildTimeConfig.tlsClientAuth); + serverOptions.setClientAuth(buildTimeConfig.tlsClientAuth()); applyCommonOptionsForManagementInterface(serverOptions, buildTimeConfig, httpConfiguration, websocketSubProtocols); @@ -235,42 +235,43 @@ public static void applyCommonOptions(HttpServerOptions httpServerOptions, HttpBuildTimeConfig buildTimeConfig, HttpConfiguration httpConfiguration, List websocketSubProtocols) { - httpServerOptions.setHost(httpConfiguration.host); + httpServerOptions.setHost(httpConfiguration.host()); setIdleTimeout(httpConfiguration, httpServerOptions); - httpServerOptions.setMaxHeaderSize(httpConfiguration.limits.maxHeaderSize.asBigInteger().intValueExact()); - httpServerOptions.setMaxChunkSize(httpConfiguration.limits.maxChunkSize.asBigInteger().intValueExact()); - httpServerOptions.setMaxFormAttributeSize(httpConfiguration.limits.maxFormAttributeSize.asBigInteger().intValueExact()); + httpServerOptions.setMaxHeaderSize(httpConfiguration.limits().maxHeaderSize().asBigInteger().intValueExact()); + httpServerOptions.setMaxChunkSize(httpConfiguration.limits().maxChunkSize().asBigInteger().intValueExact()); + httpServerOptions + .setMaxFormAttributeSize(httpConfiguration.limits().maxFormAttributeSize().asBigInteger().intValueExact()); httpServerOptions.setWebSocketSubProtocols(websocketSubProtocols); - httpServerOptions.setReusePort(httpConfiguration.soReusePort); - httpServerOptions.setTcpQuickAck(httpConfiguration.tcpQuickAck); - httpServerOptions.setTcpCork(httpConfiguration.tcpCork); - httpServerOptions.setAcceptBacklog(httpConfiguration.acceptBacklog); - httpServerOptions.setTcpFastOpen(httpConfiguration.tcpFastOpen); - httpServerOptions.setCompressionSupported(buildTimeConfig.enableCompression); - if (buildTimeConfig.compressionLevel.isPresent()) { - httpServerOptions.setCompressionLevel(buildTimeConfig.compressionLevel.getAsInt()); + httpServerOptions.setReusePort(httpConfiguration.soReusePort()); + httpServerOptions.setTcpQuickAck(httpConfiguration.tcpQuickAck()); + httpServerOptions.setTcpCork(httpConfiguration.tcpCork()); + httpServerOptions.setAcceptBacklog(httpConfiguration.acceptBacklog()); + httpServerOptions.setTcpFastOpen(httpConfiguration.tcpFastOpen()); + httpServerOptions.setCompressionSupported(buildTimeConfig.enableCompression()); + if (buildTimeConfig.compressionLevel().isPresent()) { + httpServerOptions.setCompressionLevel(buildTimeConfig.compressionLevel().getAsInt()); } - httpServerOptions.setDecompressionSupported(buildTimeConfig.enableDecompression); - httpServerOptions.setMaxInitialLineLength(httpConfiguration.limits.maxInitialLineLength); - httpServerOptions.setHandle100ContinueAutomatically(httpConfiguration.handle100ContinueAutomatically); + httpServerOptions.setDecompressionSupported(buildTimeConfig.enableDecompression()); + httpServerOptions.setMaxInitialLineLength(httpConfiguration.limits().maxInitialLineLength()); + httpServerOptions.setHandle100ContinueAutomatically(httpConfiguration.handle100ContinueAutomatically()); - if (httpConfiguration.http2) { + if (httpConfiguration.http2()) { var settings = new Http2Settings(); - if (httpConfiguration.limits.headerTableSize.isPresent()) { - settings.setHeaderTableSize(httpConfiguration.limits.headerTableSize.getAsLong()); + if (httpConfiguration.limits().headerTableSize().isPresent()) { + settings.setHeaderTableSize(httpConfiguration.limits().headerTableSize().getAsLong()); } - settings.setPushEnabled(httpConfiguration.http2PushEnabled); - if (httpConfiguration.limits.maxConcurrentStreams.isPresent()) { - settings.setMaxConcurrentStreams(httpConfiguration.limits.maxConcurrentStreams.getAsLong()); + settings.setPushEnabled(httpConfiguration.http2PushEnabled()); + if (httpConfiguration.limits().maxConcurrentStreams().isPresent()) { + settings.setMaxConcurrentStreams(httpConfiguration.limits().maxConcurrentStreams().getAsLong()); } - if (httpConfiguration.initialWindowSize.isPresent()) { - settings.setInitialWindowSize(httpConfiguration.initialWindowSize.getAsInt()); + if (httpConfiguration.initialWindowSize().isPresent()) { + settings.setInitialWindowSize(httpConfiguration.initialWindowSize().getAsInt()); } - if (httpConfiguration.limits.maxFrameSize.isPresent()) { - settings.setMaxFrameSize(httpConfiguration.limits.maxFrameSize.getAsInt()); + if (httpConfiguration.limits().maxFrameSize().isPresent()) { + settings.setMaxFrameSize(httpConfiguration.limits().maxFrameSize().getAsInt()); } - if (httpConfiguration.limits.maxHeaderListSize.isPresent()) { - settings.setMaxHeaderListSize(httpConfiguration.limits.maxHeaderListSize.getAsLong()); + if (httpConfiguration.limits().maxHeaderListSize().isPresent()) { + settings.setMaxHeaderListSize(httpConfiguration.limits().maxHeaderListSize().getAsLong()); } httpServerOptions.setInitialSettings(settings); } @@ -280,24 +281,24 @@ public static void applyCommonOptionsForManagementInterface(HttpServerOptions op ManagementInterfaceBuildTimeConfig buildTimeConfig, ManagementInterfaceConfiguration httpConfiguration, List websocketSubProtocols) { - options.setHost(httpConfiguration.host.orElse("0.0.0.0")); + options.setHost(httpConfiguration.host().orElse("0.0.0.0")); - int idleTimeout = (int) httpConfiguration.idleTimeout.toMillis(); + int idleTimeout = (int) httpConfiguration.idleTimeout().toMillis(); options.setIdleTimeout(idleTimeout); options.setIdleTimeoutUnit(TimeUnit.MILLISECONDS); - options.setMaxHeaderSize(httpConfiguration.limits.maxHeaderSize.asBigInteger().intValueExact()); - options.setMaxChunkSize(httpConfiguration.limits.maxChunkSize.asBigInteger().intValueExact()); - options.setMaxFormAttributeSize(httpConfiguration.limits.maxFormAttributeSize.asBigInteger().intValueExact()); - options.setMaxInitialLineLength(httpConfiguration.limits.maxInitialLineLength); + options.setMaxHeaderSize(httpConfiguration.limits().maxHeaderSize().asBigInteger().intValueExact()); + options.setMaxChunkSize(httpConfiguration.limits().maxChunkSize().asBigInteger().intValueExact()); + options.setMaxFormAttributeSize(httpConfiguration.limits().maxFormAttributeSize().asBigInteger().intValueExact()); + options.setMaxInitialLineLength(httpConfiguration.limits().maxInitialLineLength()); options.setWebSocketSubProtocols(websocketSubProtocols); - options.setAcceptBacklog(httpConfiguration.acceptBacklog); - options.setCompressionSupported(buildTimeConfig.enableCompression); - if (buildTimeConfig.compressionLevel.isPresent()) { - options.setCompressionLevel(buildTimeConfig.compressionLevel.getAsInt()); + options.setAcceptBacklog(httpConfiguration.acceptBacklog()); + options.setCompressionSupported(buildTimeConfig.enableCompression()); + if (buildTimeConfig.compressionLevel().isPresent()) { + options.setCompressionLevel(buildTimeConfig.compressionLevel().getAsInt()); } - options.setDecompressionSupported(buildTimeConfig.enableDecompression); - options.setHandle100ContinueAutomatically(httpConfiguration.handle100ContinueAutomatically); + options.setDecompressionSupported(buildTimeConfig.enableDecompression()); + options.setHandle100ContinueAutomatically(httpConfiguration.handle100ContinueAutomatically()); } private static KeyStoreOptions createKeyStoreOptions(Path path, String password, Optional fileType, @@ -378,7 +379,7 @@ private static byte[] doRead(InputStream is) throws IOException { } private static void setIdleTimeout(HttpConfiguration httpConfiguration, HttpServerOptions options) { - int idleTimeout = (int) httpConfiguration.idleTimeout.toMillis(); + int idleTimeout = (int) httpConfiguration.idleTimeout().toMillis(); options.setIdleTimeout(idleTimeout); options.setIdleTimeoutUnit(TimeUnit.MILLISECONDS); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/AbstractPathMatchingHttpSecurityPolicy.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/AbstractPathMatchingHttpSecurityPolicy.java index 185387e80061a..d9ef00a58b239 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/AbstractPathMatchingHttpSecurityPolicy.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/AbstractPathMatchingHttpSecurityPolicy.java @@ -89,25 +89,25 @@ public void init(Map permissions, Map> tempMap = new HashMap<>(); for (Map.Entry entry : permissions.entrySet()) { - HttpSecurityPolicy checker = permissionCheckers.get(entry.getValue().policy); + HttpSecurityPolicy checker = permissionCheckers.get(entry.getValue().policy()); if (checker == null) { - throw new RuntimeException("Unable to find HTTP security policy " + entry.getValue().policy); + throw new RuntimeException("Unable to find HTTP security policy " + entry.getValue().policy()); } - if (entry.getValue().enabled.orElse(Boolean.TRUE)) { - for (String path : entry.getValue().paths.orElse(Collections.emptyList())) { + if (entry.getValue().enabled().orElse(Boolean.TRUE)) { + for (String path : entry.getValue().paths().orElse(Collections.emptyList())) { path = path.trim(); if (!path.startsWith("/")) { path = rootPath + path; } if (tempMap.containsKey(path)) { - HttpMatcher m = new HttpMatcher(entry.getValue().authMechanism.orElse(null), - new HashSet<>(entry.getValue().methods.orElse(Collections.emptyList())), + HttpMatcher m = new HttpMatcher(entry.getValue().authMechanism().orElse(null), + new HashSet<>(entry.getValue().methods().orElse(Collections.emptyList())), checker); tempMap.get(path).add(m); } else { - HttpMatcher m = new HttpMatcher(entry.getValue().authMechanism.orElse(null), - new HashSet<>(entry.getValue().methods.orElse(Collections.emptyList())), + HttpMatcher m = new HttpMatcher(entry.getValue().authMechanism().orElse(null), + new HashSet<>(entry.getValue().methods().orElse(Collections.emptyList())), checker); List perms = new ArrayList<>(); tempMap.put(path, perms); diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpSecurityRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpSecurityRecorder.java index 84b3ef16064ad..a688891631bf0 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpSecurityRecorder.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpSecurityRecorder.java @@ -94,7 +94,7 @@ public BeanContainerListener initPermissions(HttpBuildTimeConfig buildTimeConfig @Override public void created(BeanContainer container) { container.beanInstance(PathMatchingHttpSecurityPolicy.class) - .init(buildTimeConfig.auth.permissions, policies, buildTimeConfig.rootPath); + .init(buildTimeConfig.auth().permissions(), policies, buildTimeConfig.rootPath()); } }; } @@ -106,7 +106,7 @@ public Supplier setupFormAuth() { @Override public FormAuthenticationMechanism get() { String key; - if (!httpConfiguration.getValue().encryptionKey.isPresent()) { + if (!httpConfiguration.getValue().encryptionKey().isPresent()) { if (encryptionKey != null) { //persist across dev mode restarts key = encryptionKey; @@ -117,23 +117,24 @@ public FormAuthenticationMechanism get() { log.warn("Encryption key was not specified for persistent FORM auth, using temporary key " + key); } } else { - key = httpConfiguration.getValue().encryptionKey.get(); + key = httpConfiguration.getValue().encryptionKey().get(); } - FormAuthConfig form = buildTimeConfig.auth.form; - PersistentLoginManager loginManager = new PersistentLoginManager(key, form.cookieName, form.timeout.toMillis(), - form.newCookieInterval.toMillis(), form.httpOnlyCookie, form.cookieSameSite.name(), - form.cookiePath.orElse(null)); - String loginPage = startWithSlash(form.loginPage.orElse(null)); - String errorPage = startWithSlash(form.errorPage.orElse(null)); - String landingPage = startWithSlash(form.landingPage.orElse(null)); - String postLocation = startWithSlash(form.postLocation); - String usernameParameter = form.usernameParameter; - String passwordParameter = form.passwordParameter; - String locationCookie = form.locationCookie; - String cookiePath = form.cookiePath.orElse(null); - boolean redirectAfterLogin = form.redirectAfterLogin; + FormAuthConfig form = buildTimeConfig.auth().form(); + PersistentLoginManager loginManager = new PersistentLoginManager(key, form.cookieName(), + form.timeout().toMillis(), + form.newCookieInterval().toMillis(), form.httpOnlyCookie(), form.cookieSameSite().name(), + form.cookiePath().orElse(null)); + String loginPage = startWithSlash(form.loginPage().orElse(null)); + String errorPage = startWithSlash(form.errorPage().orElse(null)); + String landingPage = startWithSlash(form.landingPage().orElse(null)); + String postLocation = startWithSlash(form.postLocation()); + String usernameParameter = form.usernameParameter(); + String passwordParameter = form.passwordParameter(); + String locationCookie = form.locationCookie(); + String cookiePath = form.cookiePath().orElse(null); + boolean redirectAfterLogin = form.redirectAfterLogin(); return new FormAuthenticationMechanism(loginPage, postLocation, usernameParameter, passwordParameter, - errorPage, landingPage, redirectAfterLogin, locationCookie, form.cookieSameSite.name(), cookiePath, + errorPage, landingPage, redirectAfterLogin, locationCookie, form.cookieSameSite().name(), cookiePath, loginManager); } }; @@ -150,8 +151,8 @@ public Supplier setupBasicAuth(HttpBuildTimeConfig buildTimeConfig) { return new Supplier() { @Override public BasicAuthenticationMechanism get() { - return new BasicAuthenticationMechanism(buildTimeConfig.auth.realm.orElse(null), - buildTimeConfig.auth.form.enabled); + return new BasicAuthenticationMechanism(buildTimeConfig.auth().realm().orElse(null), + buildTimeConfig.auth().form().enabled()); } }; } diff --git a/extensions/webjars-locator/deployment/src/main/java/io/quarkus/webjar/locator/deployment/WebJarLocatorStandaloneBuildStep.java b/extensions/webjars-locator/deployment/src/main/java/io/quarkus/webjar/locator/deployment/WebJarLocatorStandaloneBuildStep.java index 95dd06ed48fb7..f8aba4274b42e 100644 --- a/extensions/webjars-locator/deployment/src/main/java/io/quarkus/webjar/locator/deployment/WebJarLocatorStandaloneBuildStep.java +++ b/extensions/webjars-locator/deployment/src/main/java/io/quarkus/webjar/locator/deployment/WebJarLocatorStandaloneBuildStep.java @@ -87,7 +87,7 @@ public void findWebjarsAndCreateHandler( if (!webjarNameToVersionMap.isEmpty()) { // The context path + the resources path - String rootPath = httpConfig.rootPath; + String rootPath = httpConfig.rootPath(); String webjarRootPath = (rootPath.endsWith("/")) ? rootPath + "webjars/" : rootPath + "/webjars/"; feature.produce(new FeatureBuildItem(Feature.WEBJARS_LOCATOR)); routes.produce( diff --git a/integration-tests/test-extension/extension/deployment/src/test/java/io/quarkus/extest/UnknownConfigTest.java b/integration-tests/test-extension/extension/deployment/src/test/java/io/quarkus/extest/UnknownConfigTest.java index 97b201903d50f..eba70b89bc9ae 100644 --- a/integration-tests/test-extension/extension/deployment/src/test/java/io/quarkus/extest/UnknownConfigTest.java +++ b/integration-tests/test-extension/extension/deployment/src/test/java/io/quarkus/extest/UnknownConfigTest.java @@ -45,7 +45,7 @@ public class UnknownConfigTest { @Test void unknown() { assertEquals("1234", config.getConfigValue("quarkus.unknown.prop").getValue()); - assertEquals("/1234", httpBuildTimeConfig.nonApplicationRootPath); - assertEquals(4443, httpConfiguration.sslPort); + assertEquals("/1234", httpBuildTimeConfig.nonApplicationRootPath()); + assertEquals(4443, httpConfiguration.sslPort()); } }