Examples of ExtendedResponseProtocolOp


Examples of org.nasutekds.server.protocols.ldap.ExtendedResponseProtocolOp

    }


    // Get the extended response and see if it has the "notice of disconnection"
    // OID.  If so, then the server is closing the connection.
    ExtendedResponseProtocolOp extendedResponse =
         responseMessage.getExtendedResponseProtocolOp();
    String responseOID = extendedResponse.getOID();
    if ((responseOID != null) &&
        responseOID.equals(OID_NOTICE_OF_DISCONNECTION))
    {
      Message message = ERR_LDAPAUTH_SERVER_DISCONNECT.get(
          extendedResponse.getResultCode(), extendedResponse.getErrorMessage());
      throw new LDAPException(extendedResponse.getResultCode(), message);
    }


    // It isn't a notice of disconnection so it must be the "Who Am I?"
    // response and the value would be the authorization ID.  However, first
    // check that it was successful.  If it was not, then fail.
    int resultCode = extendedResponse.getResultCode();
    if (resultCode != LDAPResultCode.SUCCESS)
    {
      Message message = ERR_LDAPAUTH_WHOAMI_FAILED.get();
      throw new LDAPException(resultCode, extendedResponse.getErrorMessage(),
                              message, extendedResponse.getMatchedDN(),
                              null);
    }


    // Get the authorization ID (if there is one) and return it to the caller.
    ByteString authzID = extendedResponse.getValue();
    if ((authzID == null) || (authzID.length() == 0))
    {
      return null;
    }
View Full Code Here

Examples of org.nasutekds.server.protocols.ldap.ExtendedResponseProtocolOp

        {
          // It is possible that this is extended response.
          if (responseMessage.getProtocolOpType() ==
              LDAPConstants.OP_TYPE_EXTENDED_RESPONSE)
          {
            ExtendedResponseProtocolOp extRes =
              responseMessage.getExtendedResponseProtocolOp();
            resultCode = extRes.getResultCode();
            errorMessage = extRes.getErrorMessage();
            matchedDN = extRes.getMatchedDN();
            referralURLs = extRes.getReferralURLs();
          }
          else
          {
            // This shouldnt happen but if it does debug
            // log it, set the error code to OTHER and
View Full Code Here

Examples of org.nasutekds.server.protocols.ldap.ExtendedResponseProtocolOp

        {
          TRACER.debugCaught(DebugLogLevel.ERROR, ex1);
        }
        throw new LDAPConnectionException(Message.raw(ex1.getMessage()), ex1);
      }
      ExtendedResponseProtocolOp res = msg.getExtendedResponseProtocolOp();
      resultCode = res.getResultCode();
      if(resultCode != SUCCESS)
      {
        throw new LDAPConnectionException(res.getErrorMessage(),
                                          resultCode,
                                          res.getErrorMessage(),
                                          res.getMatchedDN(), null);
      }
    }
    SSLConnectionFactory sslConnectionFactory =
                         connectionOptions.getSSLConnectionFactory();
    try
View Full Code Here

