You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/08/09 09:44:15 UTC
[camel] 01/03: Fixed secret in apt compiler plugin and allow to set
it via @UriPath as well
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 0f3d8e6b7d7b8577bbda9fe65a4bcf5e7d44d45f
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Aug 9 11:07:43 2019 +0200
Fixed secret in apt compiler plugin and allow to set it via @UriPath as well
---
.../java/org/apache/camel/component/telegram/TelegramComponent.java | 2 +-
.../org/apache/camel/component/telegram/TelegramConfiguration.java | 2 +-
.../java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java | 4 ++--
.../spi-annotations/src/main/java/org/apache/camel/spi/UriPath.java | 5 +++++
4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramComponent.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramComponent.java
index 398df40..7ef7232 100644
--- a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramComponent.java
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramComponent.java
@@ -30,7 +30,7 @@ import org.apache.camel.util.ObjectHelper;
@Component("telegram")
public class TelegramComponent extends DefaultComponent {
- @Metadata(label = "security")
+ @Metadata(label = "security", secret = true)
private String authorizationToken;
public TelegramComponent() {
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConfiguration.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConfiguration.java
index acfa728..bc34976 100644
--- a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConfiguration.java
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConfiguration.java
@@ -33,7 +33,7 @@ public class TelegramConfiguration {
@Metadata(required = true)
private String type;
- @UriPath(description = "The authorization token for using the bot (ask the BotFather)", label = "security")
+ @UriPath(description = "The authorization token for using the bot (ask the BotFather)", label = "security", secret = true)
@Metadata(required = true)
private String authorizationToken;
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
index bbad5b7..262cbef 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
@@ -697,8 +697,8 @@ public class EndpointAnnotationProcessor extends AbstractCamelAnnotationProcesso
fieldTypeName = path.javaType();
}
+ boolean isSecret = secret != null && secret || path.secret();
String group = EndpointHelper.labelAsGroupName(label, componentModel.isConsumerOnly(), componentModel.isProducerOnly());
- boolean isSecret = secret != null ? secret : false;
EndpointPath ep = new EndpointPath(name, displayName, fieldTypeName, required, defaultValue, docComment, deprecated, deprecationNote,
isSecret, group, label, isEnum, enums);
endpointPaths.add(ep);
@@ -792,7 +792,7 @@ public class EndpointAnnotationProcessor extends AbstractCamelAnnotationProcesso
fieldTypeName = param.javaType();
}
- boolean isSecret = secret != null ? secret : param.secret();
+ boolean isSecret = secret != null && secret || param.secret();
String group = EndpointHelper.labelAsGroupName(label, componentModel.isConsumerOnly(), componentModel.isProducerOnly());
EndpointOption option = new EndpointOption(name, displayName, fieldTypeName, required, defaultValue, defaultValueNote,
docComment.trim(), paramOptionalPrefix, paramPrefix, multiValue, deprecated, deprecationNote, isSecret, group, label, isEnum, enums);
diff --git a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriPath.java b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriPath.java
index 24e2953..2bcdfc9 100644
--- a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriPath.java
+++ b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriPath.java
@@ -87,6 +87,11 @@ public @interface UriPath {
String label() default "";
/**
+ * Whether the option is secret/sensitive information such as a password.
+ */
+ boolean secret() default false;
+
+ /**
* To re-associate the preferred Java type of this parameter.
* <p/>
* This is used for parameters which are of a specialized type but can be configured by another Java type, such as from a String.