Class MailHandler.DefaultAuthenticator

  • Enclosing class:
    MailHandler

    private static final class MailHandler.DefaultAuthenticator
    extends Authenticator
    Used for storing a password from the LogManager or literal string.
    Since:
    JavaMail 1.4.6
    • Field Detail

      • pass

        private final java.lang.String pass
        The password to use.
    • Constructor Detail

      • DefaultAuthenticator

        private DefaultAuthenticator​(java.lang.String pass)
        Use the factory method instead of this constructor.
        Parameters:
        pass - the password.
    • Method Detail

      • of

        static Authenticator of​(java.lang.String pass)
        Creates an Authenticator for the given password. This method is used so class verification of assignments in MailHandler doesn't require loading this class which otherwise can occur when using the constructor. Default access to avoid generating extra class files.
        Parameters:
        pass - the password.
        Returns:
        an Authenticator for the password.
        Since:
        JavaMail 1.5.6
      • getPasswordAuthentication

        protected final PasswordAuthentication getPasswordAuthentication()
        Description copied from class: Authenticator
        Called when password authentication is needed. Subclasses should override the default implementation, which returns null.

        Note that if this method uses a dialog to prompt the user for this information, the dialog needs to block until the user supplies the information. This method can not simply return after showing the dialog.

        Overrides:
        getPasswordAuthentication in class Authenticator
        Returns:
        The PasswordAuthentication collected from the user, or null if none is provided.