|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mortbay.jetty.security.HashUserRealm org.mortbay.jetty.security.JDBCUserRealm
HashMapped User Realm with JDBC as data source. JDBCUserRealm extends HashUserRealm and adds a method to fetch user information from database. The authenticate() method checks the inherited HashMap for the user. If the user is not found, it will fetch details from the database and populate the inherited HashMap. It then calls the HashUserRealm authenticate() method to perform the actual authentication. Periodically (controlled by configuration parameter), internal hashes are cleared. Caching can be disabled by setting cache refresh interval to zero. Uses one database connection that is initialized at startup. Reconnect on failures. authenticate() is 'synchronized'. An example properties file for configuration is in $JETTY_HOME/etc/jdbcRealm.properties
Field Summary |
Fields inherited from class org.mortbay.jetty.security.HashUserRealm |
__SSO, _roles |
Constructor Summary | |
JDBCUserRealm()
Constructor. |
|
JDBCUserRealm(String name)
Constructor. |
|
JDBCUserRealm(String name,
String config)
Constructor. |
Method Summary | |
Principal |
authenticate(String username,
Object credentials,
Request request)
Authenticate a users credentials. |
void |
connectDatabase()
(re)Connect to database with parameters setup by loadConfig() |
String |
getConfig()
|
String |
getName()
|
void |
logout(Principal user)
logout a user Principal. |
void |
setConfig(String config)
Load JDBC connection configuration from properties file. |
void |
setName(String name)
|
Methods inherited from class org.mortbay.jetty.security.HashUserRealm |
addUserToRole, clearSingleSignOn, disassociate, dump, getPrincipal, getSingleSignOn, getSSORealm, isUserInRole, popRole, pushRole, put, reauthenticate, setSingleSignOn, setSSORealm, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.mortbay.jetty.security.UserRealm |
disassociate, getPrincipal, isUserInRole, popRole, pushRole, reauthenticate |
Constructor Detail |
public JDBCUserRealm()
public JDBCUserRealm(String name)
name
- public JDBCUserRealm(String name, String config) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException
name
- Realm nameconfig
- Filename or url of JDBC connection properties file.
IOException
ClassNotFoundException
InstantiationException
IllegalAccessException
Method Detail |
public String getName()
getName
in interface UserRealm
getName
in class HashUserRealm
public void setName(String name)
setName
in class HashUserRealm
name
- The realm namepublic String getConfig()
getConfig
in class HashUserRealm
public void setConfig(String config) throws IOException
setConfig
in class HashUserRealm
config
- Filename or url of user properties file.
IOException
public void logout(Principal user)
UserRealm
logout
in interface UserRealm
logout
in class HashUserRealm
public void connectDatabase()
public Principal authenticate(String username, Object credentials, Request request)
UserRealm
authenticate
in interface UserRealm
authenticate
in class HashUserRealm
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |