aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes web security not working as expected, Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "web security not working as expected," Watch "web security not working as expected," New topic
Author

web security not working as expected,

Anil Deshpande
Ranch Hand

Joined: Jan 13, 2008
Posts: 119
I have written two index.jsp files in /Beer/AddRecipe and /Beer/ReviewRecipe/ folders. And one index.html in the application context. And have done changes to the tomcat-usres.xml

tomcat-users.xml looks like as follows.



Line 3,4,5,6,7 were there previously. All other things I have done.

And the wrote web.xml which looks as follows



But the problem is when I type in http://localhost:8080/testauth1/Beer/AddRecipe/index.jsp or http://localhost:8080/testauth1/Beer/ReviewRecipe/index.jsp it is not doing any authentication or authorization. Is there any thing wrong with my xml files. and Another thing do I have to remove role name in tomcat-users.xml that were there previously.


It works for the first time. But next time it doesn't as for username and password

Anil Deshpande
SCJP 1.5, SCWCD 1.5
Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
Hi Anil.

You have not made resouce '/Beer/ReviewRecipe/' as constrained. If you made, it will work.
It works for the first time. But next time it doesn't ask for username and password


For the first request, tomcat creates session object and sets the time period of 30 min's(default time period of tomcat) and adds it to the cookie object and sends it to the client. Next time client will communicate to the tomcat via. cookie(JSESSIONID cookie).

For the second request if we want authentication, delete cookie at the browser side and send request.

Anil Deshpande
Ranch Hand

Joined: Jan 13, 2008
Posts: 119
Thanks for the clarification on why it doesn't work for next requests. Another thing , I have written security-constraint in line number 23 to 37. I worked fine.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: web security not working as expected,