users@glassfish.java.net

Re: Retrieving "logged in" username inside a session bean

From: <glassfish_at_javadesktop.org>
Date: Wed, 28 Jan 2009 13:16:48 PST

What I am trying to accomplish is to have a stand alone client log into the server, look up a session bean, and then inside the session bean get the username. I placed your code inside my bean. I compiled and redeployed. In my client, I successfully look up the bean and called your method.

After activating Security Manager, I received an access denied (javax.security.auth.AuthPermission getSubject) exception. So, I added

grant {
   permission javax.security.auth.AuthPermission "getSubject";
};

to my server policy, restarted the server and tried again. This time the getSubject call returned a subject. The following call to GetPrivateCredentials() returned a 0-length Set.

I have never attempted to use JAAS and have no idea how to proceed. Can you point me to a good resource? If you have some sample code that implements what I am trying to do, would you please email it to me: janchj_at_gmail.com

Thanks for all your help!
[Message sent by forum member 'janchj' (janchj)]

http://forums.java.net/jive/thread.jspa?messageID=328781