mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

neil_a_wilson
04.55.2007 4893e6fa252c6524fc1834e1ed120899304b09e1
Update the default access logger to provide additional more information in some
cases:

- If proxied authorization is used, then provide the proxied authorization DN.

- For successful bind operations, print the authentication (and optionally,
authorization) DNs.

- For all operations, if an additional log message is available, then include
it.
7 files modified
388 ■■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/core/AddOperation.java 58 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/CompareOperation.java 59 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/DeleteOperation.java 34 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/ModifyDNOperation.java 37 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperation.java 34 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/SearchOperation.java 34 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/loggers/TextAccessLogPublisher.java 132 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/AddOperation.java
@@ -127,6 +127,9 @@
  // The processed DN of the entry to add.
  private DN entryDN;
  // The proxied authorization target DN for this operation.
  private DN proxiedAuthorizationDN;
  // The entry being added to the server.
  private Entry entry;
@@ -180,14 +183,15 @@
    this.rawEntryDN    = rawEntryDN;
    this.rawAttributes = rawAttributes;
    responseControls      = new ArrayList<Control>();
    cancelRequest         = null;
    entry                 = null;
    entryDN               = null;
    userAttributes        = null;
    operationalAttributes = null;
    objectClasses         = null;
    changeNumber          = -1;
    responseControls       = new ArrayList<Control>();
    cancelRequest          = null;
    entry                  = null;
    entryDN                = null;
    userAttributes         = null;
    operationalAttributes  = null;
    objectClasses          = null;
    proxiedAuthorizationDN = null;
    changeNumber           = -1;
  }
@@ -252,9 +256,10 @@
      }
    }
    responseControls = new ArrayList<Control>();
    cancelRequest    = null;
    changeNumber     = -1;
    responseControls       = new ArrayList<Control>();
    proxiedAuthorizationDN = null;
    cancelRequest          = null;
    changeNumber           = -1;
  }
@@ -697,6 +702,21 @@
  /**
   * Retrieves the proxied authorization DN for this operation if proxied
   * authorization has been requested.
   *
   * @return  The proxied authorization DN for this operation if proxied
   *          authorization has been requested, or {@code null} if proxied
   *          authorization has not been requested.
   */
  public DN getProxiedAuthorizationDN()
  {
    return proxiedAuthorizationDN;
  }
  /**
   * {@inheritDoc}
   */
  @Override()
@@ -1778,6 +1798,14 @@
                break addProcessing;
              }
              setAuthorizationEntry(authorizationEntry);
              if (authorizationEntry == null)
              {
                proxiedAuthorizationDN = DN.nullDN();
              }
              else
              {
                proxiedAuthorizationDN = authorizationEntry.getDN();
              }
            }
            else if (oid.equals(OID_PROXIED_AUTH_V2))
            {
@@ -1848,6 +1876,14 @@
                break addProcessing;
              }
              setAuthorizationEntry(authorizationEntry);
              if (authorizationEntry == null)
              {
                proxiedAuthorizationDN = DN.nullDN();
              }
              else
              {
                proxiedAuthorizationDN = authorizationEntry.getDN();
              }
            }
            // NYI -- Add support for additional controls.
opendj-sdk/opends/src/server/org/opends/server/core/CompareOperation.java
@@ -88,9 +88,6 @@
       implements PreParseCompareOperation, PreOperationCompareOperation,
                  PostOperationCompareOperation, PostResponseCompareOperation
{
  // The attribute type for this compare operation.
  private AttributeType attributeType;
@@ -106,6 +103,9 @@
  // The DN of the entry for the compare operation.
  private DN entryDN;
  // The proxied authorization target DN for this operation.
  private DN proxiedAuthorizationDN;
  // The entry to be compared.
  private Entry entry;
@@ -150,11 +150,12 @@
    this.rawAttributeType = rawAttributeType;
    this.assertionValue   = assertionValue;
    responseControls = new ArrayList<Control>();
    entry            = null;
    entryDN          = null;
    attributeType    = null;
    cancelRequest    = null;
    responseControls       = new ArrayList<Control>();
    entry                  = null;
    entryDN                = null;
    attributeType          = null;
    cancelRequest          = null;
    proxiedAuthorizationDN = null;
  }
@@ -184,11 +185,12 @@
    this.attributeType  = attributeType;
    this.assertionValue = assertionValue;
    responseControls = new ArrayList<Control>();
    rawEntryDN       = new ASN1OctetString(entryDN.toString());
    rawAttributeType = attributeType.getNameOrOID();
    cancelRequest    = null;
    entry            = null;
    responseControls       = new ArrayList<Control>();
    rawEntryDN             = new ASN1OctetString(entryDN.toString());
    rawAttributeType       = attributeType.getNameOrOID();
    cancelRequest          = null;
    entry                  = null;
    proxiedAuthorizationDN = null;
  }
