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 22430456b871 camel-grpc: jwtAlgorithm advertises JWT algorithms that 
do not exist (#29425)
22430456b871 is described below

commit 22430456b8710719bca7d2eaabfbde8dcc9c746a
Author: dhairya05 <[email protected]>
AuthorDate: Mon Nov 9 15:03:56 2026 +0530

    camel-grpc: jwtAlgorithm advertises JWT algorithms that do not exist 
(#29425)
    
    * camel-grpc: stop advertising JWT algorithms that do not exist
    * camel-grpc: regenerate the component and catalog JSON
    * camel-grpc: cover every declared JWT algorithm with a test
    * Regen
    * camel-grpc: derive the jwtAlgorithm enum list from JwtAlgorithm
---
 .../org/apache/camel/catalog/components/grpc.json  |  2 +-
 .../org/apache/camel/component/grpc/grpc.json      |  2 +-
 .../camel/component/grpc/GrpcConfiguration.java    |  2 +-
 .../component/grpc/auth/jwt/JwtHelperTest.java     | 47 ++++++++++++++++++++++
 4 files changed, 50 insertions(+), 3 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/grpc.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/grpc.json
index 2ef8c871005e..eb5b52301405 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/grpc.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/grpc.json
@@ -77,7 +77,7 @@
     "lazyStartProducer": { "index": 33, "kind": "parameter", "displayName": 
"Lazy Start Producer", "group": "producer (advanced)", "label": 
"producer,advanced", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Whether the producer should be started 
lazy (on the first message). By starting lazy you can use this to allow 
CamelContext and routes to startup in situations where a produ [...]
     "synchronous": { "index": 34, "kind": "parameter", "displayName": 
"Synchronous", "group": "advanced", "label": "advanced", "required": false, 
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": false, "configurationClass": 
"org.apache.camel.component.grpc.GrpcConfiguration", "configurationField": 
"configuration", "description": "Sets whether synchronous processing should be 
strictly used" },
     "authenticationType": { "index": 35, "kind": "parameter", "displayName": 
"Authentication Type", "group": "security", "label": "security", "required": 
false, "type": "enum", "javaType": 
"org.apache.camel.component.grpc.GrpcAuthType", "enum": [ "NONE", "GOOGLE", 
"JWT" ], "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": "NONE", "configurationClass": 
"org.apache.camel.component.grpc.GrpcConfiguration", "configurationField": 
"configuration", "description": "Authen [...]
-    "jwtAlgorithm": { "index": 36, "kind": "parameter", "displayName": "Jwt 
Algorithm", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.grpc.auth.jwt.JwtAlgorithm", "enum": [ "HMAC256", 
"HMAC384", "HMAC512", "RSA256", "RSA384", "RSA512" ], "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": "HMAC256", 
"configurationClass": "org.apache.camel.component.grpc.GrpcConfiguration", 
"configurationField": " [...]
+    "jwtAlgorithm": { "index": 36, "kind": "parameter", "displayName": "Jwt 
Algorithm", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.grpc.auth.jwt.JwtAlgorithm", "enum": [ "HMAC256", 
"HMAC384", "HMAC512" ], "deprecated": false, "autowired": false, "secret": 
false, "defaultValue": "HMAC256", "configurationClass": 
"org.apache.camel.component.grpc.GrpcConfiguration", "configurationField": 
"configuration", "description": [...]
     "jwtIssuer": { "index": 37, "kind": "parameter", "displayName": "Jwt 
Issuer", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.grpc.GrpcConfiguration", "configurationField": 
"configuration", "description": "JSON Web Token issuer" },
     "jwtSecret": { "index": 38, "kind": "parameter", "displayName": "Jwt 
Secret", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.grpc.GrpcConfiguration", "configurationField": 
"configuration", "description": "JSON Web Token secret" },
     "jwtSubject": { "index": 39, "kind": "parameter", "displayName": "Jwt 
Subject", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.grpc.GrpcConfiguration", "configurationField": 
"configuration", "description": "JSON Web Token subject" },
diff --git 
a/components/camel-grpc/src/generated/resources/META-INF/org/apache/camel/component/grpc/grpc.json
 
b/components/camel-grpc/src/generated/resources/META-INF/org/apache/camel/component/grpc/grpc.json
index 2ef8c871005e..eb5b52301405 100644
--- 
a/components/camel-grpc/src/generated/resources/META-INF/org/apache/camel/component/grpc/grpc.json
+++ 
b/components/camel-grpc/src/generated/resources/META-INF/org/apache/camel/component/grpc/grpc.json
@@ -77,7 +77,7 @@
     "lazyStartProducer": { "index": 33, "kind": "parameter", "displayName": 
"Lazy Start Producer", "group": "producer (advanced)", "label": 
"producer,advanced", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Whether the producer should be started 
lazy (on the first message). By starting lazy you can use this to allow 
CamelContext and routes to startup in situations where a produ [...]
     "synchronous": { "index": 34, "kind": "parameter", "displayName": 
"Synchronous", "group": "advanced", "label": "advanced", "required": false, 
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": false, "configurationClass": 
"org.apache.camel.component.grpc.GrpcConfiguration", "configurationField": 
"configuration", "description": "Sets whether synchronous processing should be 
strictly used" },
     "authenticationType": { "index": 35, "kind": "parameter", "displayName": 
"Authentication Type", "group": "security", "label": "security", "required": 
false, "type": "enum", "javaType": 
"org.apache.camel.component.grpc.GrpcAuthType", "enum": [ "NONE", "GOOGLE", 
"JWT" ], "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": "NONE", "configurationClass": 
"org.apache.camel.component.grpc.GrpcConfiguration", "configurationField": 
"configuration", "description": "Authen [...]
-    "jwtAlgorithm": { "index": 36, "kind": "parameter", "displayName": "Jwt 
Algorithm", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.grpc.auth.jwt.JwtAlgorithm", "enum": [ "HMAC256", 
"HMAC384", "HMAC512", "RSA256", "RSA384", "RSA512" ], "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": "HMAC256", 
"configurationClass": "org.apache.camel.component.grpc.GrpcConfiguration", 
"configurationField": " [...]
+    "jwtAlgorithm": { "index": 36, "kind": "parameter", "displayName": "Jwt 
Algorithm", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.grpc.auth.jwt.JwtAlgorithm", "enum": [ "HMAC256", 
"HMAC384", "HMAC512" ], "deprecated": false, "autowired": false, "secret": 
false, "defaultValue": "HMAC256", "configurationClass": 
"org.apache.camel.component.grpc.GrpcConfiguration", "configurationField": 
"configuration", "description": [...]
     "jwtIssuer": { "index": 37, "kind": "parameter", "displayName": "Jwt 
Issuer", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.grpc.GrpcConfiguration", "configurationField": 
"configuration", "description": "JSON Web Token issuer" },
     "jwtSecret": { "index": 38, "kind": "parameter", "displayName": "Jwt 
Secret", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.grpc.GrpcConfiguration", "configurationField": 
"configuration", "description": "JSON Web Token secret" },
     "jwtSubject": { "index": 39, "kind": "parameter", "displayName": "Jwt 
Subject", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.grpc.GrpcConfiguration", "configurationField": 
"configuration", "description": "JSON Web Token subject" },
diff --git 
a/components/camel-grpc/src/main/java/org/apache/camel/component/grpc/GrpcConfiguration.java
 
b/components/camel-grpc/src/main/java/org/apache/camel/component/grpc/GrpcConfiguration.java
index a2a4a3de7304..455a8efce291 100644
--- 
a/components/camel-grpc/src/main/java/org/apache/camel/component/grpc/GrpcConfiguration.java
+++ 
b/components/camel-grpc/src/main/java/org/apache/camel/component/grpc/GrpcConfiguration.java
@@ -57,7 +57,7 @@ public class GrpcConfiguration {
     @UriParam(label = "security", defaultValue = "NONE", enums = 
"NONE,GOOGLE,JWT")
     private GrpcAuthType authenticationType = GrpcAuthType.NONE;
 
-    @UriParam(label = "security", defaultValue = "HMAC256", enums = 
"HMAC256,HMAC384,HMAC512,RSA256,RSA384,RSA512")
+    @UriParam(label = "security", defaultValue = "HMAC256")
     private JwtAlgorithm jwtAlgorithm = JwtAlgorithm.HMAC256;
 
     @UriParam(label = "security", security = "secret")
diff --git 
a/components/camel-grpc/src/test/java/org/apache/camel/component/grpc/auth/jwt/JwtHelperTest.java
 
b/components/camel-grpc/src/test/java/org/apache/camel/component/grpc/auth/jwt/JwtHelperTest.java
new file mode 100644
index 000000000000..9c2a5357f2d1
--- /dev/null
+++ 
b/components/camel-grpc/src/test/java/org/apache/camel/component/grpc/auth/jwt/JwtHelperTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.grpc.auth.jwt;
+
+import com.auth0.jwt.algorithms.Algorithm;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+class JwtHelperTest {
+
+    private static final String SECRET = "supersecuredsecret";
+
+    /**
+     * The jwtAlgorithm endpoint option advertises exactly the constants of 
{@link JwtAlgorithm}, so each of them has to
+     * be backed by an implementation here. Without this, the option can offer 
a value that fails as soon as it is used.
+     */
+    @Test
+    void everyDeclaredAlgorithmIsImplemented() {
+        for (JwtAlgorithm algorithm : JwtAlgorithm.values()) {
+            Algorithm selected = JwtHelper.selectAlgorithm(algorithm, SECRET);
+            assertNotNull(selected, () -> "no implementation for 
JwtAlgorithm." + algorithm);
+        }
+    }
+
+    @Test
+    void everyDeclaredAlgorithmSignsAToken() {
+        for (JwtAlgorithm algorithm : JwtAlgorithm.values()) {
+            String token = JwtHelper.createJwtToken(algorithm, SECRET, 
"issuer", "subject");
+            assertNotNull(token, () -> "no token signed for JwtAlgorithm." + 
algorithm);
+        }
+    }
+}

Reply via email to