5.2.2.2. 配置客户机访问


对于没有登录凭证或凭证失败身份验证的用户,您可以使用客户机帐户授予对代理的有限访问权限。

您可以使用 命令行参数创建启用客户机访问的代理实例;-- allow-anonymous (与 --require-login相对应)。

以下步骤演示了如何配置客户机访问。

先决条件

步骤

  1. 打开之前为基本身份验证配置的 <broker-instance-dir>/etc/login.config 配置文件。
  2. 在之前添加的属性登录模块配置后,添加客户机登录模块配置。例如:

    activemq {
      org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoginModule sufficient
          debug=true
          org.apache.activemq.jaas.properties.user="artemis-users.properties"
          org.apache.activemq.jaas.properties.role="artemis-roles.properties";
    
      org.apache.activemq.artemis.spi.core.security.jaas.GuestLoginModule sufficient
          debug=true
          org.apache.activemq.jaas.guest.user="guest"
          org.apache.activemq.jaas.guest.role="restricted";
    };
    Copy to Clipboard Toggle word wrap
    org.apache.activemq.artemis.spi.core.security.jaas.GuestLoginModule
    实施类。
    org.apache.activemq.jaas.guest.user
    分配给匿名用户的用户名。
    org.apache.activemq.jaas.guest.role
    分配给匿名用户的角色。

根据前面的配置,用户提供凭据时将激活用户和密码身份验证模块。如果用户不提供凭证,或者提供凭证不正确,则激活客户端身份验证。

5.2.2.2.1. 客户机访问示例

以下示例显示配置客户机访问,其中只有没有凭证的用户以 guest 的身份登录。在这个示例中,观察登录模块的顺序与之前的配置过程进行比较。另外,附加到属性登录模块的标志也更改为 requisite

activemq {
    org.apache.activemq.artemis.spi.core.security.jaas.GuestLoginModule sufficient
        debug=true
       credentialsInvalidate=true
       org.apache.activemq.jaas.guest.user="guest"
       org.apache.activemq.jaas.guest.role="guests";

    org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoginModule requisite
        debug=true
        org.apache.activemq.jaas.properties.user="artemis-users.properties"
        org.apache.activemq.jaas.properties.role="artemis-roles.properties";
};
Copy to Clipboard Toggle word wrap

根据前面的配置,如果没有提供登录凭据,则将激活 guest 身份验证模块。

对于此用例,在配置客户机登录模块时,必须将 credentialsInvalidate 选项设为 true

如果提供凭证,则属性登录模块将被激活。凭据必须有效。

其他资源

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat