public class JDBCUserRealm extends HashUserRealm implements UserRealm
__SSO, _roles, _users
Constructor and Description |
---|
JDBCUserRealm()
Constructor.
|
JDBCUserRealm(String name)
Constructor.
|
JDBCUserRealm(String name,
String config)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Principal |
authenticate(String username,
Object credentials,
Request request)
Authenticate a users credentials.
|
void |
connectDatabase()
(re)Connect to database with parameters setup by loadConfig()
|
boolean |
isUserInRole(Principal user,
String roleName)
Check if a user is in a role.
|
protected void |
loadConfig()
Load JDBC connection configuration from properties file.
|
void |
logout(Principal user)
logout a user Principal.
|
addUserToRole, clearSingleSignOn, disassociate, doStart, doStop, dump, getConfig, getConfigResource, getName, getPrincipal, getRefreshInterval, getSingleSignOn, getSSORealm, popRole, pushRole, put, reauthenticate, setConfig, setName, setRefreshInterval, setSingleSignOn, setSSORealm, toString
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
disassociate, getName, getPrincipal, popRole, pushRole, reauthenticate
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
protected void loadConfig() throws IOException
loadConfig
in class HashUserRealm
IOException
public void logout(Principal user)
UserRealm
logout
in interface UserRealm
logout
in class HashUserRealm
user
- A Principal previously returned from this realmpublic void connectDatabase()
public Principal authenticate(String username, Object credentials, Request request)
UserRealm
authenticate
in interface UserRealm
authenticate
in class HashUserRealm
username
- The username.credentials
- The user credentials, normally a String password.request
- The request to be authenticated. Additional
parameters may be extracted or set on this request as needed
for the authentication mechanism (none required for BASIC and
FORM authentication).public boolean isUserInRole(Principal user, String roleName)
isUserInRole
in interface UserRealm
isUserInRole
in class HashUserRealm
user
- The user, which must be from this realmroleName
- Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.