org.nakedobjects.plugins.hibernate.authentication
Class DatabaseAuthenticator

java.lang.Object
  extended by org.nakedobjects.runtime.authentication.standard.AuthenticatorAbstract
      extended by org.nakedobjects.plugins.hibernate.authentication.DatabaseAuthenticator
All Implemented Interfaces:
ApplicationScopedComponent, Component, Authenticator

public class DatabaseAuthenticator
extends AuthenticatorAbstract

example properties for various database types:

 nakedobjects.component.authenticator.algorithm= MD5
 
 nakedobjects.component.authenticator.selectusersql.default = \
   select count(*) \
     from user u  \
    where username = ? and password = ?
    
 nakedobjects.component.authenticator.selectrolessql.default = \
   select r.rolename as rr \ 
     from role r, user u, user_role ur \ 
    where r.id = ur.role and ur.user = u.id and u.username = ?
    
 nakedobjects.component.authenticator.selectusersql.hsqldb = \
   select count(*) \
     from user u \
    where username = ? and password = ?
     
 nakedobjects.component.authenticator.selectrolessql.hsqldb = \
   select r.rolename as rr \
     from role r, user u, user_role ur \
    where r.id = ur.role and ur.user = u.id \
      and u.username = ?
       
 nakedobjects.component.authenticator.selectusersql.mysql = 
   select count(*) from `user` u \
    where `username` = ? and `password` = ?
     
 nakedobjects.component.authenticator.selectrolessql.mysql = \
   select r.`rolename` as rr \
     from `role` r, `user` u, `user_role` ur \
    where r.`id` = ur.`role` and ur.`user` = u.`id` and u.`username` = ?
     
 nakedobjects.component.authenticator.selectusersql.postgresql = \
   select count(*) \
     from "user" u \
    where "username" = ? and "password" = ?
    
 nakedobjects.component.authenticator.selectrolessql.postgresql = \
   select r."rolename" as rr \
     from "role" r, "user" u, "user_role" ur \
   where r."id" = ur."role" and ur."user" = u."id" and u."username" = ?
 


Constructor Summary
DatabaseAuthenticator(NakedObjectConfiguration configuration)
           
 
Method Summary
 boolean canAuthenticate(AuthenticationRequest request)
           
 java.lang.String generateHash(java.lang.String key)
           
 boolean isValid(AuthenticationRequest request)
           
 boolean isValidUser(AuthenticationRequest request)
           
 
Methods inherited from class org.nakedobjects.runtime.authentication.standard.AuthenticatorAbstract
authenticate, getConfiguration, getDeploymentType, init, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseAuthenticator

public DatabaseAuthenticator(NakedObjectConfiguration configuration)
Method Detail

generateHash

public java.lang.String generateHash(java.lang.String key)

isValidUser

public final boolean isValidUser(AuthenticationRequest request)

isValid

public final boolean isValid(AuthenticationRequest request)

canAuthenticate

public final boolean canAuthenticate(AuthenticationRequest request)


Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.