You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Oleg Nitz <on...@ibis.ua> on 2007/08/03 14:24:42 UTC

How to get the active Subject?

Hello all,

Now I am migrating our system from JBoss to Geronimo, and I met the
following problem. During login we attach some tecnical info about
the current user to the Subject as a public credintial. Then at any
point inside EJB we need to be able to find the active Subject in order
to get the tech info. In JBoss the following code does the trick:

ic = new InitialContext();
jsm = (JaasSecurityManager) ic.lookup("java:/jaas/our-security-domain");
subject = jsm.getActiveSubject();

Is such thing possible in Geronimo? What the correspondent code for 
Geronimo would look like?

Thanks in advance,
Oleg



Re: How to get the active Subject?

Posted by David Jencks <da...@yahoo.com>.
On Aug 3, 2007, at 5:24 AM, Oleg Nitz wrote:

> Hello all,
>
> Now I am migrating our system from JBoss to Geronimo, and I met the
> following problem. During login we attach some tecnical info about
> the current user to the Subject as a public credintial. Then at any
> point inside EJB we need to be able to find the active Subject in  
> order
> to get the tech info. In JBoss the following code does the trick:
>
> ic = new InitialContext();
> jsm = (JaasSecurityManager) ic.lookup("java:/jaas/our-security- 
> domain");
> subject = jsm.getActiveSubject();
>
> Is such thing possible in Geronimo? What the correspondent code for  
> Geronimo would look like?

org.apache.geronimo.security.ContextManager.getCurrentSubject() gets  
the current subject
org.apache.geronimo.security.ContextManager.getNextSubject() gets the  
run-as subject

hope this helps
david jencks

>
> Thanks in advance,
> Oleg
>
>