Bonjour, ça fait 2 jours que je cherche alors je poste !
J'essaie de protéger un dossier sur un site en Java EE/JSF, je veux une authentification par mot de passe chiffré, lequel se trouve dans une base de données postgresql voici mes fichiers :
[context.xml] :
1 2 3 4 5 6 7 8 9 10 11 12
| <?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/site">
<Resource name="jdbc/postgres" auth="Container"
type="javax.sql.DataSource" driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://127.0.0.1:5432/maBdd"
username="xxxxxx" password="xxxxx" maxActive="20" maxIdle="10"
maxWait="-1"/>
<Realm className="org.apache.catalina.realm.DataSourceRealm"
dataSourceName="jdbc/postgres"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
</Context> |
[web.xml] (extrait)
[...]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| <resource-ref>
<description>postgreSQL Datasource</description>
<res-ref-name>jdbc/postgres</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<security-constraint>
<web-resource-collection>
<web-resource-name>SecureResource</web-resource-name>
<url-pattern>/admin/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>administrateur</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<role-name>administrateur</role-name>
</security-role>
<login-config>
<auth-method>DIGEST</auth-method>
<realm-name>Zone protégée</realm-name>
</login-config> |
si j'ajoute [digest="md5"] à mon Realm j'obtiens cette erreur quand j'essaie de me connecter :
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| java.lang.NullPointerException
org.apache.catalina.realm.RealmBase.authenticate(RealmBase.java:409)
org.apache.catalina.authenticator.DigestAuthenticator$DigestInfo.authenticate(DigestAuthenticator.java:720)
org.apache.catalina.authenticator.DigestAuthenticator.authenticate(DigestAuthenticator.java:294)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:544)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:722) |
Si je l'enlève j'ai la boite de dialogue tout le temps sans que je puisse me connecter.
Dans le catalina.out du jour j'ai aussi cette erreur que je ne sais comment corriger :
SEVERE: The web application [/site] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Voila je crois avoir tout posté, merci d'avance pour votre aide précieuse.
Partager