org.apache.directory.server.core.interceptor.context
Class BindOperationContext

java.lang.Object
  extended by org.apache.directory.server.core.interceptor.context.BindOperationContext
All Implemented Interfaces:
OperationContext

public class BindOperationContext
extends java.lang.Object
implements OperationContext

A Bind context used for Interceptors. It contains all the informations needed for the bind operation, and used by all the interceptors

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Constructor Summary
BindOperationContext(CoreSession session)
          Creates a new instance of BindOperationContext.
 
Method Summary
 void add(org.apache.directory.shared.ldap.entry.ServerEntry entry, java.util.Collection<java.lang.String> bypass)
           
 void addRequestControl(org.apache.directory.shared.ldap.message.control.Control requestControl)
          Adds a request control to this operation.
 void addRequestControls(org.apache.directory.shared.ldap.message.control.Control[] requestControls)
          Adds many request controls to this operation.
 void addResponseControl(org.apache.directory.shared.ldap.message.control.Control responseControl)
          Adds a response control to this operation.
 void delete(org.apache.directory.shared.ldap.name.DN dn, java.util.Collection<java.lang.String> bypass)
           
 org.apache.directory.shared.ldap.constants.AuthenticationLevel getAuthenticationLevel()
           
 java.util.Collection<java.lang.String> getByPassed()
          Gets the set of bypassed Interceptors.
 byte[] getCredentials()
           
 org.apache.directory.shared.ldap.name.DN getDn()
           
 LdapPrincipal getEffectivePrincipal()
          Gets the effective principal for this operation which may not be the same as the authenticated principal when the session for this context has an explicit authorization id, or this operation was applied with the proxy authorization control.
 ClonedServerEntry getEntry()
          Gets the server entry associated with the target DN of this OperationContext.
 OperationContext getFirstOperation()
          Gets the first, direct operation issued against the DirectoryService.
 OperationContext getLastOperation()
          Gets the last, operation issued on the DirectoryService.
 java.lang.String getName()
           
 OperationContext getNextOperation()
          Gets the next, indirect operation issued on the DirectoryService.
 OperationContext getPreviousOperation()
          Gets the previous, operation issued on the DirectoryService.
 ReferralHandlingMode getReferralHandlingMode()
           
 org.apache.directory.shared.ldap.message.control.Control getRequestControl(java.lang.String numericOid)
          Gets a request control if present for this request.
 org.apache.directory.shared.ldap.message.control.Control getResponseControl(java.lang.String numericOid)
          Gets a response control if present for this request.
 int getResponseControlCount()
          Checks the number of response controls have been generated for this operation.
 org.apache.directory.shared.ldap.message.control.Control[] getResponseControls()
          Gets all the response controls producted during this operation.
 java.lang.String getSaslAuthId()
           
 java.lang.String getSaslMechanism()
           
 CoreSession getSession()
          Gets the session associated with this operation.
 boolean hasBypass()
          Checks to see if any Interceptors are bypassed by this operation.
 boolean hasEntry(org.apache.directory.shared.ldap.name.DN dn, java.util.Collection<java.lang.String> byPassed)
          Checks to see if an entry exists.
 boolean hasRequestControl(java.lang.String numericOid)
          Checks to see if a request control is present on this request.
 boolean hasRequestControls()
          Checks if any request controls exists for this operation.
 boolean hasResponseControl(java.lang.String numericOid)
          Checks to see if a response control is present on this operation.
 boolean hasResponseControls()
          Checks if any response controls have been generated for this operation.
 void ignoreReferral()
          Set the throwReferral flag to false
 boolean isBypassed(java.lang.String interceptorName)
          Checks to see if an Interceptor is bypassed for this operation.
 boolean isCollateralOperation()
          Tells if the current operation is considered a side effect of the current context
 boolean isFirstOperation()
          Checks to see if this operation is the first operation in a chain of operations performed on the DirectoryService.
 boolean isReferralIgnored()
          
 boolean isReferralThrown()
          
 boolean isSaslBind()
           
 ClonedServerEntry lookup(org.apache.directory.shared.ldap.name.DN dn, java.util.Collection<java.lang.String> byPassed)
           
 ClonedServerEntry lookup(LookupOperationContext opContext)
           
 void modify(org.apache.directory.shared.ldap.name.DN dn, java.util.List<org.apache.directory.shared.ldap.entry.Modification> mods, java.util.Collection<java.lang.String> bypass)
           
 LookupOperationContext newLookupContext(org.apache.directory.shared.ldap.name.DN dn)
           
 void setByPassed(java.util.Collection<java.lang.String> byPassed)
          Sets the set of bypassed Interceptors.
 void setCollateralOperation(boolean collateralOperation)
           
 void setCredentials(byte[] credentials)
           
 void setDn(org.apache.directory.shared.ldap.name.DN dn)
          Set the context DN
 void setEntry(ClonedServerEntry entry)
          Sets the server entry associated with the target DN of this OperationContext.
 void setReferralHandlingMode(ReferralHandlingMode referralHandlingMode)
           
 void setSaslAuthId(java.lang.String saslAuthId)
           
 void setSaslMechanism(java.lang.String saslMechanism)
           
 void setSession(CoreSession session)
           
 void throwReferral()
          Set the throwReferral flag to true
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BindOperationContext

