• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

What's wrong with my Authentication

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello folks,

I have a doubt on the chapter 12 of the book Head-First Servlets and JSP, I tried to do an authentication example in agreement with the book but I don't get to call the standard form of the browser, it follows the example

in tomcat-users.xml ********************************************
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="Guest"/>
<role rolename="Adm"/>
<role rolename="Member"/>
<user username="Annie" password="admin" roles="Adm,Member,Guest"/>
<user username="Diane" password="coder" roles="Member,Guest"/>
<user username="Ted" password="newBie" roles="Guest"/>
</tomcat-users>


in web.xml in my application, called Beer *********************************

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

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

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"

version="2.4">

<servlet>
<servlet-name>teste</servlet-name>
<servlet-class>AddRecipe.servletTeste</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>teste</servlet-name>
<url-pattern>/t.do</url-pattern>
</servlet-mapping>
<security-constraint>
<web-resource-collection>
<web-resource-name>UpdateRecipes</web-resource-name>
<url-pattern>/Beer/*</url-pattern>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>Admin</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<realm-name></realm-name>
<auth-method>BASIC</auth-method>
</login-config>
<security-role>
<role-name>Adm</role-name>
</security-role>

</web-app>


and it follows the structure of pastes used in the application ************
-->webapps
-->Beer (with. jsp that calls a servlet through method get)
-->WEB-INF (with web.xml)
-->classes
-->AddRecipe (with servlet.class)

obs: It�s works, but I don't get to call the form of authentication of the browser
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do you type for request the resource? I mean, you type something like:
http://localhost:8080/yourapp/Beer/test.jsp
??
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your tomcat setting, you use Admin.

but in your web.xml, you use a different name, Adm.
 
Marcelo Heitor
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Folks, the code started to function suddenly, is stranger... but OK. I am thankful for the help!!!


Marcelo Heitor
Bras�lia - Brazil
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic