org.opends.server.extensions
Class PlainSASLMechanismHandler

java.lang.Object
  extended by org.opends.server.api.SASLMechanismHandler<PlainSASLMechanismHandlerCfg>
      extended by org.opends.server.extensions.PlainSASLMechanismHandler
All Implemented Interfaces:
ConfigurationChangeListener<PlainSASLMechanismHandlerCfg>

public class PlainSASLMechanismHandler
extends SASLMechanismHandler<PlainSASLMechanismHandlerCfg>
implements ConfigurationChangeListener<PlainSASLMechanismHandlerCfg>

This class provides an implementation of a SASL mechanism that uses plain-text authentication. It is based on the proposal defined in draft-ietf-sasl-plain-08 in which the SASL credentials are in the form:

[authzid] UTF8NULL authcid UTF8NULL passwd

Note that this is a weak mechanism by itself and does not offer any protection for the password, so it may need to be used in conjunction with a connection security provider to prevent exposing the password.


Constructor Summary
PlainSASLMechanismHandler()
          Creates a new instance of this SASL mechanism handler.
 
Method Summary
 ConfigChangeResult applyConfigurationChange(PlainSASLMechanismHandlerCfg configuration)
          Applies the configuration changes to this change listener.
 void finalizeSASLMechanismHandler()
          Performs any finalization that may be necessary for this SASL mechanism handler.
 void initializeSASLMechanismHandler(PlainSASLMechanismHandlerCfg configuration)
          Initializes this SASL mechanism handler based on the information in the provided configuration entry.
 boolean isConfigurationAcceptable(SASLMechanismHandlerCfg configuration, java.util.List<Message> unacceptableReasons)
          Indicates whether the provided configuration is acceptable for this SASL mechanism handler.
 boolean isConfigurationChangeAcceptable(PlainSASLMechanismHandlerCfg configuration, java.util.List<Message> unacceptableReasons)
          Indicates whether the proposed change to the configuration is acceptable to this change listener.
 boolean isPasswordBased(java.lang.String mechanism)
          Indicates whether the specified SASL mechanism is password-based or uses some other form of credentials (e.g., an SSL client certificate or Kerberos ticket).
 boolean isSecure(java.lang.String mechanism)
          Indicates whether the specified SASL mechanism should be considered secure (i.e., it does not expose the authentication credentials in a manner that is useful to a third-party observer, and other aspects of the authentication are generally secure).
 void processSASLBind(BindOperation bindOperation)
          Processes the SASL bind operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlainSASLMechanismHandler

public PlainSASLMechanismHandler()
Creates a new instance of this SASL mechanism handler. No initialization should be done in this method, as it should all be performed in the initializeSASLMechanismHandler method.

Method Detail

initializeSASLMechanismHandler

public void initializeSASLMechanismHandler(PlainSASLMechanismHandlerCfg configuration)
                                    throws ConfigException,
                                           InitializationException
Initializes this SASL mechanism handler based on the information in the provided configuration entry. It should also register itself with the Directory Server for the particular kinds of SASL mechanisms that it will process.

Specified by:
initializeSASLMechanismHandler in class SASLMechanismHandler<PlainSASLMechanismHandlerCfg>
Parameters:
configuration - The configuration to use to initialize this SASL mechanism handler.
Throws:
ConfigException - If an unrecoverable problem arises in the process of performing the initialization.
InitializationException - If a problem occurs during initialization that is not related to the server configuration.

finalizeSASLMechanismHandler

public void finalizeSASLMechanismHandler()
Performs any finalization that may be necessary for this SASL mechanism handler. By default, no finalization is performed.

Overrides:
finalizeSASLMechanismHandler in class SASLMechanismHandler<PlainSASLMechanismHandlerCfg>

processSASLBind

public void processSASLBind(BindOperation bindOperation)
Processes the SASL bind operation. SASL mechanism implementations must ensure that the following actions are taken during the processing of this method:

Specified by:
processSASLBind in class SASLMechanismHandler<PlainSASLMechanismHandlerCfg>
Parameters:
bindOperation - The SASL bind operation to be processed.

isPasswordBased

public boolean isPasswordBased(java.lang.String mechanism)
Indicates whether the specified SASL mechanism is password-based or uses some other form of credentials (e.g., an SSL client certificate or Kerberos ticket).

Specified by:
isPasswordBased in class SASLMechanismHandler<PlainSASLMechanismHandlerCfg>
Parameters:
mechanism - The name of the mechanism for which to make the determination. This will only be invoked with names of mechanisms for which this handler has previously registered.
Returns:
true if this SASL mechanism is password-based, or false if it uses some other form of credentials.

isSecure

public boolean isSecure(java.lang.String mechanism)
Indicates whether the specified SASL mechanism should be considered secure (i.e., it does not expose the authentication credentials in a manner that is useful to a third-party observer, and other aspects of the authentication are generally secure).

Specified by:
isSecure in class SASLMechanismHandler<PlainSASLMechanismHandlerCfg>
Parameters:
mechanism - The name of the mechanism for which to make the determination. This will only be invoked with names of mechanisms for which this handler has previously registered.
Returns:
true if this SASL mechanism should be considered secure, or false if not.

isConfigurationAcceptable

public boolean isConfigurationAcceptable(SASLMechanismHandlerCfg configuration,
                                         java.util.List<Message> unacceptableReasons)
Indicates whether the provided configuration is acceptable for this SASL mechanism handler. It should be possible to call this method on an uninitialized SASL mechanism handler instance in order to determine whether the SASL mechanism handler would be able to use the provided configuration.

Note that implementations which use a subclass of the provided configuration class will likely need to cast the configuration to the appropriate subclass type.

Overrides:
isConfigurationAcceptable in class SASLMechanismHandler<PlainSASLMechanismHandlerCfg>
Parameters:
configuration - The SASL mechanism handler configuration for which to make the determination.
unacceptableReasons - A list that may be used to hold the reasons that the provided configuration is not acceptable.
Returns:
true if the provided configuration is acceptable for this SASL mechanism handler, or false if not.

isConfigurationChangeAcceptable

public boolean isConfigurationChangeAcceptable(PlainSASLMechanismHandlerCfg configuration,
                                               java.util.List<Message> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.

Specified by:
isConfigurationChangeAcceptable in interface ConfigurationChangeListener<PlainSASLMechanismHandlerCfg>
Parameters:
configuration - The new configuration containing the changes.
unacceptableReasons - A list that can be used to hold messages about why the provided configuration is not acceptable.
Returns:
Returns true if the proposed change is acceptable, or false if it is not.

applyConfigurationChange

public ConfigChangeResult applyConfigurationChange(PlainSASLMechanismHandlerCfg configuration)
Applies the configuration changes to this change listener.

Specified by:
applyConfigurationChange in interface ConfigurationChangeListener<PlainSASLMechanismHandlerCfg>
Parameters:
configuration - The new configuration containing the changes.
Returns:
Returns information about the result of changing the configuration.