- 论坛徽章:
- 0
|
WebLogic6.0的一些使用经验
三、在WebLogic6.0中设置资源的访问权限
WebLogic6.0几乎可以对它所管理的所有资源设置访问控制表,包括EJB、JSP、SERVLET、POOL、JMS、RMI、JNDI、JDBC等等。当用户第一次访问设置了访问控制表的资源时,WebLogic6.0会弹出一个对话框要求输入口令及密码,如果连输3次都不对,会返回以下错误:
Error 401--Unauthorized xxx From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1: 10.4.2 401 Unauthorized
对访问权限的设置有两种方式:
在WebLogic6.O的控制台中设置,把结果保存到fileRealm.properties中,即采用WebLogic6.0的file realm.感觉对DATABASE POOL,EJB等比较好用,对JSP,SERVER及某个目录设置访问控制表比较难。我试了很多次都没成功。它可对WEB用户(通过浏览器访问)和普通用户(通过JAVA客户端等访问)起作用。
在WEB.XML,WebLogic.XML中设置,只能对WEB用户起作用。下面举个例子说明这种方式。
如:在一个名为OrderWebApp的WEB APPLICATION中,客户的定单文件都放到/orders目录下,只有manager能浏览该目录下的文件。其WEB.XML及WebLogic.XML可设置如下:
*************************WEB.XML*************************
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 1.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">;
<web-app>;
<security-constraint>;
<web-resource-collection>;
<web-resource-name>;SecureOrdersEast</web-resource-name>;
<description>;Security constraint for resources in the orders directory</description>;
<url-pattern>;/orders/*</url-pattern>;
<http-method>OST</http-method>;
<http-method>;GET</http-method>;
</web-resource-collection>;
<auth-constraint>;
<description>;constraint for orders</description>;
<role-name>;manager</role-name>;
</auth-constraint>;
<user-data-constraint>;
<description>;SSL not required</description>;
<transport-guarantee>;NONE</transport-guarantee>;
</user-data-constraint>;
</security-constraint>;
<security-role>;
<description>;managers</description>;
<role-name>;manager</role-name>;
</security-role>;
</web-app>; |
|