[jboss-user] [Security & JAAS/JBoss] - Re: Latest JAAS Tutorial for Database communication

changemylife do-not-reply at jboss.com
Thu Mar 1 23:08:53 EST 2007


Hi all!
   Today, all things are ok (they worked!). My project is EJB3.0. Inside folder \server\default\conf, I add some informations:
<application-policy name = "DB-Domain">
  |        <authentication>
  |           <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule"
  |              flag = "required">
  |              <module-option name = "unauthenticatedIdentity">guest</module-option>
  |              <module-option name = "dsJndiName">java:/DefaultDS</module-option>
  |              <module-option name = "principalsQuery">SELECT PASSWD FROM USERS WHERE USERID=?</module-option>
  |              <module-option name = "rolesQuery">SELECT ROLEID, 'Roles' FROM ROLES WHERE USERID=?</module-option>
  |           </login-module>
  |        </authentication>
  |     </application-policy>
   My jboss.xml :
<jboss>
  | 	<security-domain>DB-Domain</security-domain>
  | 	<enterprise-beans>
  |         <session>
  |             <ejb-name>ClientActionBean</ejb-name>
  |             <resource-ref>
  |             	<res-ref-name>jdbc/DefaultDS</res-ref-name>
  | 		<jndi-name>java:/DefaultDS</jndi-name>
  |             </resource-ref>
  |         </session>
  |     </enterprise-beans>
  | </jboss>
   and ejb-jar.xml:
<enterprise-beans>
  | 	<session>
  | 		<ejb-name>ClientActionBean</ejb-name>
  | 			<resource-ref>
  | 				<res-ref-name>jdbc/DefaultDS</res-ref-name>
  | 				<res-type>javax.sql.DataSource</res-type>
  |             	            	<res-auth>Container</res-auth>
  |             	         </resource-ref>
  | 	</session>
  | </enterprise-beans>
  |  <assembly-descriptor>
  | 	<Security-role>
  | 		<role-name>doctor</role-name>
  |    	</Security-role>
  |    	<Security-role>
  |    		<role-name>nurse</role-name>
  |    	</Security-role>
  |    	<method-permission>
  |    		<role-name>doctor</role-name>
  |    		<method>
  |    			<ejb-name>ClientActionBean</ejb-name>
  |    			<method-name>getCallInfo</method-name>
  |    		</method>
  | ....
   I use Eclipse to write client app, bean and package my bean enclose two file jboss.xml and ejb-jar.xml (inside META-INF). Restart server, and run client app!
   Note: I installed Jboss server and mySQL on the machine 1(hostname:abc), and on the machine 2 (hostname:xxx). All things ok!
   Hope this helps!!!!

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024535



More information about the jboss-user mailing list