JdbcAuthenticator
From CauchoWiki
The JdbcAuthenticator uses a database to store user authentication.
[edit] <init> directives
| directive | description | |
|---|---|---|
| cookie-auth-query | Sets a query for cookie-based authentication | |
| cookie-auth-update | Sets the update SQL for cookie-based authentication | |
| cookie-domain | Sets the domain value for cookie-based authentication | |
| cookie-logout | If true remove cookie on logout | |
| cookie-max-age | Sets the max-age value for cookie-based authentication | |
| cookie-version | Sets the cookie version for cookie-based authentication | |
| data-source | Specifies the configured <database> | required |
| logout-on-session-timeout | If true, principals should be logged out when a session times out | true |
| password-digest | Password digest type of form: MD5-base64 | MD5-base64 |
| password-digest-algorithm | Sets the password digest algorithm | MD5 |
| password-digest-realm | Sets the realm to use for the digest | resin |
| password-query | Sets a custom password query | |
| principal-cache-size | Size of the principal cache | 4096 |
| role-query | Specifies the query to test for a role | |
| use-cookie | If true, use the resinauth cookie |
[edit] Example
[edit] resin-web.xml
<web-app xmlns="http://caucho.com/ns/resin"> <database jndi-name="java:comp/env/jdbc/test"> <driver type="org.postgresql.Driver"> <url>jdbc:postgresql://localhost/test</url> <user>harry</user> </driver> </database> <authenticator> <type>com.caucho.server.security.JdbcAuthenticator</type> <init> <data-source>java:comp/env/jdbc/test</data-source> </init> </authenticator> ... </web-app>
Here is how this needs to be configured for FORM authentication:
<authenticator type='com.caucho.server.security.JdbcAuthenticator'>
<init>
<data-source>jdbc/MyDataSource</data-source>
...
<password-digest>
<realm>resin</realm>
<algorithm>md5</algorithm>
<format>base64</format>
</password-digest>
</init>
</authenticator>
