You have to provide the login-processing-url to your template file. Look into nu.localhost.tapestry5.springsecuritytest.pages.LoginPage and the respective LoginPage.tml in the webapp of the sample. It's artefact is

<dependency>
 <groupId>nu.localhost.tapestry5.springsecurity</groupId>
 <artifactId>tapestry-spring-security-sample</artifactId>
 <version>1.0.0-SNAPSHOT</version>
</dependency>

There will be a final 1.0.0 later this day since Howard announced the final 5.0 for T5.

Further you could also use Tapestry Spring Security and exclude the dependency for Spring 2.0 in your pom and include your 2.5 Spring dependencies instead. Visit [1] for an idea about it or read the excellent free book "Better builds with Maven" [2].

Michael

[1] http://maven.apache.org/pom.html#Exclusions
[2] http://www.exist.com/better-build-maven

Jean Luc schrieb:
Hello,

I've been trying to integrate T5 and Spring Security (2.0.4, not the older
Acegi) but haven't succeeded in making the two work together.

The standard way to specify a form login with Spring 2.5 is like below. See
the <form-login> element which specified the login page (Login) and what URL
Spring will intercept (the standard j_security_check).

<b:beans xmlns="http://www.springframework.org/schema/security";
    <http>
        <form-login login-page="/Login"
                    default-target-url="/Start"
                    authentication-failure-url="/Login?login_error=1"
                    login-processing-url="j_security_check" />
    </http>

I have a typical Login.tml (labels and cosmetic stuff removed for brevity)

<t:form t:id="loginForm">
    <table><tr><td><input type="text" t:id="j_username" t:type="TextField"
t:value="j_username"/></td></tr>
        <tr><td><input type="text" t:id="j_password" t:type="PasswordField"
t:value="j_password"/></td></tr>
        <tr><input type="submit" value="Log In"/></td> </tr>
    </table>
</t:form>

What happens is that the POST that occurs when submitting the form goes to
the Login.onSubmit() instead of j_security_check. While it is possible to
add code there to call Spring's AuthenticationManager, I would end up
duplicating what Spring Security does (the logic to redirect to different
pages if the login succeeded or not and so on). I'd like to use Spring since
it already implements this.

Is it possible to submit the login info to j_security_check instead? Or to
forward the request from within Login.onSubmit() to /j_security_check?

I went through the "Tapestry 5" book by Alexander Kolesnikov, but didn't
find this info. Also, I am aware of the tapestry5-acegi extension (
http://www.localhost.nu/java/tapestry5-acegi/) but this one seems under
development and for such a simple thing I didn't want to add a dependency on
another jar.

As you can tell, I'm new to T5. I've had some exposure to T4 and an older
version of Spring (2.0) but there things were quite different, both in
Tapestry itself and in how Acegi is configured  in Spring.

Advice is appreciated,
JL



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to