ciao ragazzi...
sto provando a fare un miniprogrammino che gestisca l'autorizzazione/autenticazione in un sito web.. (per poi applicarlo al progetto che qualcuno di voi conosce in parte a causa dei miei post precedenti)
dunque.. veniamo al sodo... non so come si fa!ma vi dico quello che ho fatto e accetto suggerimenti.
Il db è access e il web server è JONAS 4.8.4
creo la mia pagina index.html nel seguente modo
codice:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>pagina di login</title> </head> <body> <h1>Login</h1> Inserire la propria username e password</p> <table cellspacing="5" border="0"> <form action="j_security_check" METHOD="POST"> <tr> <td align="right">Username</td> <td><input type="text" name="j_username"></td> </tr> <tr> <td align="right">Password</td> <td><input type="password" name="j_password"></td> </tr> <tr><td><input type="submit" value="Invia"></td></tr> </form> </table> </body> </html>
...e il file web.xml
codice:<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"> <web-app> <security-constraint> <web-resource-collection> <web-resource-name>Protected Area</web-resource-name> <url-pattern>/*</url-pattern> <http-method>DELETE</http-method> <http-method>GET</http-method> <http-method>POST</http-method> <http-method>PUT</http-method> </web-resource-collection> <auth-constraint> <role-name>tomcat</role-name> </auth-constraint> <user-data-constraint><transport-guarantee> NONE</transport-guarantee></user-data-constraint> </security-constraint> <login-config> <auth-method>FORM</auth-method> <form-login-config> <form-login-page>index.html</form-login-page> <form-error-page>index.html</form-error-page> </form-login-config> </login-config> </web-app>
...a questo punto... creo il db authority.mdb all'interno della cartella del progetto... un db fatto cosi:
...e modificato il file server.xml nel seguente modocodice:select * from users; +-----------+-----------+ | user_name | user_pass | +-----------+-----------+ | tomcat | tomcat | | user1 | tomcat | | user2 | tomcat | | user3 | tomcat | +-----------+-----------+ select * from roles; +------------+ | role_name | +------------+ | tomcat | | role1 | +------------+ select * from user_roles; +------------+-----------+ | role_name | user_name | +------------+-----------+ | tomcat | user1 | | role1 | user2 | | tomcat | tomcat | | role1 | tomcat | +------------+-----------+
dovrebbe essere tutto!! :master:codice:<Realm className="org.objectweb.jonas.security.realm.web.catalina55.JACC" resourceName="memrlm_1" debug="99" driverName="sun.jdbc.odbc.JdbcOdbcDriver" connectionURL="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Programmi\JONAS_4_8_4\webapps\autoload\auth\authority.mdb;DriverID=22;READONLY=true}" userTable="users" userNameCol="user_name" userCredCol="user_pass" userRoleTable="user_roles" roleNameCol="role_name" />
bene... riavvio jonas... digito l'url e mi compare la form di login.... inserisco username e password, submit e....
codice:HTTP Status 404 - /auth/j_security_check -------------------------------------------------------------------------------- type Status report message /auth/j_security_check description The requested resource (/auth/j_security_check) is not available. -------------------------------------------------------------------------------- Apache Tomcat/5.5.17
potreste aiutarmi?
grazie a tutti anticipatamente


ma vi dico quello che ho fatto e accetto suggerimenti.
Rispondi quotando