2014-10-05 92 views
1

我想在BlueMix Liberty Profile上部署Web应用程序,并且希望在此应用程序上启用基本HTTP身份验证。bluemix上的基本身份验证

该应用似乎运行良好,但没有web.xml更改或更新允许我做基本或基于表单的身份验证。

回答

2

有关启用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> 

一旦你有做,你就需要在自由设置基本身份验证的注册表和角色映射 - 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

最后,你需要用重新部署应用完成自由服务器,请参阅https://www.ng.bluemix.net/docs/#starters/liberty/index.html#optionsforpushinglibertyapplications“推送自由服务器”。