org.apache.commons.net.imap
Class AuthenticatingIMAPClient

java.lang.Object
  extended by org.apache.commons.net.SocketClient
      extended by org.apache.commons.net.imap.IMAP
          extended by org.apache.commons.net.imap.IMAPClient
              extended by org.apache.commons.net.imap.IMAPSClient
                  extended by org.apache.commons.net.imap.AuthenticatingIMAPClient

public class AuthenticatingIMAPClient
extends IMAPSClient

An IMAP Client class with authentication support.

See Also:
IMAPSClient

Nested Class Summary
static class AuthenticatingIMAPClient.AUTH_METHOD
          The enumeration of currently-supported authentication methods.
 
Nested classes/interfaces inherited from class org.apache.commons.net.imap.IMAPClient
IMAPClient.FETCH_ITEM_NAMES, IMAPClient.SEARCH_CRITERIA, IMAPClient.STATUS_DATA_ITEMS
 
Nested classes/interfaces inherited from class org.apache.commons.net.imap.IMAP
IMAP.IMAPState
 
Field Summary
 
Fields inherited from class org.apache.commons.net.imap.IMAPSClient
DEFAULT_IMAPS_PORT, DEFAULT_PROTOCOL
 
Fields inherited from class org.apache.commons.net.imap.IMAP
__DEFAULT_ENCODING, __writer, _reader, DEFAULT_PORT
 
Fields inherited from class org.apache.commons.net.SocketClient
_defaultPort_, _input_, _output_, _serverSocketFactory_, _socket_, _socketFactory_, _timeout_, connectTimeout, NETASCII_EOL
 
Constructor Summary
AuthenticatingIMAPClient()
          Constructor for AuthenticatingIMAPClient that delegates to IMAPSClient.
AuthenticatingIMAPClient(boolean implicit)
          Constructor for AuthenticatingIMAPClient that delegates to IMAPSClient.
AuthenticatingIMAPClient(boolean implicit, SSLContext ctx)
          Constructor for AuthenticatingIMAPClient that delegates to IMAPSClient.
AuthenticatingIMAPClient(SSLContext context)
          Constructor for AuthenticatingIMAPClient that delegates to IMAPSClient.
AuthenticatingIMAPClient(String proto)
          Constructor for AuthenticatingIMAPClient that delegates to IMAPSClient.
AuthenticatingIMAPClient(String proto, boolean implicit)
          Constructor for AuthenticatingIMAPClient that delegates to IMAPSClient.
AuthenticatingIMAPClient(String proto, boolean implicit, SSLContext ctx)
          Constructor for AuthenticatingIMAPClient that delegates to IMAPSClient.
 
Method Summary
 boolean auth(AuthenticatingIMAPClient.AUTH_METHOD method, String username, String password)
          Authenticate to the IMAP server by sending the AUTHENTICATE command with the selected mechanism, using the given username and the given password.
 boolean authenticate(AuthenticatingIMAPClient.AUTH_METHOD method, String username, String password)
          Authenticate to the IMAP server by sending the AUTHENTICATE command with the selected mechanism, using the given username and the given password.
 
Methods inherited from class org.apache.commons.net.imap.IMAPSClient
_connectAction_, execTLS, getEnabledCipherSuites, getEnabledProtocols, getTrustManager, setEnabledCipherSuites, setEnabledProtocols, setKeyManager, setTrustManager
 
Methods inherited from class org.apache.commons.net.imap.IMAPClient
append, append, capability, check, close, copy, create, delete, examine, expunge, fetch, list, login, logout, lsub, noop, rename, search, search, select, status, store, subscribe, uid, unsubscribe
 
Methods inherited from class org.apache.commons.net.imap.IMAP
disconnect, doCommand, doCommand, generateCommandID, getReplyString, getReplyStrings, getState, sendCommand, sendCommand, sendCommand, sendCommand, sendData, setState
 
