[jboss-user] [JNDI/Naming/Network] - Re: look Database not effect (Urgent). Please!
changemylife
do-not-reply at jboss.com
Fri Feb 9 02:23:11 EST 2007
Hello world !
Today, I try all things again but I also failure.
When I install JBoss server, I selected mysql and DataSource name is: DefaultDS, and I created "mydatabase" that include Users and Roles. My code on the client have contents:
-----
LoginContext lc = new LoginContext("userTest", new MyCallbackHandler());
lc.login();
.....
props.put("java.naming.provider.url","jnp://violon:1099");
InitialContext ctx = new InitialContext(props);
Operates obj = (Operates)ctx.lookup("OperatesBean/remote");
...... and here, I do two methods that correlative each role
-----
But after I enter username and passwd, on the server don't check informations of the specify person that I entered (username and passwd). This is mean, the DatabaseServerLoginModule that I declare inside file "login-config.xml" not effect. And when, any informations that I enter can call two methods ! I am sure that JBoss server bound DataSource beacause when I run Server, I saw the fragment message:
-----
11:15:39,632 INFO [WrapperDataSourceService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS '
-----
My auth.config on the client has contents:
-----
userTest {
org.jboss.security.ClientLoginModule required;
};
-----
My ejb-jar.xml has contents:
-----
<enterprise-beans>
<ejb-name>Operates</ejb-name>
<resource-ref>
<res-ref-name>DefaultDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</enterprise-beans>
.....here, I declared roles and permissions
-----
My jboss.xml has:
-----
<security-domain>DB-Domain</security-domain>
<enterprise-beans>
<ejb-name>Operates</ejb-name>
<resource-ref>
<res-ref-name>DefaultDS</res-ref-name>
<jndi-name>java:/DefaultDS</jndi-name>
</resource-ref>
</enterprise-beans>
-----
And the login-config.xml:
-----
<application-policy name="DB-Domain">
<login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
<module-option name="dsJndiName">java:/DefaultDS</module-option>
<module-option name="principalsQuery">
select passwd from Users where username=?</module-option>
<module-option name="rolesQuery">
select Role, 'Roles' from Roles where username=?</module-option>
</login-module>
</application-policy>
-----
I don't know that why server not recognize all things that I declare inside jboss.xml and login-config.xml ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4013476#4013476
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4013476
More information about the jboss-user
mailing list