|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tomcat.core.BaseInterceptor
org.apache.tomcat.modules.aaa.RealmBase
org.apache.tomcat.modules.aaa.JDBCRealm
Implmentation of Realm that works with any JDBC supported database. See the JDBCRealm.howto for more details on how to set up the database and for configuration options.
Nested Class Summary | |
static class |
JDBCRealm.JdbcPrincipal
|
Field Summary | |
protected java.lang.String |
connectionName
The connection URL to use when trying to connect to the databse |
protected java.lang.String |
connectionPassword
The connection URL to use when trying to connect to the databse |
protected java.lang.String |
connectionURL
The connection URL to use when trying to connect to the databse |
protected java.lang.String |
driverName
The JDBC driver to use. |
protected boolean |
JDBCStarted
Has the JDBC connection been started? |
protected java.lang.String |
roleNameCol
The column in the user role table that names a role |
protected java.lang.String |
userCredCol
The column in the user table that holds the user's credintials |
protected java.lang.String |
userNameCol
The column in the user table that holds the user's name |
protected java.lang.String |
userRoleTable
The table that holds the relation between user's and roles |
protected java.lang.String |
userTable
The table that holds user data. |
Fields inherited from class org.apache.tomcat.modules.aaa.RealmBase |
digest, sm |
Fields inherited from class org.apache.tomcat.core.BaseInterceptor |
cm, ct, ctx, debug, DECLINED, loghelper, OK |
Constructor Summary | |
JDBCRealm()
|
Method Summary | |
void |
contextInit(Context ctx)
Notify when a context is initialized. |
void |
contextShutdown(Context ctx)
Called when a context is stoped, before removeContext. |
java.lang.String |
getCredentials(java.lang.String username)
If there are any errors with the JDBC connection, executing the query or anything we return false (don't authenticate). |
protected java.sql.PreparedStatement |
getPreparedAuthenticate(java.sql.Connection conn)
|
protected java.sql.PreparedStatement |
getPreparedRoles(java.sql.Connection conn)
|
protected java.security.Principal |
getPrincipal(java.lang.String username)
getPrincipal |
java.lang.String[] |
getUserRoles(java.lang.String username)
returns all the roles for a given user. |
boolean |
isConnectionNameSet()
Return status of connectionName |
boolean |
isConnectionPasswordSet()
Return status of connectionPassword |
void |
setConnectionName(java.lang.String connectionName)
Set the name to use to connect to the database. |
void |
setConnectionPassword(java.lang.String connectionPassword)
Set the password to use to connect to the database. |
void |
setConnectionURL(java.lang.String connectionURL)
Set the URL to use to connect to the database. |
void |
setConnectOnInit(boolean b)
When connectOnInit is true the JDBC connection is started at tomcat init if false the connection is started the first times it is needed. |
void |
setDriverName(java.lang.String driverName)
Set the JDBC driver that will be used. |
void |
setRoleNameCol(java.lang.String roleNameCol)
Set the column in the user role table that names a role |
void |
setUserCredCol(java.lang.String userCredCol)
Set the column in the user table that holds the user's credintials |
void |
setUserNameCol(java.lang.String userNameCol)
Set the column in the user table that holds the user's name |
void |
setUserRoleTable(java.lang.String userRoleTable)
Set the table that holds the relation between user's and roles |
void |
setUserTable(java.lang.String userTable)
Set the table that holds user data. |
Methods inherited from class org.apache.tomcat.modules.aaa.RealmBase |
authenticate, digest, engineInit, getDigest, main, setDigest |
Methods inherited from class org.apache.tomcat.core.BaseInterceptor |
addContainer, addContext, addHandler, addInterceptor, addSecurityConstraint, afterBody, authorize, beforeBody, beforeCommit, contextMap, contextState, copyContext, engineShutdown, engineStart, engineState, engineStop, findSession, getContext, getContextManager, getDebug, getInfo, getLog, getNote, getNote, handleError, log, log, log, log, postInitCheck, postReadRequest, postRequest, postService, postServletDestroy, postServletInit, preInitCheck, preService, preServletDestroy, preServletInit, registerHooks, reload, removeContainer, removeContext, removeHandler, removeInterceptor, requestMap, sessionState, setContext, setContextManager, setDebug, setInfo, setNote, setNote |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String connectionURL
protected java.lang.String connectionName
protected java.lang.String connectionPassword
protected java.lang.String userTable
protected java.lang.String userNameCol
protected java.lang.String userCredCol
protected java.lang.String userRoleTable
protected java.lang.String roleNameCol
protected java.lang.String driverName
protected boolean JDBCStarted
Constructor Detail |
public JDBCRealm()
Method Detail |
public void setDriverName(java.lang.String driverName)
driverName
- The driver namepublic void setConnectionURL(java.lang.String connectionURL)
connectionURL
- The new connection URLpublic void setConnectionName(java.lang.String connectionName)
connectionName
- User namepublic boolean isConnectionNameSet()
public void setConnectionPassword(java.lang.String connectionPassword)
connectionPassword
- User passwordpublic boolean isConnectionPasswordSet()
public void setUserTable(java.lang.String userTable)
userTable
- The table namepublic void setUserNameCol(java.lang.String userNameCol)
userNameCol
- The column namepublic void setUserCredCol(java.lang.String userCredCol)
userCredCol
- The column namepublic void setUserRoleTable(java.lang.String userRoleTable)
userRoleTable
- The table namepublic void setRoleNameCol(java.lang.String roleNameCol)
roleNameCol
- The column namepublic void setConnectOnInit(boolean b)
b
- public java.lang.String getCredentials(java.lang.String username)
getCredentials
in class RealmBase
username
- Username of the Principal to look upprotected java.sql.PreparedStatement getPreparedAuthenticate(java.sql.Connection conn) throws java.sql.SQLException
java.sql.SQLException
protected java.sql.PreparedStatement getPreparedRoles(java.sql.Connection conn) throws java.sql.SQLException
java.sql.SQLException
public java.lang.String[] getUserRoles(java.lang.String username)
getUserRoles
in class RealmBase
username
- the user name
public void contextShutdown(Context ctx) throws TomcatException
BaseInterceptor
contextShutdown
in class BaseInterceptor
TomcatException
public void contextInit(Context ctx) throws TomcatException
BaseInterceptor
contextInit
in class BaseInterceptor
TomcatException
protected java.security.Principal getPrincipal(java.lang.String username)
getPrincipal
in class RealmBase
username
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |