org.mobicents.servlet.sip.security.authentication
Class AuthenticatorBase

java.lang.Object
  extended by org.mobicents.servlet.sip.security.authentication.AuthenticatorBase
All Implemented Interfaces:
org.apache.catalina.Authenticator
Direct Known Subclasses:
DigestAuthenticator

public abstract class AuthenticatorBase
extends java.lang.Object
implements org.apache.catalina.Authenticator

Base authenticator class. Based on the catalina authenticator.

Author:
Craig R. McClanahan, Vladimir Ralev modified to suit SIP

Field Summary
protected  java.lang.String algorithm
          The message digest algorithm to be used when generating session identifiers.
protected  boolean cache
          Should we cache authenticated Principals if the request is part of an HTTP session?
protected  org.apache.catalina.Context context
          The Context to which this Valve is attached.
protected static java.lang.String DEFAULT_ALGORITHM
          The default message digest algorithm to use if we cannot use the requested one.
protected  java.security.MessageDigest digest
          Return the MessageDigest implementation to be used when creating session identifiers.
protected  java.lang.String entropy
          A String initialization parameter used to increase the entropy of the initialization of our random number generator.
protected static java.lang.String INFO
          Descriptive information about this implementation.
protected  java.util.Random random
          A random number generator to use when generating session identifiers.
protected  java.lang.String randomClass
          The Java class name of the random number generator class to be used when generating session identifiers.
protected static org.apache.catalina.util.StringManager STRING_MANAGER
          The string manager for this package.
 
Constructor Summary
AuthenticatorBase()
           
 
Method Summary
protected abstract  boolean authenticate(SipServletRequestImpl request, SipServletResponseImpl response, SipLoginConfig config)
          Authenticate the user making this request, based on the specified login configuration.
 java.lang.String getAlgorithm()
          Return the message digest algorithm for this Manager.
 boolean getCache()
          Return the cache authenticated Principals flag.
 org.apache.catalina.Context getContext()
           
protected  java.security.MessageDigest getDigest()
          Return the MessageDigest object to be used for calculating session identifiers.
 java.lang.String getEntropy()
          Return the entropy increaser value, or compute a semi-useful value if this String has not yet been set.
 java.lang.String getInfo()
          Return descriptive information about this Valve implementation.
protected  java.util.Random getRandom()
          Return the random number generator instance we should use for generating session identifiers.
 java.lang.String getRandomClass()
          Return the random number generator class name.
protected  void register(SipServletRequestImpl request, SipServletResponseImpl response, java.security.Principal principal, java.lang.String authType, java.lang.String username, java.lang.String password)
          Register an authenticated Principal and authentication type in our request, in the current session (if there is one), and with our SingleSignOn valve, if there is one.
 void setAlgorithm(java.lang.String algorithm)
          Set the message digest algorithm for this Manager.
 void setCache(boolean cache)
          Set the cache authenticated Principals flag.
 void setContext(org.apache.catalina.Context context)
           
 void setEntropy(java.lang.String entropy)
          Set the entropy increaser value.
 void setRandomClass(java.lang.String randomClass)
          Set the random number generator class name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ALGORITHM

protected static final java.lang.String DEFAULT_ALGORITHM
The default message digest algorithm to use if we cannot use the requested one.

See Also:
Constant Field Values

algorithm

protected java.lang.String algorithm
The message digest algorithm to be used when generating session identifiers. This must be an algorithm supported by the java.security.MessageDigest class on your platform.


cache

protected boolean cache
Should we cache authenticated Principals if the request is part of an HTTP session?


context

protected org.apache.catalina.Context context
The Context to which this Valve is attached.


digest

protected java.security.MessageDigest digest
Return the MessageDigest implementation to be used when creating session identifiers.


entropy

protected java.lang.String entropy
A String initialization parameter used to increase the entropy of the initialization of our random number generator.


INFO

protected static final java.lang.String INFO
Descriptive information about this implementation.

See Also:
Constant Field Values

random

protected java.util.Random random
A random number generator to use when generating session identifiers.


randomClass

protected java.lang.String randomClass
The Java class name of the random number generator class to be used when generating session identifiers.


STRING_MANAGER

protected static final org.apache.catalina.util.StringManager STRING_MANAGER
The string manager for this package.

Constructor Detail

AuthenticatorBase

public AuthenticatorBase()
Method Detail

getAlgorithm

public java.lang.String getAlgorithm()
Return the message digest algorithm for this Manager.


setAlgorithm

public void setAlgorithm(java.lang.String algorithm)
Set the message digest algorithm for this Manager.

Parameters:
algorithm - The new message digest algorithm

getCache

public boolean getCache()
Return the cache authenticated Principals flag.


setCache

public void setCache(boolean cache)
Set the cache authenticated Principals flag.

Parameters:
cache - The new cache flag

getEntropy

public java.lang.String getEntropy()
Return the entropy increaser value, or compute a semi-useful value if this String has not yet been set.


setEntropy

public void setEntropy(java.lang.String entropy)
Set the entropy increaser value.

Parameters:
entropy - The new entropy increaser value

getInfo

public java.lang.String getInfo()
Return descriptive information about this Valve implementation.


getRandomClass

public java.lang.String getRandomClass()
Return the random number generator class name.


setRandomClass

public void setRandomClass(java.lang.String randomClass)
Set the random number generator class name.

Parameters:
randomClass - The new random number generator class name

authenticate

protected abstract boolean authenticate(SipServletRequestImpl request,
                                        SipServletResponseImpl response,
                                        SipLoginConfig config)
                                 throws java.io.IOException
Authenticate the user making this request, based on the specified login configuration. Return true if any specified constraint has been satisfied, or false if we have created a response challenge already.

Parameters:
request - Request we are processing
response - Response we are creating
config - Login configuration describing how authentication should be performed
Throws:
java.io.IOException - if an input/output error occurs

getDigest

protected java.security.MessageDigest getDigest()
Return the MessageDigest object to be used for calculating session identifiers. If none has been created yet, initialize one the first time this method is called.


getRandom

protected java.util.Random getRandom()
Return the random number generator instance we should use for generating session identifiers. If there is no such generator currently defined, construct and seed a new one.


register

protected void register(SipServletRequestImpl request,
                        SipServletResponseImpl response,
                        java.security.Principal principal,
                        java.lang.String authType,
                        java.lang.String username,
                        java.lang.String password)
Register an authenticated Principal and authentication type in our request, in the current session (if there is one), and with our SingleSignOn valve, if there is one. Set the appropriate cookie to be returned.

Parameters:
request - The servlet request we are processing
response - The servlet response we are generating
principal - The authenticated Principal to be registered
authType - The authentication type to be registered
username - Username used to authenticate (if any)
password - Password used to authenticate (if any)

getContext

public org.apache.catalina.Context getContext()

setContext

public void setContext(org.apache.catalina.Context context)


Copyright © 2010. All Rights Reserved.