@@ -473,6 +475,21 @@
  /**
   * Retrieves the proxied authorization DN for this operation if proxied
   * authorization has been requested.
   *
   * @return  The proxied authorization DN for this operation if proxied
   *          authorization has been requested, or {@code null} if proxied
   *          authorization has not been requested.
   */
  public DN getProxiedAuthorizationDN()
  {
    return proxiedAuthorizationDN;
  }
  /**
   * {@inheritDoc}
   */
  @Override()
@@ -837,6 +854,14 @@
                break compareProcessing;
              }
              setAuthorizationEntry(authorizationEntry);
              if (authorizationEntry == null)
              {
                proxiedAuthorizationDN = DN.nullDN();
              }
              else
              {
                proxiedAuthorizationDN = authorizationEntry.getDN();
              }
            }
            else if (oid.equals(OID_PROXIED_AUTH_V2))
            {
@@ -907,6 +932,14 @@
                break compareProcessing;
              }
              setAuthorizationEntry(authorizationEntry);
              if (authorizationEntry == null)
              {
                proxiedAuthorizationDN = DN.nullDN();
              }
              else
              {
                proxiedAuthorizationDN = authorizationEntry.getDN();
              }
            }
            // NYI -- Add support for additional controls.
opendj-sdk/opends/src/server/org/opends/server/core/DeleteOperation.java
@@ -106,6 +106,9 @@
  // The DN of the entry for the delete operation.
  private DN entryDN;
  // The proxied authorization target DN for this operation.
  private DN proxiedAuthorizationDN;
  // The entry to be deleted.
  private Entry entry;
@@ -423,6 +426,21 @@
  /**
   * Retrieves the proxied authorization DN for this operation if proxied
   * authorization has been requested.
   *
   * @return  The proxied authorization DN for this operation if proxied
   *          authorization has been requested, or {@code null} if proxied
   *          authorization has not been requested.
   */
  public DN getProxiedAuthorizationDN()
  {
    return proxiedAuthorizationDN;
  }
  /**
   * {@inheritDoc}
   */
  @Override()
@@ -830,6 +848,14 @@
                break deleteProcessing;
              }
              setAuthorizationEntry(authorizationEntry);
              if (authorizationEntry == null)
              {
                proxiedAuthorizationDN = DN.nullDN();
              }
              else
              {
                proxiedAuthorizationDN = authorizationEntry.getDN();
              }
            }
            else if (oid.equals(OID_PROXIED_AUTH_V2))
            {
@@ -900,6 +926,14 @@
              }
              setAuthorizationEntry(authorizationEntry);
              if (authorizationEntry == null)
              {
                proxiedAuthorizationDN = DN.nullDN();
              }
              else
              {
                proxiedAuthorizationDN = authorizationEntry.getDN();
              }
            }
            // NYI -- Add support for additional controls.
opendj-sdk/opends/src/server/org/opends/server/core/ModifyDNOperation.java
@@ -103,9 +103,6 @@
       implements PreParseModifyDNOperation, PreOperationModifyDNOperation,
                  PostOperationModifyDNOperation, PostResponseModifyDNOperation
{
  // Indicates whether to delete the old RDN value from the entry.
  private boolean deleteOldRDN;
@@ -129,6 +126,9 @@
  // The new parent for the entry.
  private DN newSuperior;
  // The proxied authorization target DN for this operation.
  private DN proxiedAuthorizationDN;
  // The current entry, before it is renamed.
  private Entry currentEntry;
@@ -681,6 +681,21 @@
  /**
   * Retrieves the proxied authorization DN for this operation if proxied
   * authorization has been requested.
   *
   * @return  The proxied authorization DN for this operation if proxied
   *          authorization has been requested, or {@code null} if proxied
   *          authorization has not been requested.
   */
  public DN getProxiedAuthorizationDN()
  {
    return proxiedAuthorizationDN;
  }
  /**
   * {@inheritDoc}
   */
  @Override()
@@ -1290,6 +1305,14 @@
                break modifyDNProcessing;
              }
              setAuthorizationEntry(authorizationEntry);
              if (authorizationEntry == null)
              {
                proxiedAuthorizationDN = DN.nullDN();
              }
              else
              {
                proxiedAuthorizationDN = authorizationEntry.getDN();
              }
            }
            else if (oid.equals(OID_PROXIED_AUTH_V2))
            {
@@ -1361,6 +1384,14 @@
              setAuthorizationEntry(authorizationEntry);
              if (authorizationEntry == null)
              {
                proxiedAuthorizationDN = DN.nullDN();
              }
              else
              {
                proxiedAuthorizationDN = authorizationEntry.getDN();
              }
            }
            // NYI -- Add support for additional controls.
opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperation.java
@@ -125,6 +125,9 @@
  // The DN of the entry for the modify operation.
  private DN entryDN;
  // The proxied authorization target DN for this operation.
  private DN proxiedAuthorizationDN;
  // The current entry, before any changes are applied.
  private Entry currentEntry;
@@ -613,6 +616,21 @@
  /**
   * Retrieves the proxied authorization DN for this operation if proxied
   * authorization has been requested.
   *
   * @return  The proxied authorization DN for this operation if proxied
   *          authorization has been requested, or {@code null} if proxied
   *          authorization has not been requested.
   */
  public DN getProxiedAuthorizationDN()
  {
    return proxiedAuthorizationDN;
  }
  /**
   * {@inheritDoc}
   */
  @Override()
@@ -1091,6 +1109,14 @@
              }
              setAuthorizationEntry(authorizationEntry);
              if (authorizationEntry == null)
              {
                proxiedAuthorizationDN = DN.nullDN();
              }
              else
              {
                proxiedAuthorizationDN = authorizationEntry.getDN();
              }
            }
            else if (oid.equals(OID_PROXIED_AUTH_V2))
            {
@@ -1161,6 +1187,14 @@
                break modifyProcessing;
              }
              setAuthorizationEntry(authorizationEntry);
              if (authorizationEntry == null)
              {
                proxiedAuthorizationDN = DN.nullDN();
              }
              else
              {
                proxiedAuthorizationDN = authorizationEntry.getDN();
              }
            }
            // NYI -- Add support for additional controls.
opendj-sdk/opends/src/server/org/opends/server/core/SearchOperation.java
@@ -133,6 +133,9 @@
  // The base DN for the search operation.
  private DN baseDN;
  // The proxied authorization target DN for this operation.
  private DN proxiedAuthorizationDN;
  // The number of entries that have been sent to the client.
  private int entriesSent;
@@ -1438,6 +1441,21 @@
  /**
   * Retrieves the proxied authorization DN for this operation if proxied
   * authorization has been requested.
   *
   * @return  The proxied authorization DN for this operation if proxied
   *          authorization has been requested, or {@code null} if proxied
   *          authorization has not been requested.
   */
  public DN getProxiedAuthorizationDN()
  {
    return proxiedAuthorizationDN;
  }
  /**
   * {@inheritDoc}
   */
  @Override()
@@ -1766,6 +1784,14 @@
              break searchProcessing;
            }
            setAuthorizationEntry(authorizationEntry);
            if (authorizationEntry == null)
            {
              proxiedAuthorizationDN = DN.nullDN();
            }
            else
            {
              proxiedAuthorizationDN = authorizationEntry.getDN();
            }
          }
          else if (oid.equals(OID_PROXIED_AUTH_V2))
          {
@@ -1837,6 +1863,14 @@
            }
            setAuthorizationEntry(authorizationEntry);
            if (authorizationEntry == null)
            {
              proxiedAuthorizationDN = DN.nullDN();
            }
            else
            {
              proxiedAuthorizationDN = authorizationEntry.getDN();
            }
          }
          else if (oid.equals(OID_PERSISTENT_SEARCH))
          {
opendj-sdk/opends/src/server/org/opends/server/loggers/TextAccessLogPublisher.java
@@ -529,6 +529,14 @@
      buffer.append("\"");
    }
    msg = abandonOperation.getAdditionalLogMessage();
    if ((msg != null) && (msg.length() > 0))
    {
      buffer.append(" additionalInfo=\"");
      buffer.append(msg);
      buffer.append("\"");
    }
    buffer.append(" etime=");
    buffer.append(abandonOperation.getProcessingTime());
@@ -602,6 +610,20 @@
      buffer.append(msg);
    }
    msg = addOperation.getAdditionalLogMessage();
    if ((msg != null) && (msg.length() > 0))
    {
      buffer.append("\" additionalInfo=\"");
      buffer.append(msg);
    }
    DN proxiedAuthDN = addOperation.getProxiedAuthorizationDN();
    if (proxiedAuthDN != null)
    {
      buffer.append("\" authzDN=\"");
      proxiedAuthDN.toString(buffer);
    }
    buffer.append("\" etime=");
    buffer.append(addOperation.getProcessingTime());
