Re: injecting the currently logged in user

2012-11-05 Thread Ulrich Stärk
I played around with a few of the options I outlined and in the end chose the FieldConduit approach that Lenny suggested. The base is a service called CurrentUserSource which has a single method getUser() that does if(!securityService.isAuthenticated()) return null; Long id = (Long) securit

Re: injecting the currently logged in user

2012-11-01 Thread Alex Kotchnev
Ulrich - I'll be curious to see what you come up with. I also use Shiro and have the user stored in the database, and have been thinking that I need to have a better way of having access to the current user (e.g. using some annotation). I'm not entirely sure how this FieldConduit would work (what L

Re: injecting the currently logged in user

2012-10-31 Thread Ulrich Stärk
On 31.10.2012 17:28, Lenny Primak wrote: > The Principal is already saved by Shiro in the HttpSession, Exactly what I said. > why just not use a custom annotation with a FieldConduit > that just gets it from Tynamo-security SecurityService? Because I haven't thought of that yet, thanks for the s

Re: injecting the currently logged in user

2012-10-31 Thread Lenny Primak
The Principal is already saved by Shiro in the HttpSession, why just not use a custom annotation with a FieldConduit that just gets it from Tynamo-security SecurityService? On Oct 30, 2012, at 3:44 PM, Ulrich Stärk wrote: > From a third-party module (tynamo-security) I have the id (principal) of

Re: injecting the currently logged in user

2012-10-31 Thread Ulrich Stärk
On 31.10.2012 13:05, devnull2...@gmx.de wrote: >> The goal is to just @Inject User currentUser; or @SessionState User >> currentUser; or @Persist User >> currentUser; in a page or service and have acces to the user as denoted by >> the principal stored in >> the http session. Which option would you

Re: injecting the currently logged in user

2012-10-31 Thread devnull2000
> The goal is to just @Inject User currentUser; or @SessionState User > currentUser; or @Persist User > currentUser; in a page or service and have acces to the user as denoted by > the principal stored in > the http session. Which option would you chose? Are there others, maybe > more straightforwa

Re: injecting the currently logged in user

2012-10-31 Thread Ulrich Stärk
On 30.10.2012 21:11, Ulrich Stärk wrote: > On 30.10.2012 21:05, Thiago H de Paula Figueiredo wrote: >> On Tue, 30 Oct 2012 17:44:29 -0200, Ulrich Stärk wrote: >> >>> 2. Create a UserSource service that looks up the User instance, build a >>> PropertyShadowBuilder >>> around it and bind it to the

Re: injecting the currently logged in user

2012-10-30 Thread Ulrich Stärk
On 30.10.2012 21:05, Thiago H de Paula Figueiredo wrote: > On Tue, 30 Oct 2012 17:44:29 -0200, Ulrich Stärk wrote: > >> 2. Create a UserSource service that looks up the User instance, build a >> PropertyShadowBuilder >> around it and bind it to the interface of the User class. Downside: requires

Re: injecting the currently logged in user

2012-10-30 Thread Thiago H de Paula Figueiredo
On Tue, 30 Oct 2012 17:44:29 -0200, Ulrich Stärk wrote: 2. Create a UserSource service that looks up the User instance, build a PropertyShadowBuilder around it and bind it to the interface of the User class. Downside: requires the User entity to have an interface. Why don't you implement a

injecting the currently logged in user

2012-10-30 Thread Ulrich Stärk
>From a third-party module (tynamo-security) I have the id (principal) of a >Hibernate entity representing the currently logged in user in the HttpSession. I now want to inject that user into pages after loading it from persistent storage. The entity class shall be called User. Three options co