001/*
002 * Copyright 2012-2014 UnboundID Corp.
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2012-2014 UnboundID Corp.
007 *
008 * This program is free software; you can redistribute it and/or modify
009 * it under the terms of the GNU General Public License (GPLv2 only)
010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
011 * as published by the Free Software Foundation.
012 *
013 * This program is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016 * GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with this program; if not, see <http://www.gnu.org/licenses>.
020 */
021package com.unboundid.ldap.sdk;
022
023
024
025import com.unboundid.asn1.ASN1OctetString;
026import com.unboundid.util.NotMutable;
027import com.unboundid.util.ThreadSafety;
028import com.unboundid.util.ThreadSafetyLevel;
029
030
031
032/**
033 * This class defines an exception that can be thrown if the server sends a bind
034 * response with a result code of {@link ResultCode#SASL_BIND_IN_PROGRESS},
035 * which indicates that SASL bind processing has not yet completed.  This is not
036 * an error, but neither does it indicate that bind processing has completed.
037 * This exception provides access to the bind result and the server SASL
038 * credentials that it may optionally contain so that this information may be
039 * used to continue bind processing.
040 */
041@NotMutable()
042@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
043public final class SASLBindInProgressException
044       extends LDAPException
045{
046  /**
047   * The serial version UID for this serializable class.
048   */
049  private static final long serialVersionUID = 2842513438320459264L;
050
051
052
053  // The bind result for this exception.
054  private final BindResult bindResult;
055
056
057
058  /**
059   * Creates a new SASL bind in progress exception from the provided bind
060   * result.
061   *
062   * @param  bindResult  The bind result to use to create this exception.
063   */
064  SASLBindInProgressException(final BindResult bindResult)
065  {
066    super(bindResult);
067
068    this.bindResult = bindResult;
069  }
070
071
072
073  /**
074   * Retrieves the bind result that was returned by the server.
075   *
076   * @return  The bind result that was returned by the server.
077   */
078  public BindResult getBindResult()
079  {
080    return bindResult;
081  }
082
083
084
085  /**
086   * Retrieves the server SASL credentials included in the bind result, if any.
087   *
088   * @return  The server SASL credentials included in the bind result, or
089   *          {@code null} if the bind result did not include any server SASL
090   *          credentials.
091   */
092  public ASN1OctetString getServerSASLCredentials()
093  {
094    return bindResult.getServerSASLCredentials();
095  }
096}