180.7. 隐藏敏感信息


从 Camel 2.12 开始提供

默认情况下,Camel enlists MBeans 在 JMX 中,如使用 URI 配置的端点。在此配置中,可能有一些敏感信息,如密码。

通过启用 mask 选项可以隐藏这些信息,如下所示:

使用 Java DSL,您可以通过以下方法打开:

  // only enable routes when Camel starts
  context.getManagementStrategy().getManagementAgent().setMask(true);

在 Spring DSL 中:

    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
        <jmxAgent id="agent" mask="true"/>
     ...
    </camelContext>

这将屏蔽带有密码和密码短语等选项的 URI,并使用 xxxxxx 作为替换值。

180.7.1. 声明哪些 JMX 属性和操作到掩码

org.apache.camel.api.management.ManagedAttributeorg.apache.camel.api.management.ManagedOperation 中,属性 掩码 可以设置为 true,以指示此 JMX 属性/操作的结果应该被屏蔽(如果在 JMX 代理上启用)。

例如,在 camel-core org.apache.camel.api.management.mbean.ManagedEndpointMBean 中的默认管理端点上,我们声明了 EndpointUri JMX 属性被屏蔽:

@ManagedAttribute(description = "Endpoint URI", mask = true)
String getEndpointUri();
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部