Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
JSP - A mailing list about Java Server Pages specification and reference
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
- Passing current user identity to the back-end databas

- Passing current user identity to the back-end databas

2007-07-12       - By sztank

 Back
Hi,

I'm developing an application with the following requirement:

All users have a database accounts and the application level authorization
should be used also with the database. So I need to pass through the current
user identity to the back-end database.

I'm using Jboss as 4.0.5 and Jboss Seam 1.2.1. The project I start with is
generated with seam-gen utility. I get some directions  on the Seam forum that
this should be possible with proper configuration of the JCA datasource.

According to the informations I founded on wiki and docs I trying to use
CallerIdentityLoginModule in the following way:

I added policy to the login-config.xml file

 | <application-policy name = "testdbRealm">
 |     <authentication>
 |       <login-module code = "org.jboss.resource.security
.CallerIdentityLoginModule" flag = "required">
 |           <module-option name = "userName">dumy</module-option>
 |           <module-option name = "password">dumy_pwd</module-option>
 |          <module-option name = "managedConnectionFactoryName">jboss.jca
:service=LocalTxCM,name=dbtestDatasource</module-option>
 |       </login-module>
 |    </authentication>
 | </application-policy>
 |

datasource config file dbtest-ds.xml:

 | <datasources>
 |    <local-tx-datasource>
 |       <jndi-name>dbtestDatasource</jndi-name>
 |       <connection-url>jdbc:postgresql:dbtest</connection-url>
 |       <driver-class>org.postgresql.Driver Source code of org.postgresql.Driver</driver-class>
 |       <security-domain>testdbRealm</security-domain>
 |    </local-tx-datasource>
 | </datasources>
 |

web.xml file:

 | <security-constraint>
 |   <display-name>Restrict raw XHTML Documents</display-name>
 |   <web-resource-collection>
 |    <web-resource-name>XHTML</web-resource-name>
 |    <url-pattern>*.xhtml</url-pattern>
 |    <http-method>GET</http-method>
 |    <http-method>POST</http-method>
 |   </web-resource-collection>
 |   <auth-constraint>
 |    <role-name>admin</role-name>
 |   </auth-constraint>
 |  </security-constraint>
 |  <login-config>
 |   <auth-method>BASIC</auth-method>
 |   <realm-name>testdbRealm</realm-name>
 |  </login-config>
 |  <security-role>
 |   <role-name>admin</role-name>
 |  </security-role>
 |

And according to the Seam doc I set the jaas-config-name property in the
components.xml file:

 | <security:identity authenticate-method="#{authenticator.authenticate}"
 |                jaas-config-name="testdbRealm"/>
 |


Now I have the following behavior:
The application deploys and works, the *.xhtml pages are displayed but
application is not asking for authorization. The database connection is set
with the default user and pwd provided in the login-config.xml file (dumy, dumy
_pwd).

When I try to remove the default user and pwd from the login-config.xml file:

 | <application-policy name = "testdbRealm">
 |     <authentication>
 |       <login-module code = "org.jboss.resource.security
.CallerIdentityLoginModule" flag = "required">
 |          <module-option name = "managedConnectionFactoryName">jboss.jca
:service=LocalTxCM,name=dbtestDatasource</module-option>
 |       </login-module>
 |    </authentication>
 | </application-policy>
 |

then I have errors during deployment because the database connection can't be
created (I'm not sure why - think that hibernate try to open the database
during the deployment to do its mapping job). I see in server logs that
CallerIdentityLoginModule is used.

I stick on this problem and don't know how finish seting up things to enforce
the behavior I write about on the beginning. Do I have to call
CallerIdentityLoginModule directly from my application?

I'm trying to resolve this issue for quite a long time. I'm not the JBoss and
J2EE specialist (yet) (I'm the one who believed that building application's
with JBoss + Seam combo is simple and trying to follow) so I appreciate any
help and explanations how this mechanism works very much.

Best Regards


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic
&p=4063654#4063654

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode
=reply&p=4063654
__ ____ ____ ____ ____ ____ ____ ____ ____ ____
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user

©2008 junlu.com - Jax Systems, LLC, U.S.A.