struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <lukaszlen...@apache.org>
Subject Re: How to pass the current logged in username to struts2 action from spring security 3
Date Wed, 20 Mar 2013 06:14:17 GMT
2013/3/20 Omar Ngarigari <ngarigarius@yahoo.com>:
> <s:textfield name="addCustomer.postUserId" value="%{springSecurity.currentUser}"/>

You cannot call interceptor directly, it must be an action.

>             while (((actionClass = actionClass.getSuperclass()) != null) &&
> (!isDone))
>             {
>                 for (Method method : actionClass.getDeclaredMethods())
>                 {
>                     if
> ((method.getAnnotation(SpringSecurityPrincipal.class) != null) &&
> ((currentUser.getPrincipal() instanceof User))) {
>                         method.invoke(action, new Object[] {
> currentUser.getPrincipal() });

This part is looking for a method annotated with the below
@SpringSecurityPrincipal and if it will find it, inject User object.

> public @interface SpringSecurityPrincipal

You must annotate action's method to allow inject User object


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message