com.caucho.server.security
Class JaasAuthenticator

java.lang.Object
  extended by com.caucho.server.security.AbstractAuthenticator
      extended by com.caucho.server.security.JaasAuthenticator
All Implemented Interfaces:
ServletAuthenticator, HandleAware, java.io.Serializable

public class JaasAuthenticator
extends AbstractAuthenticator

The JAAS authenticator uses an existing JAAS LoginModule. Applications which have existing JAAS modules can use the JaasAuthenticator to log users in based on the old login.

 <authenticator url="jaas:">
   <init login-module="example.MyLogin"/>
 </authenticator>

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.caucho.server.security.AbstractAuthenticator
_passwordDigest, _passwordDigestAlgorithm, _passwordDigestRealm, _principalCache, _principalCacheSize, LOGIN_NAME
 
Constructor Summary
JaasAuthenticator()
           
 
Method Summary
 void init()
          Initialize the authenticator.
 boolean isUserInRole(HttpServletRequest request, HttpServletResponse response, ServletContext application, java.security.Principal principal, java.lang.String role)
          Returns true if the user plays the named role.
protected  java.security.Principal loginImpl(HttpServletRequest request, HttpServletResponse response, ServletContext application, java.lang.String userName, java.lang.String password)
          Authenticate (login) the user.
 void setInitParam(InitParam init)
           
 void setLoginModule(java.lang.Class loginModuleClass)
          Sets the JAAS spi login module class.
 void setOptions(InitParam init)
           
 
Methods inherited from class com.caucho.server.security.AbstractAuthenticator
addRoleMapping, digest, getDigestPassword, getDigestSecret, getLogoutOnSessionTimeout, getPasswordDigest, getPasswordDigest, getPasswordDigestAlgorithm, getPasswordDigestRealm, getPrincipalCacheSize, getUserPrincipal, getUserPrincipalImpl, login, loginDigest, loginDigestImpl, logout, logout, logout, setLogoutOnSessionTimeout, setPasswordDigest, setPasswordDigestAlgorithm, setPasswordDigestRealm, setPrincipalCacheSize, setSerializationHandle, stringToDigest, toString, writeReplace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JaasAuthenticator

public JaasAuthenticator()
Method Detail

setLoginModule

public void setLoginModule(java.lang.Class loginModuleClass)
                    throws ConfigException
Sets the JAAS spi login module class.

Throws:
ConfigException

setInitParam

public void setInitParam(InitParam init)

setOptions

public void setOptions(InitParam init)

init

public void init()
          throws ServletException
Initialize the authenticator.

Specified by:
init in interface ServletAuthenticator
Overrides:
init in class AbstractAuthenticator
Throws:
ServletException

loginImpl

protected java.security.Principal loginImpl(HttpServletRequest request,
                                            HttpServletResponse response,
                                            ServletContext application,
                                            java.lang.String userName,
                                            java.lang.String password)
                                     throws ServletException
Authenticate (login) the user.

Overrides:
loginImpl in class AbstractAuthenticator
Throws:
ServletException

isUserInRole

public boolean isUserInRole(HttpServletRequest request,
                            HttpServletResponse response,
                            ServletContext application,
                            java.security.Principal principal,
                            java.lang.String role)
                     throws ServletException
Returns true if the user plays the named role.

Specified by:
isUserInRole in interface ServletAuthenticator
Overrides:
isUserInRole in class AbstractAuthenticator
Parameters:
request - the servlet request
user - the user to test
role - the role to test
Throws:
ServletException