JDBCRealm

Olá gostaria de uma informação…segui os exemplos do site do Tomcat…

para a utilização de um JDBCReaml…criei as tabelas…e declarei a tag <Realm…> no arquivo server.xml…e coloquei meu driver do meu BD(mysql) em server/lib…

todos os artigos que li…param…porque aqui…e dizem que eu devo configurar meu web.xml…

mas o que eu tenho que fazer neste arquivo pessoal pessoal??
se puderem me ajudar agradeço!

Crie um .war

WEB-INF/web.xml
<?xml version=“1.0” encoding=“UTF-8”?>

<!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>
<display-name>VacationTool</display-name>

<servlet>
<servlet-name>UpdateRequestServlet</servlet-name>
<display-name>UpdateRequestServlet</display-name>
<servlet-class>servlets.UpdateRequestServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>VacationServlet</servlet-name>
<display-name>VacationServlet</display-name>
<servlet-class>servlets.VacationServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>CleanRequestServlet</servlet-name>
<display-name>CleanRequestServlet</display-name>
<servlet-class>servlets.CleanRequestServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>VacationRequestListServlet</servlet-name>
<display-name>VacationRequestListServlet</display-name>
<servlet-class>servlets.VacationRequestListServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>VacationRequestServlet</servlet-name>
<display-name>VacationRequestServlet</display-name>
<servlet-class>servlets.VacationRequestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>UpdateRequestServlet</servlet-name>
/updateRequest
</servlet-mapping>
<servlet-mapping>
<servlet-name>VacationServlet</servlet-name>
/menu
</servlet-mapping>
<servlet-mapping>
<servlet-name>CleanRequestServlet</servlet-name>
/vacationclean
</servlet-mapping>
<servlet-mapping>
<servlet-name>VacationRequestListServlet</servlet-name>
/vacationlist
</servlet-mapping>
<servlet-mapping>
<servlet-name>VacationRequestServlet</servlet-name>
/request
</servlet-mapping>
<session-config>
<session-timeout>10</session-timeout>
</session-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>WRCollection</web-resource-name>
/index.html
<http-method>GET</http-method>
</web-resource-collection>

<role-name>Employee</role-name>
<role-name>Manager</role-name>


<transport-guarantee>NONE</transport-guarantee>

</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>WRCollection0</web-resource-name>
/menu
<http-method>POST</http-method>
<http-method>GET</http-method>
</web-resource-collection>

<role-name>Employee</role-name>
<role-name>Manager</role-name>


<transport-guarantee>NONE</transport-guarantee>

</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>WRCollection1</web-resource-name>
/vacationclean
<http-method>POST</http-method>
<http-method>GET</http-method>
</web-resource-collection>

<role-name>Manager</role-name>


<transport-guarantee>NONE</transport-guarantee>

</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>WRCollection2</web-resource-name>
/updateRequest
<http-method>GET</http-method>
</web-resource-collection>

<role-name>Manager</role-name>


<transport-guarantee>NONE</transport-guarantee>

</security-constraint>
<login-config>
BASIC
<realm-name>VacationRealm</realm-name>
</login-config>
<security-role>
<description>Employees</description>
<role-name>Employee</role-name>
</security-role>
<security-role>
<description>Managers</description>
<role-name>Manager</role-name>
</security-role>
</web-app>

Crie um .ear

META-INF/application.xml
<?xml version=“1.0” encoding=“UTF-8”?>

<!DOCTYPE application PUBLIC ‘-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN’ ‘http://java.sun.com/dtd/application_1_3.dtd’>

<display-name>Security</display-name> <description>Application description</description> <module> <web> <web-uri>vacation.war</web-uri> <context-root>vacation</context-root> </web> </module> <security-role> <description>Employees</description> <role-name>Employee</role-name> </security-role> <security-role> <description>Managers</description> <role-name>Manager</role-name> </security-role>

No seu REALM deve haver um mapeamento das Roles.

[]'s