org.apache.tomcat.modules.aaa
Class SimpleRealm

java.lang.Object
  |
  +--org.apache.tomcat.core.BaseInterceptor
        |
        +--org.apache.tomcat.modules.aaa.RealmBase
              |
              +--org.apache.tomcat.modules.aaa.SimpleRealm

public class SimpleRealm
extends RealmBase

Memory based realm - will authenticate an user and password against an xml file. The file is fully read in memory when the context is initialized. The default file is TOMCAT_HOME/conf/users/tomcat-users.xml. You can change it, and you can also set this module as a per context interceptor, so that each module have it's own realm. The module will use "credentials.user" and "credentials.password" request notes. It's role is to verify those notes, other module is specialized in extracting the information from the request.


Inner Class Summary
static class SimpleRealm.SimpleRealmPrincipal
           
 
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
SimpleRealm()
           
 
Method Summary
 void contextInit(Context ctx)
          Notify when a context is initialized.
protected  java.lang.String getCredentials(java.lang.String username)
          getCredentials
 java.lang.String getFilename()
           
protected  java.security.Principal getPrincipal(java.lang.String username)
          getPrincipal
protected  java.lang.String[] getUserRoles(java.lang.String username)
          getUserRoles
 void setFilename(java.lang.String newFilename)
           
 
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, 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
 

Constructor Detail

SimpleRealm

public SimpleRealm()
Method Detail

getFilename

public java.lang.String getFilename()

setFilename

public void setFilename(java.lang.String newFilename)

contextInit

public void contextInit(Context ctx)
                 throws TomcatException
Description copied from class: BaseInterceptor
Notify when a context is initialized. The first interceptor in the chain for contextInit must read web.xml and set the context. When this method is called you can expect the context to be filled in with all the informations from web.xml.
Overrides:
contextInit in class BaseInterceptor
Following copied from class: org.apache.tomcat.core.BaseInterceptor
Throws:
If - the interceptor throws exception the context will not be initialized ( state==NEW or ADDED or DISABLED ).

getPrincipal

protected java.security.Principal getPrincipal(java.lang.String username)
getPrincipal
Overrides:
getPrincipal in class RealmBase
Parameters:
username -  
Returns:
java.security.Principal

getCredentials

protected java.lang.String getCredentials(java.lang.String username)
getCredentials
Overrides:
getCredentials in class RealmBase
Parameters:
username -  
Returns:
java.lang.String

getUserRoles

protected java.lang.String[] getUserRoles(java.lang.String username)
getUserRoles
Overrides:
getUserRoles in class RealmBase
Parameters:
username -  
Returns:
java.lang.String


Copyright © 2001 Apache Software Foundation. All Rights Reserved.