Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Report post to moderator
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!
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator

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
 
Juan Manuel Diaz
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator

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
Posts: 55
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 55
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 55
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Report post to moderator

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
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
Daniel, this older thread has already been answered. Please don't resurrect old threads.

Thanks and welcome to JavaRanch.

Mark
 
    Bookmark Topic Watch Topic
  • New Topic