EJB-local lookup with user authentication
Hello!We are migrating from JBoss 5 to JBoss 6.
We got a MDB that call's a EJB.
But in the EJB we check that the user got some roles.
In Jboss 5 we did
private InitialContext getInitialContext(final String pProviderUrl, final String pPrinciple, final String pCredentials) throws NamingException {
final Properties properties = new Properties();
properties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
properties.put(Context.PROVIDER_URL, pProviderUrl);
if(pPrinciple != null && pCredentials != null) {
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.JndiLoginInitialContextFactory");
properties.put(Context.SECURITY_PRINCIPAL, pPrinciple);
properties.put(Context.SECURITY_CREDENTIALS, pCredentials);
}
else {
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
}
return new InitialContext(properties);
}
...then to roles was present.
But In Jboss 6 I can not find out how to do the same.
I found this clue:
https://developer.jboss.org/thread/202291
...but when I get to:
SecurityContextAssociation.setPrincipal and SecurityContextAssociation.setCredential
...the compiler says that the method is undefind:
The method setCredential(String) is undefined for the type SecurityContextAssociation
Do you guys got any idea how to solve this in Jboss 6?
Best regards
Fredrik