public BindOperationContext(CoreSession session)
Creates a new instance of BindOperationContext.

Method Detail

getAuthenticationLevel

public org.apache.directory.shared.ldap.constants.AuthenticationLevel getAuthenticationLevel()
Returns:
The authentication level. One of :
  • ANONYMOUS
  • SIMPLE
  • STRONG (sasl)
  • UNAUTHENT
  • INVALID

  • getSaslMechanism

    public java.lang.String getSaslMechanism()
    Returns:
    the SASL mechanisms

    setSaslMechanism

    public void setSaslMechanism(java.lang.String saslMechanism)

    getCredentials

    public byte[] getCredentials()
    Returns:
    The principal password

    setCredentials

    public void setCredentials(byte[] credentials)

    getSaslAuthId

    public java.lang.String getSaslAuthId()
    Returns:
    The SASL authentication ID

    setSaslAuthId

    public void setSaslAuthId(java.lang.String saslAuthId)

    isSaslBind

    public boolean isSaslBind()

    getName

    public java.lang.String getName()
    Specified by:
    getName in interface OperationContext
    Returns:
    the operation name

    toString

    public java.lang.String toString()
    Overrides:
    toString in class java.lang.Object
    See Also:
    Object.toString()

    getSession

    public CoreSession getSession()
    Description copied from interface: OperationContext
    Gets the session associated with this operation.

    Specified by:
    getSession in interface OperationContext
    Returns:
    the session associated with this operation

    setSession

    public void setSession(CoreSession session)

    isCollateralOperation

    public boolean isCollateralOperation()
    Tells if the current operation is considered a side effect of the current context


    setCollateralOperation

    public void setCollateralOperation(boolean collateralOperation)

    getDn

    public org.apache.directory.shared.ldap.name.DN getDn()
    Specified by:
    getDn in interface OperationContext
    Returns:
    The associated DN

    setDn

    public void setDn(org.apache.directory.shared.ldap.name.DN dn)
    Set the context DN

    Specified by:
    setDn in interface OperationContext
    Parameters:
    dn - The DN to set

    addRequestControl

    public void addRequestControl(org.apache.directory.shared.ldap.message.control.Control requestControl)
    Description copied from interface: OperationContext
    Adds a request control to this operation.

    Specified by:
    addRequestControl in interface OperationContext
    Parameters:
    requestControl - the request control to add to this operation

    getRequestControl

    public org.apache.directory.shared.ldap.message.control.Control getRequestControl(java.lang.String numericOid)
    Description copied from interface: OperationContext
    Gets a request control if present for this request.

    Specified by:
    getRequestControl in interface OperationContext
    Parameters:
    numericOid - the numeric OID of the control also known as it's type OID
    Returns:
    the control if present

    hasRequestControl

    public boolean hasRequestControl(java.lang.String numericOid)
    Description copied from interface: OperationContext
    Checks to see if a request control is present on this request.

    Specified by:
    hasRequestControl in interface OperationContext
    Parameters:
    numericOid - the numeric OID of the control also known as it's type OID
    Returns:
    true if the control is associated with this operation, false otherwise

    hasRequestControls

    public boolean hasRequestControls()
    Description copied from interface: OperationContext
    Checks if any request controls exists for this operation.

    Specified by:
    hasRequestControls in interface OperationContext
    Returns:
    true if any request controls exist, false otherwise

    addResponseControl

    public void addResponseControl(org.apache.directory.shared.ldap.message.control.Control responseControl)
    Description copied from interface: OperationContext
    Adds a response control to this operation.

    Specified by:
    addResponseControl in interface OperationContext
    Parameters:
    responseControl - the response control to add to this operation

    getResponseControl

    public org.apache.directory.shared.ldap.message.control.Control getResponseControl(java.lang.String numericOid)
    Description copied from interface: OperationContext
    Gets a response control if present for this request.

    Specified by:
    getResponseControl in interface OperationContext
    Parameters:
    numericOid - the numeric OID of the control also known as it's type OID
    Returns:
    the control if present

    hasResponseControl

    public boolean hasResponseControl(java.lang.String numericOid)
    Description copied from interface: OperationContext
    Checks to see if a response control is present on this operation.

    Specified by:
    hasResponseControl in interface OperationContext
    Parameters:
    numericOid - the numeric OID of the control also known as it's type OID
    Returns:
    true if the control is associated with this operation, false otherwise

    getResponseControls

    public org.apache.directory.shared.ldap.message.control.Control[] getResponseControls()
    Description copied from interface: OperationContext
    Gets all the response controls producted during this operation.

    Specified by:
    getResponseControls in interface OperationContext
    Returns:
    an array over all the response controls

    hasResponseControls

    public boolean hasResponseControls()
    Description copied from interface: OperationContext
    Checks if any response controls have been generated for this operation.

    Specified by:
    hasResponseControls in interface OperationContext
    Returns:
    true if any response controls have been generated, false otherwise

    getResponseControlCount

    public int getResponseControlCount()
    Description copied from interface: OperationContext
    Checks the number of response controls have been generated for this operation.

    Specified by:
    getResponseControlCount in interface OperationContext
    Returns:
    the number of response controls that have been generated

    addRequestControls

    public void addRequestControls(org.apache.directory.shared.ldap.message.control.Control[] requestControls)
    Description copied from interface: OperationContext
    Adds many request controls to this operation.

    Specified by:
    addRequestControls in interface OperationContext
    Parameters:
    requestControls - the request controls to add to this operation

    getByPassed

    public java.util.Collection<java.lang.String> getByPassed()
    Gets the set of bypassed Interceptors.

    Specified by:
    getByPassed in interface OperationContext
    Returns:
    the set of bypassed Interceptors

    setByPassed

    public void setByPassed(java.util.Collection<java.lang.String> byPassed)
    Sets the set of bypassed Interceptors.

    Specified by:
    setByPassed in interface OperationContext
    Parameters:
    byPassed - the set of bypassed Interceptors

    isBypassed

    public boolean isBypassed(java.lang.String interceptorName)
    Checks to see if an Interceptor is bypassed for this operation.

    Specified by:
    isBypassed in interface OperationContext
    Parameters:
    interceptorName - the interceptorName of the Interceptor to check for bypass
    Returns:
    true if the Interceptor should be bypassed, false otherwise

    hasBypass

    public boolean hasBypass()
    Checks to see if any Interceptors are bypassed by this operation.

    Specified by:
    hasBypass in interface OperationContext
    Returns:
    true if at least one bypass exists

    newLookupContext

    public LookupOperationContext newLookupContext(org.apache.directory.shared.ldap.name.DN dn)
    Specified by:
    newLookupContext in interface OperationContext

    lookup

    public ClonedServerEntry lookup(LookupOperationContext opContext)
                             throws java.lang.Exception
    Specified by:
    lookup in interface OperationContext
    Throws:
    java.lang.Exception

    lookup

    public ClonedServerEntry lookup(org.apache.directory.shared.ldap.name.DN dn,
                                    java.util.Collection<java.lang.String> byPassed)
                             throws java.lang.Exception
    Specified by:
    lookup in interface OperationContext
    Throws:
    java.lang.Exception

    getEffectivePrincipal

    public LdapPrincipal getEffectivePrincipal()
    Description copied from interface: OperationContext
    Gets the effective principal for this operation which may not be the same as the authenticated principal when the session for this context has an explicit authorization id, or this operation was applied with the proxy authorization control.

    Specified by:
    getEffectivePrincipal in interface OperationContext
    Returns:
    the effective principal for this operation
    See Also:
    CoreSession.getAuthenticatedPrincipal(), CoreSession.getEffectivePrincipal()

    isFirstOperation

    public boolean isFirstOperation()
    Description copied from interface: OperationContext
    Checks to see if this operation is the first operation in a chain of operations performed on the DirectoryService. The first operation in a sequence of operations, is not a byproduct of another operation unlike operations following in the sequence. The other operations following the first, occur as a side effect to complete this first operation.

    Specified by:
    isFirstOperation in interface OperationContext
    Returns:
    true if the operation is the first, false otherwise

    getFirstOperation

    public OperationContext getFirstOperation()
    Description copied from interface: OperationContext
    Gets the first, direct operation issued against the DirectoryService.

    Specified by:
    getFirstOperation in interface OperationContext
    Returns:
    the first, direct operation issued

    getLastOperation

    public OperationContext getLastOperation()
    Description copied from interface: OperationContext
    Gets the last, operation issued on the DirectoryService.

    Specified by:
    getLastOperation in interface OperationContext
    Returns:
    the last, operation issued

    getNextOperation

    public OperationContext getNextOperation()
    Description copied from interface: OperationContext
    Gets the next, indirect operation issued on the DirectoryService.

    Specified by:
    getNextOperation in interface OperationContext
    Returns:
    the next, indirect operation issued

    getPreviousOperation

    public OperationContext getPreviousOperation()
    Description copied from interface: OperationContext
    Gets the previous, operation issued on the DirectoryService.

    Specified by:
    getPreviousOperation in interface OperationContext
    Returns:
    the previous, operation issued

    add

    public void add(org.apache.directory.shared.ldap.entry.ServerEntry entry,
                    java.util.Collection<java.lang.String> bypass)
             throws java.lang.Exception
    Specified by:
    add in interface OperationContext
    Throws:
    java.lang.Exception

    delete

    public void delete(org.apache.directory.shared.ldap.name.DN dn,
                       java.util.Collection<java.lang.String> bypass)
                throws java.lang.Exception
    Specified by:
    delete in interface OperationContext
    Throws:
    java.lang.Exception

    modify

    public void modify(org.apache.directory.shared.ldap.name.DN dn,
                       java.util.List<org.apache.directory.shared.ldap.entry.Modification> mods,
                       java.util.Collection<java.lang.String> bypass)
                throws java.lang.Exception
    Specified by:
    modify in interface OperationContext
    Throws:
    java.lang.Exception

    hasEntry

    public boolean hasEntry(org.apache.directory.shared.ldap.name.DN dn,
                            java.util.Collection<java.lang.String> byPassed)
                     throws java.lang.Exception
    Description copied from interface: OperationContext
    Checks to see if an entry exists.

    Specified by:
    hasEntry in interface OperationContext
    Parameters:
    dn - the distinguished name of the entry to check
    byPassed - collection of Interceptor's to bypass for this check
    Returns:
    true if the entry exists, false if it does not
    Throws:
    java.lang.Exception - on failure to perform this operation

    getReferralHandlingMode

    public ReferralHandlingMode getReferralHandlingMode()

    setReferralHandlingMode

    public void setReferralHandlingMode(ReferralHandlingMode referralHandlingMode)

    getEntry

    public ClonedServerEntry getEntry()
    Description copied from interface: OperationContext
    Gets the server entry associated with the target DN of this OperationContext. The entry associated with the DN may be altered during the course of processing an LDAP operation through the InterceptorChain. This place holder is put here to prevent the need for repetitive lookups of the target entry. Furthermore the returned entry may be altered by any Interceptor in the chain and this is why a ClonedServerEntry is returned instead of a ServerEntry. A ClonedServerEntry has an immutable reference to the original state of the target entry. The original state can be accessed via a call to ClonedServerEntry.getOriginalEntry(). The return value may be null in which case any lookup performed to access it may set it to prevent the need for subsequent lookups. Also note that during the course of handling some operations such as those that rename, move or rename and move the entry, may alter the DN of this entry. Interceptor implementors should not presume the DN or the values contained in this entry are currently what is present in the DIT. The original entry contained in the ClonedServerEntry shoudl be used as the definitive source of information about the state of the entry in the DIT before returning from the Partition subsystem.

    Specified by:
    getEntry in interface OperationContext
    Returns:
    target entry associated with the DN of this OperationContext

    setEntry

    public void setEntry(ClonedServerEntry entry)
    Description copied from interface: OperationContext
    Sets the server entry associated with the target DN of this OperationContext.

    Specified by:
    setEntry in interface OperationContext
    Parameters:
    entry - the entry whose DN is associated with this OperationContext.

    throwReferral

    public void throwReferral()
    Set the throwReferral flag to true

    Specified by:
    throwReferral in interface OperationContext

    isReferralThrown

    public boolean isReferralThrown()

    Specified by:
    isReferralThrown in interface OperationContext
    Returns:
    true if the referrals are thrown

    ignoreReferral

    public void ignoreReferral()
    Set the throwReferral flag to false

    Specified by:
    ignoreReferral in interface OperationContext

    isReferralIgnored

    public boolean isReferralIgnored()

    Specified by:
    isReferralIgnored in interface OperationContext
    Returns:
    true if the referrals are ignored


    Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.