com.caucho.security
Class XmlAuthenticator

java.lang.Object
  extended by com.caucho.security.AbstractAuthenticator
      extended by com.caucho.security.XmlAuthenticator
All Implemented Interfaces:
HandleAware, Authenticator, java.io.Serializable
Direct Known Subclasses:
AdminAuthenticator, XmlAuthenticator

@Singleton
public class XmlAuthenticator
extends AbstractAuthenticator

The XML authenticator reads a static file for authentication.

 <resin:XmlAuthenticator path="WEB-INF/users.xml"/>
 

The format of the static file is as follows:

 <users>
   <user name="h.potter" password="quidditch" roles="user,captain"/>
   ...
 </users>
 

The authenticator can also be configured in the resin-web.xml:

 <resin:XmlAuthenticator password-digest="none">
   <user name="Harry Potter" password="quidditch" roles="user,captain"/>
 </resin:XmlAuthenticator>
 

See Also:
Serialized Form

Nested Class Summary
 class XmlAuthenticator.User
           
 
Field Summary
 
Fields inherited from class com.caucho.security.AbstractAuthenticator
_passwordDigest, _passwordDigestAlgorithm, _passwordDigestRealm
 
Constructor Summary
XmlAuthenticator()
           
 
Method Summary
 void addUser(XmlAuthenticator.User user)
          Adds a user from the configuration.
 XmlAuthenticator.User createUser()
          Adds a user from the configuration.
protected  java.lang.String getDefaultGroup()
          Returns the default group for a user
protected  PasswordUser getPasswordUser(java.lang.String userName)
          Returns the PasswordUser
 Path getPath()
          Gets the path to the XML file.
protected  java.util.Hashtable<java.lang.String,PasswordUser> getUserMap()
          Returns the user map
 void init()
          Initialize the XML authenticator.
 void reload()
          Reload the authenticator.
 void setPath(Path path)
          Sets the path to the XML file.
 
Methods inherited from class com.caucho.security.AbstractAuthenticator
addRoleMapping, authenticate, authenticate, authenticate, authenticate, authenticate, digest, getAlgorithm, getDigest, getDigestSecret, getDigestSecret, getLogoutOnSessionTimeout, getPasswordDigest, getPasswordDigest, getPasswordDigestAlgorithm, getPasswordDigestRealm, getPasswordUser, getSingleSignon, isUserInRole, logout, setLogoutOnSessionTimeout, setPasswordDigest, setPasswordDigestAlgorithm, setPasswordDigestRealm, setSerializationHandle, stringToDigest, toString, writeReplace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XmlAuthenticator

public XmlAuthenticator()
Method Detail

setPath

public void setPath(Path path)
Sets the path to the XML file.


getPath

public Path getPath()
Gets the path to the XML file.


getDefaultGroup

protected java.lang.String getDefaultGroup()
Returns the default group for a user


createUser

public XmlAuthenticator.User createUser()
Adds a user from the configuration.
 <init user='Harry Potter:quidditch:user,webdav'/>
 


addUser

public void addUser(XmlAuthenticator.User user)
Adds a user from the configuration.
 <init user='Harry Potter:quidditch:user,webdav'/>
 


getUserMap

protected java.util.Hashtable<java.lang.String,PasswordUser> getUserMap()
Returns the user map


init

@PostConstruct
public void init()
          throws ServletException
Initialize the XML authenticator.

Overrides:
init in class AbstractAuthenticator
Throws:
ServletException

getPasswordUser

protected PasswordUser getPasswordUser(java.lang.String userName)
Returns the PasswordUser

Overrides:
getPasswordUser in class AbstractAuthenticator
Parameters:
userName - the string user name
Returns:
the populated PasswordUser value

reload

public void reload()
Reload the authenticator.