Extending SecurityValveImpl in order to update the session Subject from UserManager

robotdan <[email protected]> Tue, 11 Sep 2012 17:08:28 -0500
Newsgroups gmane.comp.jakarta.jetspeed.user
Message-ID <CADz2YaegH-_=NqZNbFUn7D1Tzca9e9c-fJvGRt=TtQz88UoHLg@mail.gmail.com>
I'm using Jetspeed 2.2.0.
In our application, we allow an administrative user to add a user to a
group while the target user is logged in.

In this scenario, the Subject held in the session and the RequestContext
will not contain the new group principal object.
Looking at SecurityValveImpl.getSubject(RequestContext request), it looks
to be working as designed.

I've written a service to extend SecurityValveImpl in order to allow the
Subject held in the session and the RequestContext to be updated when we
mark a specific user to have invalid principals.
Essentially what I'm doing is removing the Subject reference from the
session, and then returning null from resolveSubjectFromContext in order to
cause getSubject to call UserManager.getSubject and update it's reference.

This seems to work just fine, I'm curious if anyone sees any potential
problems with doing this type of thing, am I bending the rules?
Daniel