Methods inherited from class org.apache.commons.net.SocketClient
addProtocolCommandListener, connect, connect, connect, connect, connect, connect, createCommandSupport, fireCommandSent, fireReplyReceived, getCommandSupport, getConnectTimeout, getDefaultPort, getDefaultTimeout, getKeepAlive, getLocalAddress, getLocalPort, getProxy, getReceiveBufferSize, getRemoteAddress, getRemotePort, getSendBufferSize, getServerSocketFactory, getSoLinger, getSoTimeout, getTcpNoDelay, isAvailable, isConnected, removeProtocolCommandListener, setConnectTimeout, setDefaultPort, setDefaultTimeout, setKeepAlive, setProxy, setReceiveBufferSize, setSendBufferSize, setServerSocketFactory, setSocketFactory, setSoLinger, setSoTimeout, setTcpNoDelay, verifyRemote
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthenticatingIMAPClient

public AuthenticatingIMAPClient()
Constructor for AuthenticatingIMAPClient that delegates to IMAPSClient. Sets security mode to explicit (isImplicit = false).


AuthenticatingIMAPClient

public AuthenticatingIMAPClient(boolean implicit)
Constructor for AuthenticatingIMAPClient that delegates to IMAPSClient.

Parameters:
implicit - The security mode (Implicit/Explicit).

AuthenticatingIMAPClient

public AuthenticatingIMAPClient(String proto)
Constructor for AuthenticatingIMAPClient that delegates to IMAPSClient.

Parameters:
proto - the protocol.

AuthenticatingIMAPClient

public AuthenticatingIMAPClient(String proto,
                                boolean implicit)
Constructor for AuthenticatingIMAPClient that delegates to IMAPSClient.

Parameters:
proto - the protocol.
implicit - The security mode(Implicit/Explicit).

AuthenticatingIMAPClient

public AuthenticatingIMAPClient(String proto,
                                boolean implicit,
                                SSLContext ctx)
Constructor for AuthenticatingIMAPClient that delegates to IMAPSClient.

Parameters:
proto - the protocol.
implicit - The security mode(Implicit/Explicit).

AuthenticatingIMAPClient

public AuthenticatingIMAPClient(boolean implicit,
                                SSLContext ctx)
Constructor for AuthenticatingIMAPClient that delegates to IMAPSClient.

Parameters:
implicit - The security mode(Implicit/Explicit).
ctx - A pre-configured SSL Context.

AuthenticatingIMAPClient

public AuthenticatingIMAPClient(SSLContext context)
Constructor for AuthenticatingIMAPClient that delegates to IMAPSClient.

Parameters:
context - A pre-configured SSL Context.
Method Detail

authenticate

public boolean authenticate(AuthenticatingIMAPClient.AUTH_METHOD method,
                            String username,
                            String password)
                     throws IOException,
                            NoSuchAlgorithmException,
                            InvalidKeyException,
                            InvalidKeySpecException
Authenticate to the IMAP server by sending the AUTHENTICATE command with the selected mechanism, using the given username and the given password.

Returns:
True if successfully completed, false if not.
Throws:
IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
NoSuchAlgorithmException - If the CRAM hash algorithm cannot be instantiated by the Java runtime system.
InvalidKeyException - If the CRAM hash algorithm failed to use the given password.
InvalidKeySpecException - If the CRAM hash algorithm failed to use the given password.

auth

public boolean auth(AuthenticatingIMAPClient.AUTH_METHOD method,
                    String username,
                    String password)
             throws IOException,
                    NoSuchAlgorithmException,
                    InvalidKeyException,
                    InvalidKeySpecException
Authenticate to the IMAP server by sending the AUTHENTICATE command with the selected mechanism, using the given username and the given password.

Returns:
True if successfully completed, false if not.
Throws:
IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
NoSuchAlgorithmException - If the CRAM hash algorithm cannot be instantiated by the Java runtime system.
InvalidKeyException - If the CRAM hash algorithm failed to use the given password.
InvalidKeySpecException - If the CRAM hash algorithm failed to use the given password.


Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.