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     */
021    package com.unboundid.ldap.sdk;
022    
023    
024    
025    import com.unboundid.asn1.ASN1OctetString;
026    
027    
028    
029    /**
030     * This class defines an exception that can be thrown if the server sends a bind
031     * response with a result code of {@code ResultCode#SASL_BIND_IN_PROGRESS},
032     * which indicates that SASL bind processing has not yet completed.  This is not
033     * an error, but neither does it indicate that bind processing has completed.
034     * This exception provides access to the bind result and the server SASL
035     * credentials that it may optionally contain so that this information may be
036     * used to continue bind processing.
037     */
038    public final class SASLBindInProgressException
039           extends LDAPException
040    {
041      /**
042       * The serial version UID for this serializable class.
043       */
044      private static final long serialVersionUID = 2842513438320459264L;
045    
046    
047    
048      // The bind result for this exception.
049      private final BindResult bindResult;
050    
051    
052    
053      /**
054       * Creates a new SASL bind in progress exception from the provided bind
055       * result.
056       *
057       * @param  bindResult  The bind result to use to create this exception.
058       */
059      SASLBindInProgressException(final BindResult bindResult)
060      {
061        super(bindResult);
062    
063        this.bindResult = bindResult;
064      }
065    
066    
067    
068      /**
069       * Retrieves the bind result that was returned by the server.
070       *
071       * @return  The bind result that was returned by the server.
072       */
073      public BindResult getBindResult()
074      {
075        return bindResult;
076      }
077    
078    
079    
080      /**
081       * Retrieves the server SASL credentials included in the bind result, if any.
082       *
083       * @return  The server SASL credentials included in the bind result, or
084       *          {@code null} if the bind result did not include any server SASL
085       *          credentials.
086       */
087      public ASN1OctetString getServerSASLCredentials()
088      {
089        return bindResult.getServerSASLCredentials();
090      }
091    }