@@ -706,6 +728,37 @@
      }
    }
    msg = bindOperation.getAdditionalLogMessage();
    if ((msg != null) && (msg.length() > 0))
    {
      buffer.append("\" additionalInfo=\"");
      buffer.append(msg);
    }
    if (bindOperation.getResultCode() == ResultCode.SUCCESS)
    {
      AuthenticationInfo authInfo = bindOperation.getAuthenticationInfo();
      if (authInfo != null)
      {
        DN authDN = authInfo.getAuthenticationDN();
        buffer.append("\" authDN=\"");
        if (authDN != null)
        {
          authDN.toString(buffer);
          DN authzDN = authInfo.getAuthorizationDN();
          if (! authDN.equals(authzDN))
          {
            buffer.append("\" authzDN=\"");
            if (authzDN != null)
            {
              authzDN.toString(buffer);
            }
          }
        }
      }
    }
    buffer.append("\" etime=");
    buffer.append(bindOperation.getProcessingTime());
@@ -780,6 +833,20 @@
      buffer.append(msg);
    }
    msg = compareOperation.getAdditionalLogMessage();
    if ((msg != null) && (msg.length() > 0))
    {
      buffer.append("\" additionalInfo=\"");
      buffer.append(msg);
    }
    DN proxiedAuthDN = compareOperation.getProxiedAuthorizationDN();
    if (proxiedAuthDN != null)
    {
      buffer.append("\" authzDN=\"");
      proxiedAuthDN.toString(buffer);
    }
    buffer.append("\" etime=");
    buffer.append(compareOperation.getProcessingTime());
@@ -854,6 +921,20 @@
      buffer.append(msg);
    }
    msg = deleteOperation.getAdditionalLogMessage();
    if ((msg != null) && (msg.length() > 0))
    {
      buffer.append("\" additionalInfo=\"");
      buffer.append(msg);
    }
    DN proxiedAuthDN = deleteOperation.getProxiedAuthorizationDN();
    if (proxiedAuthDN != null)
    {
      buffer.append("\" authzDN=\"");
      proxiedAuthDN.toString(buffer);
    }
    buffer.append("\" etime=");
    buffer.append(deleteOperation.getProcessingTime());
@@ -938,6 +1019,13 @@
      buffer.append(msg);
    }
    msg = extendedOperation.getAdditionalLogMessage();
    if ((msg != null) && (msg.length() > 0))
    {
      buffer.append("\" additionalInfo=\"");
      buffer.append(msg);
    }
    buffer.append("\" etime=");
    buffer.append(extendedOperation.getProcessingTime());
@@ -1013,6 +1101,20 @@
      buffer.append(msg);
    }
    msg = modifyOperation.getAdditionalLogMessage();
    if ((msg != null) && (msg.length() > 0))
    {
      buffer.append("\" additionalInfo=\"");
      buffer.append(msg);
    }
    DN proxiedAuthDN = modifyOperation.getProxiedAuthorizationDN();
    if (proxiedAuthDN != null)
    {
      buffer.append("\" authzDN=\"");
      proxiedAuthDN.toString(buffer);
    }
    buffer.append("\" etime=");
    buffer.append(modifyOperation.getProcessingTime());
@@ -1099,6 +1201,20 @@
      buffer.append(msg);
    }
    msg = modifyDNOperation.getAdditionalLogMessage();
    if ((msg != null) && (msg.length() > 0))
    {
      buffer.append("\" additionalInfo=\"");
      buffer.append(msg);
    }
    DN proxiedAuthDN = modifyDNOperation.getProxiedAuthorizationDN();
    if (proxiedAuthDN != null)
    {
      buffer.append("\" authzDN=\"");
      proxiedAuthDN.toString(buffer);
    }
    buffer.append("\" etime=");
    buffer.append(modifyDNOperation.getProcessingTime());
@@ -1230,6 +1346,22 @@
    buffer.append("\" nentries=");
    buffer.append(searchOperation.getEntriesSent());
    msg = searchOperation.getAdditionalLogMessage();
    if ((msg != null) && (msg.length() > 0))
    {
      buffer.append(" additionalInfo=\"");
      buffer.append(msg);
      buffer.append("\"");
    }
    DN proxiedAuthDN = searchOperation.getProxiedAuthorizationDN();
    if (proxiedAuthDN != null)
    {
      buffer.append("\" authzDN=\"");
      proxiedAuthDN.toString(buffer);
    }
    buffer.append(" etime=");
    buffer.append(searchOperation.getProcessingTime());