Package javax.mail

Class Authenticator

    • Field Detail

      • requestingSite

        private java.net.InetAddress requestingSite
      • requestingPort

        private int requestingPort
      • requestingProtocol

        private java.lang.String requestingProtocol
      • requestingPrompt

        private java.lang.String requestingPrompt
      • requestingUserName

        private java.lang.String requestingUserName
    • Constructor Detail

      • Authenticator

        public Authenticator()
    • Method Detail

      • requestPasswordAuthentication

        final PasswordAuthentication requestPasswordAuthentication​(java.net.InetAddress addr,
                                                                   int port,
                                                                   java.lang.String protocol,
                                                                   java.lang.String prompt,
                                                                   java.lang.String defaultUserName)
        Ask the authenticator for a password.

        Parameters:
        addr - The InetAddress of the site requesting authorization, or null if not known.
        port - the port for the requested connection
        protocol - The protocol that's requesting the connection (@see java.net.Authenticator.getProtocol())
        prompt - A prompt string for the user
        Returns:
        The username/password, or null if one can't be gotten.
      • getRequestingSite

        protected final java.net.InetAddress getRequestingSite()
        Returns:
        the InetAddress of the site requesting authorization, or null if it's not available.
      • getRequestingPort

        protected final int getRequestingPort()
        Returns:
        the port for the requested connection
      • getRequestingProtocol

        protected final java.lang.String getRequestingProtocol()
        Give the protocol that's requesting the connection. Often this will be based on a URLName.
        Returns:
        the protcol
        See Also:
        URLName.getProtocol()
      • getRequestingPrompt

        protected final java.lang.String getRequestingPrompt()
        Returns:
        the prompt string given by the requestor
      • getDefaultUserName

        protected final java.lang.String getDefaultUserName()
        Returns:
        the default user name given by the requestor
      • getPasswordAuthentication

        protected PasswordAuthentication getPasswordAuthentication()
        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.

        Returns:
        The PasswordAuthentication collected from the user, or null if none is provided.