A few more tests and, not surprisingly, I got no further: @Pointcut("execution(public static * business.security.service.LoginManagerHelper.authenticateUser(..)) && args( username, ..)") public void authenticateUser(String username){}
@Pointcut("execution(public static * webapp.util.LoginManagerAction.loginJAAS(..)) && args( *, *, username, ..)" ) public void loginJAAS(String username) {} @Before("authenticateUser(username) || loginJAAS(username)" ) public void setUsername(JoinPoint jp, String username) { // inject the username into the MDC MDCUtils.setUsername(username); } Not surprisingly, this produces the exact same results. Is this a bug, or just me doing this incorrectly? Thanks, Eric On Tue, Dec 13, 2016 at 3:25 PM, Eric B <ebenza...@gmail.com> wrote: > Hi, > > I just posted this on StackOverflow, but then realized I might have better > success asking a specific question like this here: > > I've got an pointcut that I am trying to use with LTW. I have 2 methods > that I am trying to advise, each with a different parameter list. However, > they both have a single common parameter that I want. > > These are the method signatures I want to advise: > > public static WorkflowModifierFlags authenticateUser(String > username, String password, String ip, boolean webGUI, boolean > realAuthentication) > > public static boolean loginJAAS(HttpServletRequest request, > HttpServletResponse response, String username, String password, HttpSession > session) > > > I've tried the following pointcut/advice, but it is failing; the username > variable is sometimes getting injected with the IP address (ie: the args() > from the first pointcut). > > @Before("(execution(public static * business.security.service. > LoginManagerHelper.authenticateUser(..)) && args( username, ..)) || " > + "(execution(public static * webapp.util. > LoginManagerAction.loginJAAS(..)) && args( *, *, username, ..))" ) > public void setUsername(JoinPoint jp, String username) { > // inject the username into the MDC > MDCUtils.setUsername(username); > } > > > I would have expected that the `args()` parameter is associated to the > execution() method, but sometimes it would appear that it is "confused", > and gives me the IP instead of the username. > > Am I using AspectJ incorrectly, or is this a bug in the LTW? I'm running > AspectJ 1.6.13. > > Thanks, > > Eric > >
_______________________________________________ aspectj-users mailing list aspectj-users@eclipse.org To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/aspectj-users