Hi,
I would like to ask a question about the stated topic.
My case is like that:
The SimplePrincipal originally shipped with JBoss is not enough to me, it contains only
name, but I would like to add some more variables. Thus, I made my own MyPrincipal
implementing java.security.Principal.
anonymous wrote :
| public class MyPrincipal implements Principal, Serializable {
| ...
| }
|
Moreover, I have made a new MyLoginModule extending DatabaseServerLoginModule, this class
overrides the createIdentity() method so that the Principal instance created must be of
the class MyPrincipal.
anonymous wrote :
| public class MyLoginModule extends DatabaseServerLoginModule {
| ...
| protected Principal createIdentity(String username) throws Exception {
| MyPrincipal p = null;
| if (principalClassName == null)
| p = new MyPrincipal(username);
| } else
| p = (MyPrincipal) super.createIdentity(username);
| return p;
| }
| }
|
These classes run successfully, and I did check the Principal created after the login()
method is an instance of MyPrincipal.
Now, is the problem. Am I able to get this Principal in a Session Bean?
Before I made the new Principal and LoginModule, I can get the Principal instance through
its interface using the sessionContext.getCallerPrincipal() method. I checked the instance
I got and it is of the default class type - SimplePrincipal.
However, after I used the the new one - MyPrincipal, the result shows me the
sessionContext.getCallerPrincipal() method also returns an instance of SimplePrincipal. Is
this method points to the same Principal instance as the one I got in login()?
If not, is there any method for me to get the instance created in login()?
Thanks for your kindness and sincere help.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965190#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...