棣栧厛瀹氫箟浜唗omcat-users.xml 涓殑鍐呭錛屼富瑕佽緗簡鐢ㄦ埛鍜岃鑹?br />
<?xml聽version='1.0'聽encoding='utf-8'?>
<tomcat-users>
聽聽<role聽rolename="tomcat"/>
聽聽<role聽rolename="role1"/>
聽聽<role聽rolename="manager"/>
聽聽<role聽rolename="wxds"聽description=""/>
聽聽<role聽rolename="admin"/>
聽聽<user聽username="tomcat"聽password="tomcat"聽roles="tomcat"/>
聽聽<user聽username="both"聽password="tomcat"聽roles="tomcat,role1"/>
聽聽<user聽username="role1"聽password="tomcat"聽roles="role1"/>
聽聽<user聽username="abc"聽password="abc"聽fullName="abcabc"聽roles="wxds"/>
聽聽<user聽username="admin"聽password=""聽roles="admin,manager"/>
</tomcat-users>
鐒跺悗鍦╝pplication涓殑web.xml涓搴旂殑<web-app>涓鍔犲涓嬭緗?br />
聽聽聽<security-constraint>
聽聽聽聽聽聽聽<web-resource-collection>
聽聽聽聽聽聽聽聽聽聽聽<web-resource-name>Protected聽Area</web-resource-name>
聽聽聽聽聽聽聽聽<!--聽Define聽the聽context-relative聽URL(s)聽to聽be聽protected聽-->
聽聽聽聽聽聽聽聽聽聽聽<url-pattern>錛?/span>*</url-pattern>
聽聽聽聽聽聽聽聽<!--聽If聽you聽list聽http聽methods,聽only聽those聽methods聽are聽protected聽-->
聽聽聽聽聽聽聽聽<http-method>DELETE</http-method>
聽聽聽聽聽聽聽聽聽聽聽<http-method>GET</http-method>
聽聽聽聽聽聽聽聽聽聽聽<http-method>POST</http-method>
聽聽聽聽聽聽聽聽<http-method>PUT</http-method>
聽聽聽聽聽聽聽</web-resource-collection>
聽聽聽聽聽聽聽<auth-constraint>
聽聽聽聽聽聽聽聽聽聽聽<!--聽Anyone聽with聽one聽of聽the聽listed聽roles聽may聽access聽this聽area聽-->
聽聽聽聽聽聽聽聽聽聽聽<role-name>wxds</role-name>
聽聽聽聽聽聽聽</auth-constraint>
聽聽聽</security-constraint>
聽聽聽<login-config>
聽聽聽聽聽聽聽<auth-method>BASIC</auth-method>
聽聽聽聽聽聽聽<realm-name>EShop</realm-name>
聽聽聽</login-config>

榪欐牱灝卞ソ浜嗭紝鐧誨綍榪欎釜web搴旂敤浼?xì)鏈変釜楠岃瘉绐楀彛寮瑰嚭锛岃緭鍏ョ敤鎴峰悕abc鍜屽瘑鐮乤bc鍚庡氨鑳芥甯歌闂簡銆?br />
鍦╳eblogic8.1涓殑閰嶇疆姣旇緝楹葷儲錛岄鍏堝湪web.xml鐨?lt;web-app>涓鍔犱笂闈竴孌典唬鐮佸悗錛岃繕瑕佸姞涓婅繖涓孌?br />
<security-role>
聽聽聽聽聽聽 <role-name>wxds</role-name>
</security-role>
鐒跺悗鏂板緩涓涓獁eblogic.xml 鍐呭濡備笅
<?xml聽version="1.0"聽encoding="UTF-8"?>
<!DOCTYPE聽weblogic-web-app聽PUBLIC聽"-//BEA聽Systems,聽Inc.//DTD聽Web聽Application聽8.1//EN"聽"http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd">

<weblogic-web-app>

聽聽<security-role-assignment>
聽聽聽聽<role-name>wxds</role-name>
聽聽聽聽<principal-name>wxds_group</principal-name>
聽聽</security-role-assignment>

</weblogic-web-app>榪涘叆weblogic鐨刢onsole錛屽湪mydomain-security-realms涓柊寤轟竴涓猺ealm
name: wxdsRealm
check roles and policies for: web applications and ejbs protected in dd
灞曞紑wxdsRealm錛?br />鍦╬roviders涓璫onfigure a new default adjudicator... 榛樿鍒涘緩
鍦╝uditors涓垱寤轟竴涓己鐪乤uditor
鐒跺悗鍒涘緩涓涓己鐪佺殑authentication,authorizers, cred mappers 鍜宺ole mapper 絳夌瓑
鏈鍚庡彲浠ュ湪testing涓祴璇曚竴涓?validate this security realm... 鐪嬫槸鍚uccessful
鍦╣roups涓畾涔変竴涓猤roup name: wxds_group
鍦╱sers涓璫onfigure a new user
name: jyds password:11111111
鎶婂垰鎵嶅緩绔嬬殑wxds_group 澧炲姞榪涙潵
鎶奡ecurity涓殑Default Realm璁劇疆涓簑xdsRealm, 鏈鍚嶢pply灝眔k鍟︺?br />

]]>