geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juergen Weber <webe...@gmail.com>
Subject Re: NPE in ContextManager.getCurrentContext
Date Tue, 28 Jul 2009 11:02:15 GMT

Hi,

I found that if the code between pushNextCaller and popCallers still runs
with the previous Subject, i.e.

// point A 
Callers oldCallers = ContextManager.pushNextCaller(subject);
// point B
System.out.println("getCurrentCaller(): " +
ContextManager.getCurrentCaller());
System.out.println("Subject.getSubject: " +
Subject.getSubject(ContextManager.getCurrentContext()));
ContextManager.popCallers(oldCallers);

the println() outputs at B give the same Subject as at A, the pushed subject
is not active until the next called ejb. Being used to the doas() semantics
this is kind of surprising...

Would it be possible to change the behaviour to get the new Subject
immediately active?

Thanks,
Juergen


Juergen Weber wrote:
> 
> 
> djencks wrote:
>> 
>> 
>> Geronimo uses the AccessControlContext for the Subject to evaluate  
>> security decisions.  So, you need to get Geronimo to compute and store  
>> this ACC for you.
>> [..]
>> 
> 
> Well, the methodname pushNextCaller suggests that it would do that.
> Anyway, with the code below it works now. 
> 
> This code should be in Geronimo itself, I created GERONIMO-4765.
> 
> Thanks,
> J├╝rgen
> 
> 
> 
> SimpleCallbackHandler handler = new SimpleCallbackHandler(
> 		user, password.toCharArray());
> 
> LoginContext lc = new LoginContext("geronimo-admin", handler);
> lc.login();
> 
> Subject subject = lc.getSubject();
> System.out.println("lc.getSubject: " + subject);
> 
> 
> ContextManager.registerSubject(subject);
> Callers oldCallers = ContextManager.pushNextCaller(subject);
> try
> {
> 	s1 = secured3Bean.secureMethod(input);
> }
> finally
> {
> 	ContextManager.popCallers(oldCallers);
> }
> 
> 

-- 
View this message in context: http://www.nabble.com/NPE-in-ContextManager.getCurrentContext-tp24645453s134p24697077.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Mime
View raw message