This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch of
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 25ace11c3161f9e0fea008a5799675178ba41929
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Feb 26 15:09:30 2026 +0100

    camel-oauth - Add SPI factory so other Camel components can easily use this 
for oauth.
---
 .../component/cassandra/CassandraEndpoint.java     |  6 ++--
 .../camel/oauth-client-authentication-factory      |  2 ++
 .../DefaultOAuthClientAuthenticationFactory.java   | 30 +++++++++++++++++
 .../spi/OAuthClientAuthenticationFactory.java      | 38 ++++++++++++++++++++++
 4 files changed, 74 insertions(+), 2 deletions(-)

diff --git 
a/components/camel-cassandraql/src/main/java/org/apache/camel/component/cassandra/CassandraEndpoint.java
 
b/components/camel-cassandraql/src/main/java/org/apache/camel/component/cassandra/CassandraEndpoint.java
index ba94a025e5ab..a1e523923d68 100644
--- 
a/components/camel-cassandraql/src/main/java/org/apache/camel/component/cassandra/CassandraEndpoint.java
+++ 
b/components/camel-cassandraql/src/main/java/org/apache/camel/component/cassandra/CassandraEndpoint.java
@@ -199,8 +199,10 @@ public class CassandraEndpoint extends 
ScheduledPollEndpoint implements Endpoint
             }
 
             for (String codec : c) {
-                if 
(ObjectHelper.isNotEmpty(CassandraExtraCodecs.valueOf(codec))) {
-                    
sessionBuilder.addTypeCodecs(CassandraExtraCodecs.valueOf(codec).codec());
+                codec = codec.trim();
+                CassandraExtraCodecs ec = 
getCamelContext().getTypeConverter().tryConvertTo(CassandraExtraCodecs.class, 
codec);
+                if (ec != null) {
+                    sessionBuilder.addTypeCodecs(ec.codec());
                 }
             }
         }
diff --git 
a/components/camel-oauth/src/generated/resources/META-INF/services/org/apache/camel/oauth-client-authentication-factory
 
b/components/camel-oauth/src/generated/resources/META-INF/services/org/apache/camel/oauth-client-authentication-factory
new file mode 100644
index 000000000000..07f480dc9be7
--- /dev/null
+++ 
b/components/camel-oauth/src/generated/resources/META-INF/services/org/apache/camel/oauth-client-authentication-factory
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.oauth.DefaultOAuthClientAuthenticationFactory
diff --git 
a/components/camel-oauth/src/main/java/org/apache/camel/oauth/DefaultOAuthClientAuthenticationFactory.java
 
b/components/camel-oauth/src/main/java/org/apache/camel/oauth/DefaultOAuthClientAuthenticationFactory.java
new file mode 100644
index 000000000000..4fee44e2a918
--- /dev/null
+++ 
b/components/camel-oauth/src/main/java/org/apache/camel/oauth/DefaultOAuthClientAuthenticationFactory.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.oauth;
+
+import org.apache.camel.Processor;
+import org.apache.camel.spi.OAuthClientAuthenticationFactory;
+import org.apache.camel.spi.annotations.JdkService;
+
+@JdkService(OAuthClientAuthenticationFactory.FACTORY)
+public class DefaultOAuthClientAuthenticationFactory implements 
OAuthClientAuthenticationFactory {
+
+    @Override
+    public Processor createOAuthClientAuthenticationProcessor() {
+        return new OAuthClientCredentialsProcessor();
+    }
+}
diff --git 
a/core/camel-api/src/main/java/org/apache/camel/spi/OAuthClientAuthenticationFactory.java
 
b/core/camel-api/src/main/java/org/apache/camel/spi/OAuthClientAuthenticationFactory.java
new file mode 100644
index 000000000000..6dec5ec7ae57
--- /dev/null
+++ 
b/core/camel-api/src/main/java/org/apache/camel/spi/OAuthClientAuthenticationFactory.java
@@ -0,0 +1,38 @@
+/*
+ * 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.spi;
+
+import org.apache.camel.Processor;
+
+/**
+ * Factory for clients to use camel-oauth for authentication.
+ */
+public interface OAuthClientAuthenticationFactory {
+
+    /**
+     * Service factory key for custom factories.
+     */
+    String FACTORY = "oauth-client-authentication-factory";
+
+    /**
+     * Creates the {@link Processor} that will perform OAuth client 
authentication using the camel-oauth component.
+     *
+     * @return the processor to use for oauth authentication.
+     */
+    Processor createOAuthClientAuthenticationProcessor();
+
+}

Reply via email to