JdbcAuthenticator

From CauchoWiki

Jump to: navigation, search


The JdbcAuthenticator uses a database to store user authentication.

[edit] <init> directives

directivedescription
cookie-auth-querySets a query for cookie-based authentication
cookie-auth-updateSets the update SQL for cookie-based authentication
cookie-domainSets the domain value for cookie-based authentication
cookie-logoutIf true remove cookie on logout
cookie-max-ageSets the max-age value for cookie-based authentication
cookie-versionSets the cookie version for cookie-based authentication
data-sourceSpecifies the configured <database>required
logout-on-session-timeoutIf true, principals should be logged out when a session times outtrue
password-digestPassword digest type of form: MD5-base64MD5-base64
password-digest-algorithmSets the password digest algorithmMD5
password-digest-realmSets the realm to use for the digestresin
password-querySets a custom password query
principal-cache-sizeSize of the principal cache4096
role-querySpecifies the query to test for a role
use-cookieIf 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>
Personal tools