維護應用程式端點安全
您可以完成下列步驟,來維護特性的應用程式端點的安全:
程序
- 在特性的 .mf 檔中,新增 com.ibm.wsspi.appserver.webBundleSecurity-1.0 特性到 Subsystem-Content: 標頭中。 這項新增會使任何受保護的 Servlet(如特性軟體組的 WEB-INF/web.xml 檔所指定)接受鑑別,且會啟用角色型授權。
您也可以將使用者、群組和特殊主題指派給 WEB-INF/web.xml 檔中所定義的任何角色。
Subsystem-Content: my.user.feature.bundle; version="[1,1.0.100)", com.ibm.wsspi.appserver.webBundleSecurity-1.0; type="osgi.subsystem.feature"
- 如果要將角色對映至使用者、群組或特殊主題,請執行下列步驟:
- 新增 IBM®-Authorization-Roles 標頭至 OSGi 軟體組的 MANIFEST.MF 檔中。 標頭必須指定一個名稱,這個名稱是您在 server.xml 檔中指定之角色對映的 ID。
IBM-Authorization-Roles: my.feature.role.map
- 在 server.xml 檔中,新增一個將角色名稱對映至使用者和群組的 authorization-roles 元素。 authorization-roles 元素的 id 屬性必須與 MANIFEST.MF 檔中 IBM-Authorization-Roles 標頭具有相同的值。
請針對您想要指派給使用者和群組的每一個角色來新增 <security-role> 子元素。
<authorization-roles id="my.feature.role.map"> <security-role name="employee"> <special-subject type="ALL_AUTHENTICATED_USERS"/> </security-role> <security-role name="manager"> <user name="bob"/> <user name="mary"/> <group name="managers"/> </security-role> </authorization-roles>
註: 您也可以在伺服器配置中配置 appSecurity-1.0 或 appSecurity-2.0 特性,以啟用安全。如果您是在 Web 應用程式軟體組 (WAB) 啟動之後啟用特性,請重新啟動 WAB。
- 新增 IBM®-Authorization-Roles 標頭至 OSGi 軟體組的 MANIFEST.MF 檔中。 標頭必須指定一個名稱,這個名稱是您在 server.xml 檔中指定之角色對映的 ID。
上層主題: 提供應用程式端點

檔名:twlp_secure_app_endpoint.html