Hi, Take a look at the Login page in tapestry5-appfuse project here:
http://code.google.com/p/tapestry5-appfuse There is an example of direct integration between T5 and Spring Security 2. /Serge Jean Luc wrote: > > Update: I can get the response with: > > @Inject > private RequestGlobals requestGlobals; > > and using requestGlobals.getHTTPServletResponse(); > > I'll need to change the redirect into a forward (to save a trip and to > prevent the username/pwd appear in the URL) but that's standard > servlet stuff. > > Thanks. > > On Sun, Dec 14, 2008 at 8:05 PM, Jean Luc <jeanluc2...@gmail.com> wrote: >> Thanks Hugo, >> >> I've [tried to] inject the request and the response as mentioned (for >> the request) at: >> http://wiki.apache.org/tapestry/Tapestry5ObtainingHttpServletRequest >> >> @Inject >> private HttpServletRequest request; >> >> @Inject >> private HttpServletResponse response; >> >> It works for the request, but not for the response (exception below). >> I've googled for ways to inject the response (I thought it would be >> similar) but no luck. >> >> exception >> org.apache.tapestry5.internal.services.TransformationException: >> Error obtaining injected value for field >> com.foo.tapestry.pages.Login.response: No service implements the >> interface javax.servlet.http.HttpServletResponse. >> >> # org.apache.tapestry5.internal.services.TransformationException >> Error obtaining injected value for field >> com.foo.tapestry.pages.Login.response: No service implements the >> interface javax.servlet.http.HttpServletResponse. >> >> >> In case it matters, I'm using T 5.0.18 and JBoss 4.2.2GA >> Thanks in advance, >> JL >> >> On Sun, Dec 14, 2008 at 7:44 PM, Hugo Palma <hugo.m.pa...@gmail.com> >> wrote: >>> In your page class inject the check url like this: >>> >>> @Inject >>> @Value("${spring-security.check.url}") >>> private String checkUrl; >>> >>> then on your onSuccessMethod: >>> >>> response.sendRedirect(request.getContextPath() + checkUrl + >>> "?j_username=" + >>> username + "&j_password=" + password); >>> >>> where username and password are the bound variables for your username >>> and >>> password text fields on the form. >>> >>> Jean Luc wrote: >>>> >>>> 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: users-unsubscr...@tapestry.apache.org >>> For additional commands, e-mail: users-h...@tapestry.apache.org >>> >>> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > -- View this message in context: http://www.nabble.com/integrating-T5-a-login-form-with-Spring-Security--tp21006586p21012513.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org