Thank you very much for your reply, it send me in the right direction. Instead of using a servlet filter or 'getSessionContext().getCallerPrincipal();' in the session beans, I implemented a jboss interceptor that intercepts every invocation to session beans and puts the principal on the principalholder this works very well. The code looks like this:
Code:
package com.wijlens;
import java.security.Principal;
public class PrincipalHolder {
private static ThreadLocal principal = new ThreadLocal();
public static Principal getPrincipal() {
return (Principal)principal.get();
}
public static void setPrincipal(Principal principal) {
if(principal != null)
PrincipalHolder.principal.set(principal);
}
}
and:
Code:
package com.wijlens;
import org.jboss.ejb.plugins.AbstractInterceptor;
import org.jboss.invocation.Invocation;
public class PrincipalStorageInterceptor extends AbstractInterceptor {
public Object invoke(Invocation invocation) throws Exception {
PrincipalHolder.setPrincipal(invocation.getPrincipal());
return super.invoke(invocation);
}
}
Joris Wijlens