Examples of org.nasutekds.server.protocols.ldap.ExtendedResponseProtocolOp

      return 1;
    }


    // Make sure that the response was acceptable.
    ExtendedResponseProtocolOp extendedResponse =
         responseMessage.getExtendedResponseProtocolOp();
    int resultCode = extendedResponse.getResultCode();
    if (resultCode != LDAPResultCode.SUCCESS)
    {
      Message message = ERR_LDAPPWMOD_FAILED.get(resultCode);
      err.println(wrapText(message, MAX_LINE_WIDTH));

      Message errorMessage = extendedResponse.getErrorMessage();
      if ((errorMessage != null) && (errorMessage.length() > 0))
      {

        message = ERR_LDAPPWMOD_FAILURE_ERROR_MESSAGE.get(errorMessage);
        err.println(wrapText(message, MAX_LINE_WIDTH));
      }

      DN matchedDN = extendedResponse.getMatchedDN();
      if (matchedDN != null)
      {

        message = ERR_LDAPPWMOD_FAILURE_MATCHED_DN.get(matchedDN.toString());
        err.println(wrapText(message, MAX_LINE_WIDTH));
      }

      try
      {
        requestMessage = new LDAPMessage(nextMessageID.getAndIncrement(),
                                         new UnbindRequestProtocolOp());
        writer.writeMessage(requestMessage);
      }
      catch (Exception e) {}

      try
      {
        reader.close();
        writer.close();
      } catch (Exception e) {}

      return resultCode;
    }
    else
    {
      Message message = INFO_LDAPPWMOD_SUCCESSFUL.get();
      out.println(wrapText(message, MAX_LINE_WIDTH));

      Message additionalInfo = extendedResponse.getErrorMessage();
      if ((additionalInfo != null) && (additionalInfo.length() > 0))
      {

        message = INFO_LDAPPWMOD_ADDITIONAL_INFO.get(additionalInfo);
        out.println(wrapText(message, MAX_LINE_WIDTH));
      }
    }


    // See if the response included any controls that we recognize, and if so
    // then handle them.
    List<Control> responseControls = responseMessage.getControls();
    if (responseControls != null)
    {
      for (Control c : responseControls)
      {
        if (c.getOID().equals(OID_PASSWORD_POLICY_CONTROL))
        {
          try
          {
            PasswordPolicyResponseControl pwPolicyControl =
              PasswordPolicyResponseControl.DECODER
                .decode(c.isCritical(), ((LDAPControl) c).getValue());

            PasswordPolicyWarningType pwPolicyWarningType =
                 pwPolicyControl.getWarningType();
            if (pwPolicyWarningType != null)
            {
              Message message = INFO_LDAPPWMOD_PWPOLICY_WARNING.get(
                      pwPolicyWarningType.toString(),
                      pwPolicyControl.getWarningValue());
              out.println(wrapText(message, MAX_LINE_WIDTH));
            }

            PasswordPolicyErrorType pwPolicyErrorType =
                 pwPolicyControl.getErrorType();
            if (pwPolicyErrorType != null)
            {
              Message message = INFO_LDAPPWMOD_PWPOLICY_ERROR.get(
                      pwPolicyErrorType.toString());
              out.println(wrapText(message, MAX_LINE_WIDTH));
            }
          }
          catch (Exception e)
          {
            Message message = ERR_LDAPPWMOD_CANNOT_DECODE_PWPOLICY_CONTROL.get(
                    String.valueOf(e));
            err.println(wrapText(message, MAX_LINE_WIDTH));
          }
        }
      }
    }


    // See if the response included a generated password.
    ByteString responseValue = extendedResponse.getValue();
    if (responseValue != null)
    {
      try
      {
        ASN1Reader asn1Reader = ASN1.getReader(responseValue);
View Full Code Here

Examples of org.nasutekds.server.protocols.ldap.ExtendedResponseProtocolOp

    // Normally, abandoned operations don't receive a response.  However, the
    // testing configuration has been updated to ensure that if an operation
    // does get abandoned, the server will return a response for it with a
    // result code of "cancelled".
    message = r.readMessage();
    ExtendedResponseProtocolOp extendedResponse =
         message.getExtendedResponseProtocolOp();
    assertEquals(extendedResponse.getResultCode(), LDAPResultCode.CANCELED);

    assertEquals(ldapStatistics.getAbandonRequests(), abandonRequests+1);
    waitForAbandon(abandonsCompleted+1);

    s.close();
View Full Code Here

Examples of org.nasutekds.server.protocols.ldap.ExtendedResponseProtocolOp

    LDAPMessage message = new LDAPMessage(nextMessageID.getAndIncrement(),
                                          extendedRequest, requestControls);
    writer.writeMessage(message);

    message = reader.readMessage();
    ExtendedResponseProtocolOp extendedResponse =
         message.getExtendedResponseProtocolOp();
    assertEquals(extendedResponse.getResultCode(), LDAPResultCode.SUCCESS);
    authzID = extendedResponse.getValue();
    assertNotNull(authzID);
    assertEquals(authzID.toString(), "dn:uid=test.user,o=test");


    // Close the connection to the server.
View Full Code Here

Examples of org.nasutekds.server.protocols.ldap.ExtendedResponseProtocolOp

    LDAPMessage message = new LDAPMessage(nextMessageID.getAndIncrement(),
                                          extendedRequest, requestControls);
    writer.writeMessage(message);

    message = reader.readMessage();
    ExtendedResponseProtocolOp extendedResponse =
         message.getExtendedResponseProtocolOp();
    assertEquals(extendedResponse.getResultCode(),
                 LDAPResultCode.AUTHORIZATION_DENIED);
    assertNull(extendedResponse.getValue());


    // Close the connection to the server.
    message = new LDAPMessage(nextMessageID.getAndIncrement(),
                              new UnbindRequestProtocolOp());
View Full Code Here

Examples of org.nasutekds.server.protocols.ldap.ExtendedResponseProtocolOp

      if (responseMessage.getProtocolOpType() ==
          LDAPConstants.OP_TYPE_EXTENDED_RESPONSE)
      {
        // It's possible that this is a notice of disconnection, which we can
        // probably interpret as a "success" in this case.
        ExtendedResponseProtocolOp extendedResponse =
             responseMessage.getExtendedResponseProtocolOp();
        String responseOID = extendedResponse.getOID();
        if ((responseOID != null) &&
            (responseOID.equals(LDAPConstants.OID_NOTICE_OF_DISCONNECTION)))
        {
          Message message = extendedResponse.getErrorMessage();
          if (message != null)
          {
            err.println(wrapText(message, MAX_LINE_WIDTH));
          }

          return extendedResponse.getResultCode();
        }
      }


      Message message = ERR_STOPDS_INVALID_RESPONSE_TYPE.get(
View Full Code Here

Examples of org.nasutekds.server.protocols.ldap.ExtendedResponseProtocolOp

          AddResponseProtocolOp addResponse =
               message.getAddResponseProtocolOp();
          assertEquals(addResponse.getResultCode(), LDAPResultCode.CANCELED);
          break;
        case OP_TYPE_EXTENDED_RESPONSE:
          ExtendedResponseProtocolOp extendedResponse =
               message.getExtendedResponseProtocolOp();
          assertEquals(extendedResponse.getResultCode(),
                       LDAPResultCode.CANCELED);
          break;
        default:
      }
    }
View Full Code Here

Examples of org.nasutekds.server.protocols.ldap.ExtendedResponseProtocolOp

               message.getCompareResponseProtocolOp();
          assertEquals(compareResponse.getResultCode(),
                       LDAPResultCode.CANCELED);
          break;
        case OP_TYPE_EXTENDED_RESPONSE:
          ExtendedResponseProtocolOp extendedResponse =
               message.getExtendedResponseProtocolOp();
          assertEquals(extendedResponse.getResultCode(),
                       LDAPResultCode.CANCELED);
          break;
        default:
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.