Can I port Glassfish jdbcRealm to JBoss?
My appli开发者_C百科cation is running on Glassfish 3.1 using jdbcRealm is its authentication and authorization. I want to port this app to JBoss 6. Can I create a jdbcRealm inside JBoss 6 like in Glassfish3 that map to a USER table in my database? Can I do it via admin-console? In JBoss, I figure out how to create database connection (just by create datasource), but in Glassfish I also set up JavaMail Sessions in Glassfish with jndi
, mail-host
, transport protocol
..., can I port that over to JBoss as well?
Answers on your questions:
Can I create a jdbcRealm inside JBoss 6 like in Glassfish3 that map to a USER table in my database?
If I understand correctly you use database to authenticate users?
You can define something like that in JBoss. The easiest way is to add proper security domain definition to the conf/login-config.xml
file.
It can looks like that:
<application-policy name="database-domain">
<authentication>
<login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
<module-option name="dsJndiName">java:/yourDataSource</module-option>
<module-option name="principalsQuery">select password from users where userid = ?</module-option>
<module-option name="rolesQuery">select role, 'Roles' from roles where userid = ?</module-option>
</login-module>
</authentication>
</application-policy>
You should also create proper data source and put database library to the lib
directory.
Can I do it via admin-console?
I do not know if it is possible to make these changes using web console.
In JBoss, I figure out how to create database connection (just by create datasource), but in Glassfish I also set up JavaMail Sessions in Glassfish with jndi, mail-host, transport protocol..., can I port that over to JBoss as well?
JBoss use default database to store some information. If you want to change that the simples way is to define new data source with the DefaultDS
name and delete the deploy/hsqldb-ds.xml
file.
In JBoss 6 they change JMS provider and it also use its own DB to stre some info, bu I don't know if and how to change it.
精彩评论