This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push:
new 288a0b835f Add OAuth extension
288a0b835f is described below
commit 288a0b835f470dc09c3815c3dc35a9d2b6f2fdca
Author: JiriOndrusek <[email protected]>
AuthorDate: Tue Dec 23 11:35:55 2025 +0100
Add OAuth extension
Fixes #8036
---
catalog/pom.xml | 13 ++
docs/modules/ROOT/examples/others/oauth.yml | 13 ++
docs/modules/ROOT/nav.adoc | 1 +
.../ROOT/pages/reference/extensions/oauth.adoc | 45 ++++++
extensions/oauth/deployment/pom.xml | 67 +++++++++
.../component/oauth/deployment/OauthProcessor.java | 30 ++++
extensions/oauth/pom.xml | 39 +++++
extensions/oauth/runtime/pom.xml | 105 ++++++++++++++
.../main/resources/META-INF/quarkus-extension.yaml | 33 +++++
extensions/pom.xml | 1 +
integration-tests/oauth/pom.xml | 161 +++++++++++++++++++++
.../quarkus/component/oauth/it/OathRoutes.java | 59 ++++++++
.../src/main/resources/application.properties | 20 +++
.../camel/quarkus/component/oauth/it/OauthIT.java | 23 +++
.../oauth/it/OauthKeycloakTestResource.java | 70 +++++++++
.../quarkus/component/oauth/it/OauthTest.java | 58 ++++++++
.../oauth/src/test/resources/camel-realm.json | 84 +++++++++++
integration-tests/pom.xml | 1 +
poms/bom/pom.xml | 15 ++
poms/bom/src/main/generated/flattened-full-pom.xml | 15 ++
.../src/main/generated/flattened-reduced-pom.xml | 15 ++
.../generated/flattened-reduced-verbose-pom.xml | 15 ++
tooling/scripts/test-categories.yaml | 1 +
23 files changed, 884 insertions(+)
diff --git a/catalog/pom.xml b/catalog/pom.xml
index 827db4003f..7fd6c2bd58 100644
--- a/catalog/pom.xml
+++ b/catalog/pom.xml
@@ -3022,6 +3022,19 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-oauth</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-observability-services</artifactId>
diff --git a/docs/modules/ROOT/examples/others/oauth.yml
b/docs/modules/ROOT/examples/others/oauth.yml
new file mode 100644
index 0000000000..799f940a4d
--- /dev/null
+++ b/docs/modules/ROOT/examples/others/oauth.yml
@@ -0,0 +1,13 @@
+# Do not edit directly!
+# This file was generated by
camel-quarkus-maven-plugin:update-extension-doc-page
+cqArtifactId: camel-quarkus-oauth
+cqArtifactIdBase: oauth
+cqNativeSupported: true
+cqStatus: Stable
+cqDeprecated: false
+cqJvmSince: 3.31.0
+cqNativeSince: 3.31.0
+cqCamelPartName: oauth
+cqCamelPartTitle: Oauth
+cqCamelPartDescription: Camel OAuth (Preview)
+cqExtensionPageTitle: Oauth
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index a6b5fb1b72..dc98a029d3 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -245,6 +245,7 @@
*** xref:reference/extensions/oaipmh.adoc[OAI-PMH]
*** xref:reference/extensions/ognl.adoc[OGNL]
*** xref:reference/extensions/milo.adoc[OPC UA Browser]
+*** xref:reference/extensions/oauth.adoc[Oauth]
*** xref:reference/extensions/observability-services.adoc[Observability
Services]
*** xref:reference/extensions/olingo4.adoc[Olingo4]
*** xref:reference/extensions/openapi-java.adoc[OpenAPI Java]
diff --git a/docs/modules/ROOT/pages/reference/extensions/oauth.adoc
b/docs/modules/ROOT/pages/reference/extensions/oauth.adoc
new file mode 100644
index 0000000000..5334f421d7
--- /dev/null
+++ b/docs/modules/ROOT/pages/reference/extensions/oauth.adoc
@@ -0,0 +1,45 @@
+// Do not edit directly!
+// This file was generated by
camel-quarkus-maven-plugin:update-extension-doc-page
+[id="extensions-oauth"]
+= Oauth
+:linkattrs:
+:cq-artifact-id: camel-quarkus-oauth
+:cq-native-supported: true
+:cq-status: Stable
+:cq-status-deprecation: Stable
+:cq-description: Camel OAuth (Preview)
+:cq-deprecated: false
+:cq-jvm-since: 3.31.0
+:cq-native-since: 3.31.0
+
+ifeval::[{doc-show-badges} == true]
+[.badges]
+[.badge-key]##JVM since##[.badge-supported]##3.31.0## [.badge-key]##Native
since##[.badge-supported]##3.31.0##
+endif::[]
+
+Camel OAuth (Preview)
+
+[id="extensions-oauth-whats-inside"]
+== What's inside
+
+* xref:{cq-camel-components}:others:oauth.adoc[Oauth]
+
+Please refer to the above link for usage and configuration details.
+
+[id="extensions-oauth-maven-coordinates"]
+== Maven coordinates
+
+https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-oauth[Create
a new project with this extension on {link-quarkus-code-generator},
window="_blank"]
+
+Or add the coordinates to your existing project:
+
+[source,xml]
+----
+<dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-oauth</artifactId>
+</dependency>
+----
+ifeval::[{doc-show-user-guide-link} == true]
+Check the xref:user-guide/index.adoc[User guide] for more information about
writing Camel Quarkus applications.
+endif::[]
diff --git a/extensions/oauth/deployment/pom.xml
b/extensions/oauth/deployment/pom.xml
new file mode 100644
index 0000000000..ac8457cea6
--- /dev/null
+++ b/extensions/oauth/deployment/pom.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-oauth-parent</artifactId>
+ <version>3.31.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-oauth-deployment</artifactId>
+ <name>Camel Quarkus :: Oauth :: Deployment</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-oauth</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+
<artifactId>camel-quarkus-support-httpclient5-deployment</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>io.quarkus</groupId>
+
<artifactId>quarkus-extension-processor</artifactId>
+ <version>${quarkus.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git
a/extensions/oauth/deployment/src/main/java/org/apache/camel/quarkus/component/oauth/deployment/OauthProcessor.java
b/extensions/oauth/deployment/src/main/java/org/apache/camel/quarkus/component/oauth/deployment/OauthProcessor.java
new file mode 100644
index 0000000000..71bc56c1a0
--- /dev/null
+++
b/extensions/oauth/deployment/src/main/java/org/apache/camel/quarkus/component/oauth/deployment/OauthProcessor.java
@@ -0,0 +1,30 @@
+/*
+ * 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.quarkus.component.oauth.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+
+class OauthProcessor {
+
+ private static final String FEATURE = "camel-oauth";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+}
diff --git a/extensions/oauth/pom.xml b/extensions/oauth/pom.xml
new file mode 100644
index 0000000000..67695c8fca
--- /dev/null
+++ b/extensions/oauth/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-extensions</artifactId>
+ <version>3.31.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-oauth-parent</artifactId>
+ <name>Camel Quarkus :: Oauth</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>deployment</module>
+ <module>runtime</module>
+ </modules>
+</project>
diff --git a/extensions/oauth/runtime/pom.xml b/extensions/oauth/runtime/pom.xml
new file mode 100644
index 0000000000..e68b7d0b52
--- /dev/null
+++ b/extensions/oauth/runtime/pom.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-oauth-parent</artifactId>
+ <version>3.31.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-oauth</artifactId>
+ <name>Camel Quarkus :: Oauth :: Runtime</name>
+ <description>Camel OAuth (Preview)</description>
+
+ <properties>
+ <camel.quarkus.jvmSince>3.31.0</camel.quarkus.jvmSince>
+ <camel.quarkus.nativeSince>3.31.0</camel.quarkus.nativeSince>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-oauth</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-httpclient5</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>io.quarkus</groupId>
+
<artifactId>quarkus-extension-processor</artifactId>
+ <version>${quarkus.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+ <profiles>
+ <profile>
+ <id>full</id>
+ <activation>
+ <property>
+ <name>!quickly</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>update-extension-doc-page</id>
+ <goals>
+ <goal>update-extension-doc-page</goal>
+ </goals>
+ <phase>process-classes</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git
a/extensions/oauth/runtime/src/main/resources/META-INF/quarkus-extension.yaml
b/extensions/oauth/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000000..4e0205aebd
--- /dev/null
+++
b/extensions/oauth/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -0,0 +1,33 @@
+#
+# 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.
+#
+
+# This is a generated file. Do not edit directly!
+# To re-generate, run the following command from the top level directory:
+#
+# mvn -N cq:update-quarkus-metadata
+#
+---
+name: "Camel Oauth"
+description: "Camel OAuth (Preview)"
+metadata:
+ icon-url:
"https://raw.githubusercontent.com/apache/camel-website/main/antora-ui-camel/src/img/logo-d.svg"
+ sponsor: "Apache Software Foundation"
+ guide:
"https://camel.apache.org/camel-quarkus/latest/reference/extensions/oauth.html"
+ categories:
+ - "integration"
+ status:
+ - "stable"
diff --git a/extensions/pom.xml b/extensions/pom.xml
index f6c942ceef..30a865c7d5 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -213,6 +213,7 @@
<module>netty-http</module>
<module>nitrite</module>
<module>oaipmh</module>
+ <module>oauth</module>
<module>observability-services</module>
<module>ognl</module>
<module>olingo4</module>
diff --git a/integration-tests/oauth/pom.xml b/integration-tests/oauth/pom.xml
new file mode 100644
index 0000000000..5bd2bc2700
--- /dev/null
+++ b/integration-tests/oauth/pom.xml
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-build-parent-it</artifactId>
+ <version>3.31.0-SNAPSHOT</version>
+ <relativePath>../../poms/build-parent-it/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-integration-test-oauth</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: Oauth</name>
+ <description>Integration tests for Camel Quarkus Oauth
extension</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-oauth</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-platform-http</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy</artifactId>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-test-keycloak-server</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.testcontainers</groupId>
+ <artifactId>testcontainers</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit4-mock</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <properties>
+ <quarkus.native.enabled>true</quarkus.native.enabled>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>virtualDependencies</id>
+ <activation>
+ <property>
+ <name>!noVirtualDependencies</name>
+ </property>
+ </activation>
+ <dependencies>
+ <!-- The following dependencies guarantee that this module is
built after them. You can update them by running `mvn process-resources
-Pformat -N` from the source tree root directory -->
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-oauth-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+
<artifactId>camel-quarkus-platform-http-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>skip-testcontainers-tests</id>
+ <activation>
+ <property>
+ <name>skip-testcontainers-tests</name>
+ </property>
+ </activation>
+ <properties>
+ <skipTests>true</skipTests>
+ </properties>
+ </profile>
+ </profiles>
+
+</project>
diff --git
a/integration-tests/oauth/src/main/java/org/apache/camel/quarkus/component/oauth/it/OathRoutes.java
b/integration-tests/oauth/src/main/java/org/apache/camel/quarkus/component/oauth/it/OathRoutes.java
new file mode 100644
index 0000000000..9c3bbaa461
--- /dev/null
+++
b/integration-tests/oauth/src/main/java/org/apache/camel/quarkus/component/oauth/it/OathRoutes.java
@@ -0,0 +1,59 @@
+/*
+ * 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.quarkus.component.oauth.it;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.oauth.OAuthBearerTokenProcessor;
+import org.apache.camel.oauth.OAuthClientCredentialsProcessor;
+
+@ApplicationScoped
+public class OathRoutes extends RouteBuilder {
+
+ @Inject
+ private CamelContext camelContext;
+
+ @Override
+ public void configure() throws Exception {
+ from("platform-http:/plain")
+ .routeId("plain")
+ .setBody(simple("Hello ${header.name} - No auth"));
+
+ from("platform-http:/credentials")
+ .routeId("credentials")
+ // Obtain an Authorization Token
+ .process(new OAuthClientCredentialsProcessor())
+ // Extract the Authorization Token
+ .process(exc -> {
+ var msg = exc.getMessage();
+ var authToken = msg.getHeader("Authorization",
String.class);
+ exc.getIn().setBody(authToken);
+ });
+
+ from("platform-http:/bearer")
+ .routeId("bearer")
+ .process(e -> {
+ camelContext.getGlobalOptions().put("Authorization",
e.getIn().getHeader("Authorization", String.class));
+ })
+ .process(new OAuthBearerTokenProcessor())
+ .process(e ->
camelContext.getGlobalOptions().remove("Authorization"))
+ .setBody(simple("Hello ${header.name} - bearerToken"));
+
+ }
+}
diff --git a/integration-tests/oauth/src/main/resources/application.properties
b/integration-tests/oauth/src/main/resources/application.properties
new file mode 100644
index 0000000000..859e869fd9
--- /dev/null
+++ b/integration-tests/oauth/src/main/resources/application.properties
@@ -0,0 +1,20 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+camel.oauth.base-uri=${cq.ouath.test.keycloak.uri}
+camel.oauth.client-id=camel-client
+camel.oauth.client-secret=camel-client-secret
\ No newline at end of file
diff --git
a/integration-tests/oauth/src/test/java/org/apache/camel/quarkus/component/oauth/it/OauthIT.java
b/integration-tests/oauth/src/test/java/org/apache/camel/quarkus/component/oauth/it/OauthIT.java
new file mode 100644
index 0000000000..9d37712e58
--- /dev/null
+++
b/integration-tests/oauth/src/test/java/org/apache/camel/quarkus/component/oauth/it/OauthIT.java
@@ -0,0 +1,23 @@
+/*
+ * 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.quarkus.component.oauth.it;
+
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+
+@QuarkusIntegrationTest
+class OauthIT extends OauthTest {
+}
diff --git
a/integration-tests/oauth/src/test/java/org/apache/camel/quarkus/component/oauth/it/OauthKeycloakTestResource.java
b/integration-tests/oauth/src/test/java/org/apache/camel/quarkus/component/oauth/it/OauthKeycloakTestResource.java
new file mode 100644
index 0000000000..468f97b463
--- /dev/null
+++
b/integration-tests/oauth/src/test/java/org/apache/camel/quarkus/component/oauth/it/OauthKeycloakTestResource.java
@@ -0,0 +1,70 @@
+/*
+ * 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.quarkus.component.oauth.it;
+
+import java.time.Duration;
+import java.util.Collections;
+import java.util.Map;
+
+import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+import io.quarkus.test.keycloak.server.KeycloakContainer;
+import org.eclipse.microprofile.config.ConfigProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.utility.MountableFile;
+
+import static org.apache.camel.oauth.OAuth.*;
+
+/**
+ * Inspired from
+ *
https://github.com/apache/camel-quarkus/blob/main/integration-tests/kafka-oauth/src/test/java/org/apache/camel/quarkus/kafka/oauth/it/KafkaKeycloakTestResource.java
+ */
+public class OauthKeycloakTestResource implements
QuarkusTestResourceLifecycleManager {
+
+ private static final Logger LOG =
LoggerFactory.getLogger(OauthKeycloakTestResource.class);
+ private static final String REALM_JSON =
"keycloak/realms/camel-realm.json";
+ private static final String REALM_NAME = "camel";
+
+ private KeycloakContainer keycloak;
+
+ @Override
+ public Map<String, String> start() {
+ System.setProperty("keycloak.docker.image",
+
ConfigProvider.getConfig().getValue("keycloak.container.image", String.class));
+
+ //Start keycloak container
+ keycloak = new KeycloakContainer()
+ .withStartupTimeout(Duration.ofMinutes(5))
+ .withLogConsumer(new Slf4jLogConsumer(LOG))
+ .withCopyFileToContainer(
+
MountableFile.forClasspathResource("/camel-realm.json"),
+ "/opt/keycloak/data/import/camel-realm.json")
+ .withCommand("start", "--import-realm", "--verbose");
+
+ keycloak.start();
+
+ return Collections.singletonMap("cq.ouath.test.keycloak.uri",
keycloak.getServerUrl() + "/realms/" + REALM_NAME);
+ }
+
+ @Override
+ public void stop() {
+ if (keycloak != null) {
+ keycloak.stop();
+ }
+ }
+}
diff --git
a/integration-tests/oauth/src/test/java/org/apache/camel/quarkus/component/oauth/it/OauthTest.java
b/integration-tests/oauth/src/test/java/org/apache/camel/quarkus/component/oauth/it/OauthTest.java
new file mode 100644
index 0000000000..2eb48d6a97
--- /dev/null
+++
b/integration-tests/oauth/src/test/java/org/apache/camel/quarkus/component/oauth/it/OauthTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.quarkus.component.oauth.it;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.notNullValue;
+
+@QuarkusTest
+@QuarkusTestResource(OauthKeycloakTestResource.class)
+class OauthTest {
+
+ @Test
+ void testPlain() {
+ RestAssured.given()
+ .param("name", "Kermit")
+ .get("/plain")
+ .then().statusCode(200)
+ .body(equalTo("Hello Kermit - No auth"));
+ }
+
+ @Test
+ void testCredentialsAndBearer() {
+
+ String bearerToken = RestAssured.given()
+ .get("/credentials")
+ .then()
+ .statusCode(200)
+ .body(notNullValue())
+ .extract().asString();
+
+ RestAssured.given()
+ .param("name", "SecuredKermit")
+ .param("Authorization", bearerToken)
+ .get("/bearer")
+ .then()
+ .statusCode(200)
+ .body(equalTo("Hello SecuredKermit - bearerToken"));
+ }
+}
diff --git a/integration-tests/oauth/src/test/resources/camel-realm.json
b/integration-tests/oauth/src/test/resources/camel-realm.json
new file mode 100644
index 0000000000..1e2ff6d9be
--- /dev/null
+++ b/integration-tests/oauth/src/test/resources/camel-realm.json
@@ -0,0 +1,84 @@
+{
+ "realm": "camel",
+ "accessTokenLifespan": 300,
+ "ssoSessionMaxLifespan": 32140800,
+ "ssoSessionIdleTimeout": 32140800,
+ "enabled": true,
+ "sslRequired": "external",
+ "users": [
+ {
+ "username": "alice",
+ "enabled": true,
+ "firstName": "Alice",
+ "lastName": "Brown",
+ "email": "[email protected]",
+ "credentials": [
+ {
+ "type": "password",
+ "value": "alice"
+ }
+ ],
+ "realmRoles": [
+ "user"
+ ]
+ },
+ {
+ "username": "admin",
+ "enabled": true,
+ "email": "[email protected]",
+ "credentials": [
+ {
+ "type": "password",
+ "value": "admin-password"
+ }
+ ],
+ "realmRoles": [
+ "admin"
+ ],
+ "clientRoles": {
+ "realm-management": [
+ "realm-admin"
+ ]
+ }
+ }
+ ],
+ "roles": {
+ "realm": [
+ {
+ "name": "user",
+ "description": "User privileges"
+ },
+ {
+ "name": "admin",
+ "description": "Administrator privileges"
+ }
+ ],
+ "client": {}
+ },
+ "scopeMappings": [],
+ "clientScopeMappings": {},
+ "clients": [
+ {
+ "clientId": "camel-client",
+ "enabled": true,
+ "clientAuthenticatorType": "client-secret",
+ "secret": "camel-client-secret",
+ "publicClient": false,
+ "bearerOnly": false,
+ "standardFlowEnabled": true,
+ "implicitFlowEnabled": false,
+ "directAccessGrantsEnabled": false,
+ "serviceAccountsEnabled": true,
+ "consentRequired" : false,
+ "fullScopeAllowed" : false,
+ "redirectUris": [
+ "http://127.0.0.1:8080/auth",
+ "https://example.local/auth",
+ "https://example.k3s/auth"
+ ],
+ "attributes": {
+ "post.logout.redirect.uris":
"http://127.0.0.1:8080/##https://example.local/##https://example.k3s/"
+ }
+ }
+ ]
+}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 8c4c19d18e..1be4b4adf0 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -185,6 +185,7 @@
<module>netty</module>
<module>nitrite</module>
<module>oaipmh</module>
+ <module>oauth</module>
<module>observability-services</module>
<module>ognl</module>
<module>olingo4</module>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index 130345c48c..6ae48f4907 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -2329,6 +2329,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-oauth</artifactId>
+ <version>${camel.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-observability-services</artifactId>
@@ -5595,6 +5600,16 @@
<artifactId>camel-quarkus-oaipmh-deployment</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-oauth</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-oauth-deployment</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-observability-services</artifactId>
diff --git a/poms/bom/src/main/generated/flattened-full-pom.xml
b/poms/bom/src/main/generated/flattened-full-pom.xml
index 17c38dbf76..8f777290bc 100644
--- a/poms/bom/src/main/generated/flattened-full-pom.xml
+++ b/poms/bom/src/main/generated/flattened-full-pom.xml
@@ -2245,6 +2245,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <artifactId>camel-oauth</artifactId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <version>4.16.0</version><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ </dependency>
<dependency>
<groupId>org.apache.camel</groupId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
<artifactId>camel-observability-services</artifactId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
@@ -5483,6 +5488,16 @@
<artifactId>camel-quarkus-oaipmh-deployment</artifactId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
<version>3.31.0-SNAPSHOT</version><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <artifactId>camel-quarkus-oauth</artifactId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <version>3.31.0-SNAPSHOT</version><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <artifactId>camel-quarkus-oauth-deployment</artifactId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <version>3.31.0-SNAPSHOT</version><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
<artifactId>camel-quarkus-observability-services</artifactId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
diff --git a/poms/bom/src/main/generated/flattened-reduced-pom.xml
b/poms/bom/src/main/generated/flattened-reduced-pom.xml
index 177a522291..e6d9f305ff 100644
--- a/poms/bom/src/main/generated/flattened-reduced-pom.xml
+++ b/poms/bom/src/main/generated/flattened-reduced-pom.xml
@@ -2240,6 +2240,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-oauth</artifactId>
+ <version>4.16.0</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-ognl</artifactId>
@@ -5473,6 +5478,16 @@
<artifactId>camel-quarkus-oaipmh-deployment</artifactId>
<version>3.31.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-oauth</artifactId>
+ <version>3.31.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-oauth-deployment</artifactId>
+ <version>3.31.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-observability-services</artifactId>
diff --git a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml
b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml
index 1be681601c..e0f52a9c70 100644
--- a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml
+++ b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml
@@ -2240,6 +2240,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <artifactId>camel-oauth</artifactId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <version>4.16.0</version><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ </dependency>
<dependency>
<groupId>org.apache.camel</groupId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
<artifactId>camel-ognl</artifactId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
@@ -5473,6 +5478,16 @@
<artifactId>camel-quarkus-oaipmh-deployment</artifactId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
<version>3.31.0-SNAPSHOT</version><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <artifactId>camel-quarkus-oauth</artifactId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <version>3.31.0-SNAPSHOT</version><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <artifactId>camel-quarkus-oauth-deployment</artifactId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <version>3.31.0-SNAPSHOT</version><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
<artifactId>camel-quarkus-observability-services</artifactId><!--
org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
diff --git a/tooling/scripts/test-categories.yaml
b/tooling/scripts/test-categories.yaml
index 53c6a1b329..3547897baa 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -101,6 +101,7 @@ group-05:
- fory
- hl7
- jaxb
+ - oauth
- mapstruct
- ssh
- soap