[jboss-user] [Security] - A lot off @SecurityDomain annotations...

mbartyzel do-not-reply at jboss.com
Sat Sep 19 04:37:17 EDT 2009


Hi,

I wanna to configure security for my ejb and I have some problems :)
I use Eclipse Galileo for JEE Developers + JBoss 5.0.1.GA

1. There are tree @SecurityDomain annotations:
@org.jboss.ejb3.annotation.SecurityDomain
@org.jboss.aspects.security.SecurityDomain
@org.jboss.security.annotation.SecurityDomain

Which of them I should use? Only @org.jboss.ejb3.annotation.SecurityDomain forces applying security because I have EJBAccessException, but...

Below my steps with configuring security
1. Define domain in /server/default/conf/login-config.xml
 <application-policy name="Sandbox">
  	
  		<login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
  			<module-option name="usersProperties">users.properties</module-option>
  			<module-option name="rolesProperties">roles.properties</module-option>
  		</login-module>
  	
  </application-policy>

2. Then I put properties to source folder of EJB project
user.properties
guest=pass
admin=admin

roles.properties
guest=LOGGED
admin=SUPER,LOGGED

3. I added security domain to my ejb
import @org.jboss.ejb3.annotation.SecurityDomain;

@Stateless(name="Service")
@SecurityDomain("Sandbox",)
@PermitAll
public class ServiceBean implements ServiceRemote {
 public String getDescription() {...}
 ...
}

4. And now we have client code:
		Properties prop = new Properties();
		prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.JndiLoginInitialContextFactory");
		prop.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
		prop.put(Context.PROVIDER_URL, "jnp://localhost:1099");
		prop.put(Context.SECURITY_PRINCIPAL, "guest");
		prop.put(Context.SECURITY_CREDENTIALS, "pass");
	
		InitialContext ctx = new InitialContext(prop);

                //obtaining remote reference goes here... 
		
		System.out.println( service.getDescription() );

And, every time EJBAccessException is being throwed.

Anyone knows what i did wrong?

Thanks for help


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

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



More information about the jboss-user mailing list