Class AuthenticatingIMAPClient


  • public class AuthenticatingIMAPClient
    extends IMAPSClient
    An IMAP Client class with authentication support.
    See Also:
    IMAPSClient
    • 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​(java.lang.String proto)
        Constructor for AuthenticatingIMAPClient that delegates to IMAPSClient.
        Parameters:
        proto - the protocol.
      • AuthenticatingIMAPClient

        public AuthenticatingIMAPClient​(java.lang.String proto,
                                        boolean implicit)
        Constructor for AuthenticatingIMAPClient that delegates to IMAPSClient.
        Parameters:
        proto - the protocol.
        implicit - The security mode(Implicit/Explicit).
      • AuthenticatingIMAPClient

        public AuthenticatingIMAPClient​(java.lang.String proto,
                                        boolean implicit,
                                        javax.net.ssl.SSLContext ctx)
        Constructor for AuthenticatingIMAPClient that delegates to IMAPSClient.
        Parameters:
        proto - the protocol.
        implicit - The security mode(Implicit/Explicit).
        ctx - the context
      • AuthenticatingIMAPClient

        public AuthenticatingIMAPClient​(boolean implicit,
                                        javax.net.ssl.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​(javax.net.ssl.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,
                                    java.lang.String username,
                                    java.lang.String password)
                             throws java.io.IOException,
                                    java.security.NoSuchAlgorithmException,
                                    java.security.InvalidKeyException,
                                    java.security.spec.InvalidKeySpecException
        Authenticate to the IMAP server by sending the AUTHENTICATE command with the selected mechanism, using the given username and the given password.
        Parameters:
        method - the method name
        username - user
        password - password
        Returns:
        True if successfully completed, false if not.
        Throws:
        java.io.IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
        java.security.NoSuchAlgorithmException - If the CRAM hash algorithm cannot be instantiated by the Java runtime system.
        java.security.InvalidKeyException - If the CRAM hash algorithm failed to use the given password.
        java.security.spec.InvalidKeySpecException - If the CRAM hash algorithm failed to use the given password.
      • auth

        public boolean auth​(AuthenticatingIMAPClient.AUTH_METHOD method,
                            java.lang.String username,
                            java.lang.String password)
                     throws java.io.IOException,
                            java.security.NoSuchAlgorithmException,
                            java.security.InvalidKeyException,
                            java.security.spec.InvalidKeySpecException
        Authenticate to the IMAP server by sending the AUTHENTICATE command with the selected mechanism, using the given username and the given password.
        Parameters:
        method - the method name
        username - user
        password - password
        Returns:
        True if successfully completed, false if not.
        Throws:
        java.io.IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
        java.security.NoSuchAlgorithmException - If the CRAM hash algorithm cannot be instantiated by the Java runtime system.
        java.security.InvalidKeyException - If the CRAM hash algorithm failed to use the given password.
        java.security.spec.InvalidKeySpecException - If the CRAM hash algorithm failed to use the given password.