Hy guys,
i'm using for the first time jaas on JBoss so i wrote a simple program to test it.
I'm using a jsp to autenthicate myself to JBoss using DatabaseServerLoginModule on a Sybase Database.
My problem is, i never can authenticate,
it seems that Principal object when it is passed to jboss authentication process is always null,
but if change module login, for example UsersRolesLoginModule i success on it.


These are the files i'm using:

*web.xml
...*
...
...*
*    <!-- Define form login configuration -->
   <login-config>
       <auth-method>FORM</auth-method>
       <realm-name>WROX Bank Authentication</realm-name>
       <form-login-config>
           <form-login-page>/Login.jsp</form-login-page>
           <form-error-page>/LoginError.jsp</form-error-page>
       </form-login-config>
   </login-config>

*---------------------------------------------------------

jboss.xml
*
<jboss>
<session>
<resource-ref>
<res-ref-name>jdbc/DSTest</res-ref-name>
<jndi-name>java:/DSTest</jndi-name>
</resource-ref> <ejb-name>Account</ejb-name>
<jndi-name>ejb/Account</jndi-name>


       <method-attributes>
       </method-attributes>
     </session>
   <security-domain>java:/jaas/dbLogin</security-domain>
</jboss>
---------------------------------------------------

*jboss-web.xml
*
<jboss-web>
   <!-- Use the JAAS Database Security Module -->
   <security-domain>java:/jaas/dbLogin</security-domain>
</jboss-web>
--------------------------------------------------

*ejb-jar.xml
...
...
...
*    <!-- JDBC DataSources (java:comp/env/jdbc) -->
   <resource-ref>
       <description>The default DS</description>
       <res-ref-name>jdbc/DSTest</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
   </resource-ref>


-----------------------------------------------


*login-config.xml

*<policy>
<!-- Used by clients within the application server VM such as
mbeans and servlets that access EJBs.
-->
<application-policy name = "dbLogin">
<authentication>
<login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
<module-option name="dsJndiName">java:/DSTest</module-option>
<module-option name = "principalsQuery">select Password from Principals where PrincipalID=?</module-option>
<module-option name = "rolesQuery">select Role_db,RoleGroup from Roles where PrincipalID=?</module-option>
</login-module>
</authentication>
</application-policy>


-------------------------------------------
these are my tables on Sybase DB:
( Role is a keyword on Sybase so i modify the default table )

create table dbo.Principals
(
PrincipalID varchar(64) not null ,
Password varchar(64) not null, Constraint Principals primary key nonclustered ( PrincipalID ) )


drop table Roles
go
create table dbo.Roles
(
PrincipalID varchar(64) not null ,
Role_db varchar(64) not null, RoleGroup varchar(64) not null, )


-----------------------------------------
and this is my ds file

<datasources>
 <local-tx-datasource>              
<connection-url>jdbc:oracle:thin:@192.168.22.80:1521:BARBEPER</connection-url>
   <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
   <user-name>barbe</user-name>
   <password>barbe</password>

     <min-pool-size>5</min-pool-size>
     <max-pool-size>20</max-pool-size>
     <idle-timeout-minutes>0</idle-timeout-minutes>
     <track-statements>true</track-statements>
     <security-domain>dbLogin</security-domain>
 </local-tx-datasource>
</datasources>





thanks for all


--
-----------------------------
Andrea Alimonti
Notio Srl
-----------------------------






-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to