This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 9feb7fc630e CAMEL-22381: camel-platform-http-vertx - Do not log ERROR
for unauthenticated requests
9feb7fc630e is described below
commit 9feb7fc630eb8e9b669605f34ea41fb0a97fa945
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Aug 27 13:52:31 2025 +0200
CAMEL-22381: camel-platform-http-vertx - Do not log ERROR for
unauthenticated requests
---
.../http/vertx/VertxPlatformHttpServer.java | 2 ++
.../http/vertx/auth/Default401ErrorHandler.java | 36 ++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git
a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpServer.java
b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpServer.java
index e670c03c656..1c289d6a6cb 100644
---
a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpServer.java
+++
b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpServer.java
@@ -35,6 +35,7 @@ import org.apache.camel.api.management.ManagedResource;
import org.apache.camel.component.platform.http.PlatformHttpConstants;
import
org.apache.camel.component.platform.http.vertx.auth.AuthenticationConfig;
import
org.apache.camel.component.platform.http.vertx.auth.AuthenticationConfig.AuthenticationConfigEntry;
+import
org.apache.camel.component.platform.http.vertx.auth.Default401ErrorHandler;
import org.apache.camel.support.CamelContextHelper;
import org.apache.camel.support.service.ServiceHelper;
import org.apache.camel.support.service.ServiceSupport;
@@ -192,6 +193,7 @@ public class VertxPlatformHttpServer extends ServiceSupport
implements CamelCont
AuthenticationConfig authenticationConfig =
configuration.getAuthenticationConfig();
if (authenticationConfig.isEnabled()) {
+ router.errorHandler(401, new Default401ErrorHandler());
addAuthenticationHandlersStartingFromMoreSpecificPaths(authenticationConfig);
}
diff --git
a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/auth/Default401ErrorHandler.java
b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/auth/Default401ErrorHandler.java
new file mode 100644
index 00000000000..90b6d608784
--- /dev/null
+++
b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/auth/Default401ErrorHandler.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.platform.http.vertx.auth;
+
+import io.vertx.ext.web.RoutingContext;
+import io.vertx.ext.web.handler.ErrorHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Default401ErrorHandler implements ErrorHandler {
+
+ private static final Logger LOG =
LoggerFactory.getLogger(Default401ErrorHandler.class);
+
+ @Override
+ public void handle(RoutingContext routingContext) {
+ if (LOG.isDebugEnabled()) {
+ var req = routingContext.request();
+ LOG.debug("401 Unauthorized: {} {} {} --> {}",
req.method().name(), req.path(), req.remoteAddress(),
+ req.localAddress());
+ }
+ }
+}