Question:
is there a way so that when I call ?getCallerPrincipal? I get back MyCustomPrincipal instead of SimplePrincipal when the call is made from a servlet to ejb using local interface
Steps that I took:
I?m trying to use a custom principal with HttpServlet that is calling a method on EJB using local interface
I have created my own custom server login module "MyServerLoginModule" that extends DatabaseServerLoginModule
In MyServerLoginModule I have overridden ?protected Principal createIdentity(String username)? method that now returns a custom Principal object, that object is being set to be referenced by Subject and when the credential cache is being updated (TimedCachedPolicy), and since that call is coming from a servlet that produces SimplePrincipal object in JBossSecurityMgrRealm class, I can see that the cache's key=SimplePrincipal and ?DomainInfo? has a subject that is referencing my custom Principal object created in MyServerLoginModule.
Problem:
In ejb when I call ?getCallerPrincipal? I get back ?SimplePrincipal? instead of custom principal, and when I follow the debug I can see that when the call is made from a servlet to an ejb it goes to ?SecurityInterceptor- invoke(Invocation mi)? and the invoke object is of course pointing to SimplePrincipal object and then when it gets inside of ?StatelessSessionEnterpriseContext-> setPrincipal(Principal principal)? it sets the principal to reference that SimplePrincipal object
Please help!