com.caucho.security
Class JaasAuthenticator

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

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.security.AbstractAuthenticator
_passwordDigest, _passwordDigestAlgorithm, _passwordDigestRealm
 
Constructor Summary
JaasAuthenticator()
           
 
Method Summary
protected  java.security.Principal authenticate(java.security.Principal principal, PasswordCredentials cred, java.lang.Object details)
          Authenticate (login) the user.
 void init()
          Initialize the authenticator.
 boolean isUserInRole(java.security.Principal principal, java.lang.String role)
          Returns true if the user plays the named role.
 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.security.AbstractAuthenticator
addRoleMapping, authenticate, authenticate, authenticate, authenticate, digest, getAlgorithm, getDigest, getDigestSecret, getDigestSecret, getLogoutOnSessionTimeout, getPasswordDigest, getPasswordDigest, getPasswordDigestAlgorithm, getPasswordDigestRealm, getPasswordUser, getPasswordUser, getSingleSignon, 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

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

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

Overrides:
init in class AbstractAuthenticator
Throws:
ServletException

authenticate

protected java.security.Principal authenticate(java.security.Principal principal,
                                               PasswordCredentials cred,
                                               java.lang.Object details)
Authenticate (login) the user.

Overrides:
authenticate in class AbstractAuthenticator

isUserInRole

public boolean isUserInRole(java.security.Principal principal,
                            java.lang.String role)
Returns true if the user plays the named role.

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