Hi guys

I was able to solve the issue myself, yay!
For those interested, here is the simple solution:

By reading the source code of t-s-s I discovered that the
UsernamePasswordAuthenticationFilter saves the username into the session.

void onActivate(String extra) {
        if (extra.equals("failed")) {
            failed = true;
        }

        Session session = request.getSession(false);
        if( session != null) {
            Object usrnameObj =
session.getAttribute(UsernamePasswordAuthenticationFilter.SPRING_SECURITY_LAST_USERNAME_KEY);
            username = (usrnameObj != null) ? usrnameObj.toString() : null;
        }
}


Cheers
Beat



2012/2/2 Beat Durrer <bdur...@gmail.com>

> Hi there,
>
> I added tapestry-spring-security 3.0.3 to the T5.3 archetype, following
> the sample app under
> http://www.localhost.nu/java/tapestry-spring-security/conf.html
> Everything works fine.
>
> How can I retrieve the username when a user fails to log in (to put it
> into the input field again)?
> The tapestry-spring-security handler does not bother to include the
> username when redirecting to a login failed URL (which I defined to be the
> Login page).
>
> Can I somehow elegantly intercept a form before forwarding all data to the
> j_spring_security_check?
> I considered a tapestry form and a onSuccess handler, but then I would
> need to forge a request including all the form fields (which just isn't
> really cool).
>
> Any suggestions, please? :)
>
> Thanks in advance!
> Beat
>

Reply via email to