我正在尝试在 BlueMix Liberty Profile 上部署一个 Web 应用程序,并且我想在此应用程序上启用基本 HTTP 身份验证。
该应用程序似乎运行良好,但没有 web.xml 更改或更新允许我进行基本或基于表单的身份验证。
我正在尝试在 BlueMix Liberty Profile 上部署一个 Web 应用程序,并且我想在此应用程序上启用基本 HTTP 身份验证。
该应用程序似乎运行良好,但没有 web.xml 更改或更新允许我进行基本或基于表单的身份验证。
有关在 liberty 上启用安全性的详细信息,请参阅 Liberty 指南 - 简而言之,您需要编辑 web.xml 并添加所需的安全约束。
例子:
<security-role>
<role-name>restricted</role-name>
</security-role>
<security-constraint>
<web-resource-collection>
<web-resource-name>Web Application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>restricted</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Restricted area</realm-name>
</login-config>
完成后,您需要在 Liberty 中设置基本身份验证注册表和角色映射 - http://www-01.ibm.com/support/knowledgecenter/SS7JFU_8.5.5/com.ibm.websphere.wlp.express。 doc/ae/twlp_sec_basicreg_full.html?cp=SS7JFU_8.5.5%2F1-3-11-0-4-0-1
最后,您需要使用完整的 liberty 服务器重新部署您的应用程序,请参阅https://www.ng.bluemix.net/docs/#starters/liberty/index.html#optionsforpushinglibertyapplications “Pushing Liberty Server”。