Login Form with Spring Security + JSF2.0 + Facelets + RichFaces
Juan Manuel Diaz
Ranch Hand
Joined: Mar 23, 2009
Posts: 53
posted
0
Hi fellows!! I am trying to create a login form for my webapp using richfaces in a facelets page, but i cant did it! If I use the auto-config <login-form /> in my security-context.xml, the ugly login form from spring is rendered and works fine, but I want my own login form! If someone can help it will be good for me!
Juan Manuel Diaz wrote:Hi fellows!! I am trying to create a login form for my webapp using richfaces in a facelets page, but i cant did it! If I use the auto-config <login-form /> in my security-context.xml, the ugly login form from spring is rendered and works fine, but I want my own login form! If someone can help it will be good for me!
Regards and thanks in advance!,
JM
PS.> Sorry for my child's english!
What does you security-context.xml look like when you point it to your custom login page? Does your login page have an action of "j_spring_security_check" and the user is "j_username" and password is "j_password"?
Juan Manuel Diaz wrote:At the moment, I am at work. When I came back to home I will post the security-context.xml, login.xhtml and faces-config.xml files!
Regards,
JM
Just the first two. If there is a problem in faces-config, I doubt the auto-login page would have worked.
Mark
Juan Manuel Diaz
Ranch Hand
Joined: Mar 23, 2009
Posts: 53
posted
0
Ok, here they are:
applicationcontext-security.xml
login.xhtml
I have a faces folder within the facelets that i want to securize. In the future i will have more roles and different folders for each role.
I am newbie in spring!
Regards,
JM
Juan Manuel Diaz
Ranch Hand
Joined: Mar 23, 2009
Posts: 53
posted
0
More info:
My idea is that the initial page is the login page, properly rendered with my app template.
Thanks,
JM
Juan Manuel Diaz
Ranch Hand
Joined: Mar 23, 2009
Posts: 53
posted
0
I made it works!
I understand that my login.xhtml page is just that... a login page. I was pointing to it in my welcome-file of the web.xml file... now I point to /faces/home.xhtml and everything looks works fine!
But I needed to use a <form> tag to the form... the effect of use this tag is a message telling:
Warning: This page calls for XML namespace declared with prefix form but no taglibrary exists for that namespace.
I supose that i need a loginBean to use a <h:form> tag and <h:commandButton> right?
Thanks,
JM
Daniel Yang
Greenhorn
Joined: Jun 04, 2012
Posts: 1
posted
0
Juan Manuel Diaz wrote:I made it works!
I understand that my login.xhtml page is just that... a login page. I was pointing to it in my welcome-file of the web.xml file... now I point to /faces/home.xhtml and everything looks works fine!
But I needed to use a <form> tag to the form... the effect of use this tag is a message telling:
Warning: This page calls for XML namespace declared with prefix form but no taglibrary exists for that namespace.
I supose that i need a loginBean to use a <h:form> tag and <h:commandButton> right?
Thanks,
JM
I think spring security just get parameters named j_username and j_password, so you should set prependId of <h:form> to false, then spring security can get them and process.