搜索

5.2.2.2. 配置客户机访问权限

download PDF

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

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

以下步骤演示了如何配置 guest 访问。

先决条件

流程

  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";
    };
    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 访问,其中只有那些没有凭据的用户才会以 guest 身份登录。在本示例中,观察与前面的配置过程相比,登录模块的顺序已被撤销。此外,附加到属性登录模块的 标志也更改为 必需

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";
};

根据上述配置,如果没有提供登录凭据,则激活客户机身份验证模块。

对于此用例,在 guest login 模块的配置中必须将 credentialsInvalidate 选项设置为 true

如果提供了凭据,属性登录模块会被激活。凭据必须是有效的。

其它资源

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.