File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Form Based Authentication is not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Form Based Authentication is not working" Watch "Form Based Authentication is not working" New topic
Author

Form Based Authentication is not working

Krutika Ravi
Greenhorn

Joined: Feb 11, 2010
Posts: 23
Hi,

I have been working on Security Chapter and I have implemented the following code. Unable to identify the point of error. Kindly help.

Deployment Descriptor:


tomcat-users.xml


login.jsp
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1660
    
  25

Hi Krutika Ravi,

try removing the <user-data-constraint> and see what happens

Regards,
Frits
Krutika Ravi
Greenhorn

Joined: Feb 11, 2010
Posts: 23
Hi Fritz,

That doesn't help.

Correction:
In the above web.xml. Remove
<http-method><http-method>

Don't know where I am losing track.

Kind Regards
Krutika
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1660
    
  25

Hi Krutika,

In the above web.xml. Remove <http-method><http-method>
Ok, but you can do that still on your posting, just hit the edit button on right top of your posting. That makes this thread also easier to read.

What is exactly the problem? Do you get to the login page? Or can't you go beyond it? Do you get an error?

I guess that your are using j_username, j_password, and j_security_check ? ( with underscores, they might not show well on this page )

Regards,
Frits
Krutika Ravi
Greenhorn

Joined: Feb 11, 2010
Posts: 23
Hi Frits,

I do get the Edit Option on the Comments I am posting now. But for the first Post I get to see only the Quote Button.

Problems which I face:
a) I try opening a page and ideally I should be directed to the Form but that ain't happening.
b) I tried using BASIC Authentication and I don't get a prompt either.
c) I downloaded a brand new Tomcat container and my code still fails to give me a prompt.

Thanks
Kind Regards
Krutika
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1660
    
  25

try removing the security from your web-application and see if you can get to the login.jsp without any problems.

If not, then the URL you are using is not good or the structure of your .war file is not good.

Regards,
Frits
jalil idrissi
Greenhorn

Joined: Feb 05, 2013
Posts: 6
<form-login-page>/login</form-login-page>

I believe, in <form-login-page>, you can't use a url pattern. Instead you should use the actual relative url /login.jsp


OCEJWCD 6
OCPJP 7
Fabian Angy
Ranch Hand

Joined: Oct 27, 2008
Posts: 90
<servlet-constraint> ??? It must be <security-constraint> no ?


SCJP 5
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1660
    
  25

Hi All,

@Angy:
<servlet-constraint> ??? It must be <security-constraint> no ?

Yes, that is definitely a mistake.

@Jalil Idrissi:
I believe, in <form-login-page>, you can't use a url pattern. Instead you should use the actual relative url /login.jsp

No, that is not needed.

Just have a look at the following web.xml and try it yourself (it works well)

Regards,
Frits
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Form Based Authentication is not working