On Mon, Nov 21, 2011 at 4:44 AM, Jens Reufsteck < [email protected]> wrote:
> Hi, sorry if this has been asked before, though I couldn’t find anything > about it.**** > > I’ve just started to use Tapestry security instead of our own light weigth > authentication system. Works fine so far – thanks to the developers!**** > > Now, I want to display the real name for logged in users. It’s not the > same as their login or username, so I can’t get it with > securityService.getSubject().getPrincipal().**** > > I’d expect to store it in the session – and I’m wondering, how to > accomplish this during authentication.**** > > As recommended, I’m contributing an implementation of a realm. Probably, I > could inject the Session into the realm, store the user name into the > session and hope, that getSubject().getSession() will afterwards retrieve > exactly this session. Isn’t there a more elegant solution? > There's no reason to strongly tie this to your security logic. You should use an ApplicationStateObject for session-bound user data. Often, I have a lightweight CurrentUser ApplicationStateObject for authenticated (or remembered) users that holds the user's name among other things. For example, you could have a custom ApplicationStateCreator to create a CurrentUser on the fly and inject a UserService into it to populate your CurrentUser with the required data. Kalle ** ** > > We’re using Tapestry 5.1.0.5 with Tapestry security 0.2.2.**** > > ** ** > > Many thanks**** > > Jens**** > > ** ** > > -- > Jens Reufsteck > Marketing & Online Director **** > > Staufenbiel Institut GmbH > Events & Recruiting Solutions > > Wildunger Straße 6, 60487 Frankfurt am Main > www.staufenbiel.de www.mba-master.de www.absolventenkongress.de > > Tel.: +49 (0)69 25537-140 > Mobil: +49 (0)151 40262450 > Fax: +49 (0)69 25537-2140 > > *Nur noch wenige Plätze auf dem Absolventenkongress am 30.11./01.12. in > Köln – Jetzt schnell > buchen!<http://www.staufenbiel.de/service/fuer-arbeitgeber/events-recruiting-solutions.html#c1021> > * > > [image: Staufenbiel GmbH] > > Geschäftsführer: Judith Oppitz, Birgit Giesen, Graham Storey, Martin > Halliday > Amtsgericht Köln HRB 9301 > > Internet communications are not secure and therefore Staufenbiel Institut > GmbH does not accept legal responsibility > for the contents of this message. Any views or opinions presented are > solely those of the author and do not > necessarily represent those of Staufenbiel Institut GmbH unless otherwise > specifically stated. **** >
