jQuery in Action, 2nd edition*
The moose likes Websphere and the fly likes Servlet BASIC authentication not working (web.xml attached) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Servlet BASIC authentication not working (web.xml attached)" Watch "Servlet BASIC authentication not working (web.xml attached)" New topic
Author

Servlet BASIC authentication not working (web.xml attached)

Gurumurthy Ramamurthy
Ranch Hand

Joined: Feb 13, 2003
Posts: 272
Hi,

1. I have enabled administrator security in websphere. When I give the admin page, it asks me username/password, it works well.
2. I have written a HelloWorld servlet (deployed in websphere app server) and given the BASIC authentication mechanism in web.xml as follows:

<?xml version="1.0" encoding="ISO-8859-1"?>

< !DOCTYPE web-app<br /> PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"<br /> "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
<display-name>Examples</display-name>
<description>
Example servlets
</description>

<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>HelloWorld</servlet-class>
</servlet>

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

<security-constraint>
<web-resource-collection>
<web-resource-name>Secured</web-resource-name>
<description></description>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>PUT</http-method>
</web-resource-collection>

<auth-constraint>
<description></description>
<role-name>administrator</role-name>
</auth-constraint>

<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>

<login-config>
<auth-method>BASIC</auth-method>
<realm-name>HelloServlet</realm-name>
</login-config>


</web-app>

If I give the URL to access this servlet, the window security box appears but when I give the username/password, it says "You are not authorized to view this page".
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet BASIC authentication not working (web.xml attached)
 
Similar Threads
Adding users and roles
How to secure servlet in websphere?
WAS Form based login
404 Exception
404 Exception