搜索

第 2 章 保护管理界面和应用程序

download PDF

2.1. 向管理界面添加身份验证和授权

您可以为管理界面添加身份验证和授权,以便使用安全域来保护它们。要在添加身份验证和授权后访问管理界面,用户必须输入登录凭证。

您可以按照以下方法保护 JBoss EAP 管理界面:

  • 管理 CLI

    通过配置一个 sasl-authentication-factory

  • 管理控制台

    通过配置一个 http-authentication-factory.

先决条件

  • 您已创建了一个引用安全域的安全域。
  • JBoss EAP 正在运行。

流程

  1. 创建一个 http-authentication-factorysasl-authentication-factory

    • 创建一个 http-authentication-factory

      语法

      /subsystem=elytron/http-authentication-factory=<authentication_factory_name>:add(http-server-mechanism-factory=global, security-domain=<security_domain_name>, mechanism-configurations=[{mechanism-name=<mechanism-name>, mechanism-realm-configurations=[{realm-name=<realm_name>}]}])

      Example

      /subsystem=elytron/http-authentication-factory=exampleAuthenticationFactory:add(http-server-mechanism-factory=global, security-domain=exampleSecurityDomain, mechanism-configurations=[{mechanism-name=BASIC, mechanism-realm-configurations=[{realm-name=exampleSecurityRealm}]}])
      {"outcome" => "success"}

    • 创建一个 sasl-authentication-factory

      语法

      /subsystem=elytron/sasl-authentication-factory=<sasl_authentication_factory_name>:add(security-domain=<security_domain>,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=<mechanism-name>,mechanism-realm-configurations=[{realm-name=<realm_name>}]}])

      Example

      /subsystem=elytron/sasl-authentication-factory=exampleSaslAuthenticationFactory:add(security-domain=exampleSecurityDomain,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=PLAIN,mechanism-realm-configurations=[{realm-name=exampleSecurityRealm}]}])
      {"outcome" => "success"}

  2. 更新管理界面。

    • 使用 http-authentication-factory 来保护管理控制台。

      语法

      /core-service=management/management-interface=http-interface:write-attribute(name=http-authentication-factory, value=<authentication_factory_name>)

      Example

      /core-service=management/management-interface=http-interface:write-attribute(name=http-authentication-factory, value=exampleAuthenticationFactory)
      {
          "outcome" => "success",
          "response-headers" => {
              "operation-requires-reload" => true,
              "process-state" => "reload-required"
          }
      }

    • 使用 sasl-authentication-factory 来保护管理 CLI。

      语法

      /core-service=management/management-interface=http-interface:write-attribute(name=http-upgrade,value={enabled=true,sasl-authentication-factory=<sasl_authentication_factory>})

      Example

      /core-service=management/management-interface=http-interface:write-attribute(name=http-upgrade,value={enabled=true,sasl-authentication-factory=exampleSaslAuthenticationFactory})
      {
          "outcome" => "success",
          "response-headers" => {
              "operation-requires-reload" => true,
              "process-state" => "reload-required"
          }
      }

  3. 重新加载服务器。

    reload

验证

  • 要验证管理控制台是否需要身份验证和授权,请导航到位于 http://127.0.0.1:9990/console/index.html 的管理控制台。

    会提示您输入用户名和密码。

  • 要验证管理 CLI 是否需要身份验证和授权,请使用以下命令启动管理 CLI:

    $ bin/jboss-cli.sh --connect

    会提示您输入用户名和密码。

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.