aspose file tools*
The moose likes Servlets and the fly likes How to authenticate all the URL's 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 » Java » Servlets
Reply locked New topic
Author

How to authenticate all the URL's

Ankur Srivastav
Ranch Hand

Joined: Aug 31, 2009
Posts: 57

I have the following web.xml

--

<servlet-mapping>
<servlet-name>MainServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

<security-constraint>
<web-resource-collection>
<web-resource-name>Book</web-resource-name>
<url-pattern>/</url-pattern>
<!-- <http-method>GET</http-method> -->
</web-resource-collection>
<auth-constraint>
<role-name>AppAdmin</role-name>
<role-name>HRAdmin</role-name>
</auth-constraint>
</security-constraint>

<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/WEB-INF/jsp/formlogin.jsp</form-login-page>
<form-error-page>/WEB-INF/jsp/formerror.jsp</form-error-page>
</form-login-config>
</login-config>

What I am trying to achieve is: For any request to this App like http://localhost:8083/servletbookapp/ the user should get authenticated. But that is not happening unless I specify some specific pattern like
<url-pattern>/test</url-pattern>

Kindly suggest if I should make any changes ...


Sun Certified Java Programmer v 1.4
Oracle Certified Associate, Java SE 7 Programmer
JEE 5 Web Component Developer Certified Professional
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

Please do not post the same question more than once. Continue any discussion in your original post.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to authenticate all the URL's