Hi,
In our project, we are trying to use */Basic HTTP Authorization/* so
that it prompts us with a window to login before seeing any page. Here,
are the tags we put in our web.xml file.
<security-constraint>
<web-resource-collection>
<web-resource-name>register-ucr</web-resource-name>
<url-pattern>/pages/about.html</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>manager</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>register-ucr</realm-name>
</login-config>
<security-role>
<description>role required to log in to RegisterUCR</description>
<role-name>manager</role-name>
</security-role>
We tried different values for <url-pattern>. For e.g., *
<url-pattern>/*</url-pattern>* or
*<url-pattern>/RegisterUser.do</url-pattern>* or the about.html (a
simple html page) as shown above.
When we try to access the page we give in <url-pattern>, we get an error
in IE, error 404: file not found. And when we simply give
*<url-pattern>/*</url-pattern>* , strange thing is it doesn't prompt for
the user name and just shows us the page directly with no error as if
there was no change
We also made change in server.xml of tomcat. Where we commented the
UserDatabaseRealm reference and uncommented the MemoryRealm reference.
<!-- <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
-->
<Realm className="org.apache.catalina.realm.MemoryRealm" />
In our application, we are using Struts as well. I am not sure if that
is the reason this simple thing is not working for us. We tried to
search the web for a lot of for the 404 error but couldn't find much.
Please advise, what we are doing wrong or what else we could try.
Thanks in advance,
Shilpa Arora