org.apache.tomcat.modules.aaa
Class RealmBase
java.lang.Object
|
+--org.apache.tomcat.core.BaseInterceptor
|
+--org.apache.tomcat.modules.aaa.RealmBase
- Direct Known Subclasses:
- JDBCRealm, SimpleRealm
- public abstract class RealmBase
- extends BaseInterceptor
Field Summary |
protected java.lang.String |
digest
Digest algorithm used in passwords. |
protected static StringManager |
sm
The string manager for this package. |
Method Summary |
int |
authenticate(Request req,
Response response)
This callback is used to extract and verify the user identity
and credentials. |
static java.lang.String |
digest(java.lang.String credentials,
java.lang.String algorithm)
Digest password using the algorithm especificied and
convert the result to a corresponding hex string. |
void |
engineInit(ContextManager cm)
Initialize the module. |
protected abstract java.lang.String |
getCredentials(java.lang.String username)
|
java.lang.String |
getDigest()
Gets the digest algorithm used for credentials in the database. |
protected abstract java.security.Principal |
getPrincipal(java.lang.String username)
|
protected abstract java.lang.String[] |
getUserRoles(java.lang.String username)
|
static void |
main(java.lang.String[] args)
RealmBase can be used as a standalone tool for offline password digest |
void |
setDigest(java.lang.String algorithm)
Sets the digest algorithm used for credentials in the database. |
Methods inherited from class org.apache.tomcat.core.BaseInterceptor |
addContainer, addContext, addHandler, addInterceptor, addSecurityConstraint, afterBody, authorize, beforeBody, beforeCommit, contextInit, contextMap, contextShutdown, contextState, engineShutdown, engineStart, engineState, engineStop, findSession, getContext, getContextManager, getDebug, getInfo, getLog, getNote, getNote, handleError, log, log, log, log, postReadRequest, postRequest, postService, postServletDestroy, postServletInit, 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 |
sm
protected static StringManager sm
- The string manager for this package.
digest
protected java.lang.String digest
- Digest algorithm used in passwords. Should be a value accepted by MessageDigest for algorithm
or "No" ( no encode ). "No" is the default.
RealmBase
public RealmBase()
getDigest
public java.lang.String getDigest()
- Gets the digest algorithm used for credentials in the database.
Should be a value that MessageDigest accepts for algorithm or "No".
"No" is the Default.
- Returns:
- the digest algorithm being used, or "No" if no encoding
setDigest
public void setDigest(java.lang.String algorithm)
- Sets the digest algorithm used for credentials in the database.
Should be a value that MessageDigest accepts for algorithm or "No".
"No" is the Default.
- Parameters:
algorithm
- the Encode type
digest
public static final java.lang.String digest(java.lang.String credentials,
java.lang.String algorithm)
- Digest password using the algorithm especificied and
convert the result to a corresponding hex string.
If exception, the plain credentials string is returned
- Parameters:
credentials
- Password or other credentials to use in authenticating this usernamealgorithm
- Algorithm used to do the digest
main
public static void main(java.lang.String[] args)
- RealmBase can be used as a standalone tool for offline password digest
- Parameters:
args
-
getCredentials
protected abstract java.lang.String getCredentials(java.lang.String username)
getUserRoles
protected abstract java.lang.String[] getUserRoles(java.lang.String username)
getPrincipal
protected abstract java.security.Principal getPrincipal(java.lang.String username)
engineInit
public void engineInit(ContextManager cm)
throws TomcatException
- Description copied from class:
BaseInterceptor
- Initialize the module.
- Overrides:
engineInit
in class BaseInterceptor
- Following copied from class:
org.apache.tomcat.core.BaseInterceptor
- Throws:
TomcatException
- The module will not be added if any
exception is thrown by engineInit.
authenticate
public int authenticate(Request req,
Response response)
- Description copied from class:
BaseInterceptor
- This callback is used to extract and verify the user identity
and credentials.
It will set the RemoteUser field if it can authenticate.
The auth event is generated by a user asking for the remote
user field of by tomcat if a request requires authenticated
id.
- Overrides:
authenticate
in class BaseInterceptor
Copyright © 2001 Apache Software Foundation. All Rights Reserved.