aspose file tools*
The moose likes Spring and the fly likes Login Form with Spring Security + JSF2.0 + Facelets + RichFaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Reply locked New topic
Author

Login Form with Spring Security + JSF2.0 + Facelets + RichFaces

Juan Manuel Diaz
Ranch Hand

Joined: Mar 23, 2009
Posts: 53
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!
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

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"?

Thanks

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Juan Manuel Diaz
Ranch Hand

Joined: Mar 23, 2009
Posts: 53
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
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

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
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
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
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
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.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Daniel, this older thread has already been answered. Please don't resurrect old threads.

Thanks and welcome to JavaRanch.

Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Login Form with Spring Security + JSF2.0 + Facelets + RichFaces