Little-G:为您的应用服务器瘦身
2009-11-10 00:00:00 来源:WEB开发网部署安全域
这个示例应用程序使用一个基于数据库的安全域,在安装 Web 应用程序之前必须安装这个域。编辑安全域部署计划 —— config/TimeReportRealm.xml —— 指定依赖项为 postgreSQL 数据库驱动程序 .jar 文件、JDBC 驱动程序类和登录模块配置的 JDBC 连接 URL,如清单 2 所示。
清单 2. 安全域配置部署计划<module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
<environment>
<moduleId>
<groupId>console</groupId>
<artifactId>TimeReportRealm</artifactId>
<version>1.0</version>
<type>car</type>
</moduleId>
<dependencies>
<dependency>
<groupId>geronimo</groupId>
<artifactId>j2ee-security</artifactId>
<type>car</type>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>8.0</version>
<type>jar</type>
</dependency>
</dependencies>
</environment>
<gbean name="TimeReportRealm"
class="org.apache.geronimo.security.realm.GenericSecurityRealm">
<attribute name="realmName">TimeReportRealm</attribute>
<reference name="ServerInfo">
<name>ServerInfo</name>
</reference>
<reference name="LoginService">
<name>JaasLoginService</name>
</reference>
<xml-reference name="LoginModuleConfiguration">
<log:login-config
xmlns:log="http://geronimo.apache.org/xml/ns/loginconfig-1.1">
<log:login-module control-flag="REQUIRED"
server-side="true" wrap-principals="false">
<log:login-domain-name>TimeReportRealm</log:login-domain-name>
<log:login-module-class>
org.apache.geronimo.security.realm.providers.SQLLoginModule<
/log:login-module-class>
<log:option name="jdbcDriver">org.postgresql.Driver</log:option>
<log:option name="jdbcUser">postgres</log:option>
<log:option name="userSelect">
select userid, password from users where userid=?
</log:option>
<log:option name="groupSelect">
select userid, groupname from usergroups where userid=?
</log:option>
<log:option name="jdbcURL">
jdbc:postgresql://localhost:5432/TimeReportDB
</log:option>
</log:login-module>
</log:login-config>
</xml-reference>
</gbean>
</module>
更多精彩
赞助商链接