📄 authenticator.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Fri Feb 18 09:55:59 PST 2000 -->
<TITLE>
JavaMail 1.1 API documentation: Class Authenticator
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" ID="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT ID="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" ID="NavBarCell1Rev"> <FONT ID="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="class-use/Authenticator.html"><FONT ID="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" ID="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../javax/mail/Address.html"><B>PREV CLASS</B></A>
<A HREF="../../javax/mail/BodyPart.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" ID="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="Authenticator.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
javax.mail</FONT>
<BR>
Class Authenticator</H2>
<PRE>
java.lang.Object
|
+--<B>javax.mail.Authenticator</B>
</PRE>
<HR>
<DL>
<DT>public abstract class <B>Authenticator</B><DT>extends java.lang.Object</DL>
<P>
The class Authenticator represents an object that knows how to obtain
authentication for a network connection. Usually, it will do this
by prompting the user for information.
<p>
Applications use this class by creating a subclass, and registering
an instance of that subclass with the session when it is created.
When authentication is required, the system will invoke a method
on the subclass (like getPasswordAuthentication). The subclass's
method can query about the authentication being requested with a
number of inherited methods (getRequestingXXX()), and form an
appropriate message for the user.
<p>
All methods that request authentication have a default implementation
that fails.
<P>
<DL>
<DT><B>See Also: </B><DD><CODE>java.net.Authenticator</CODE>,
<A HREF="../../javax/mail/Session.html#getInstance(java.util.Properties, javax.mail.Authenticator)"><CODE>Session.getInstance(java.util.Properties,
javax.mail.Authenticator)</CODE></A>,
<A HREF="../../javax/mail/Session.html#getDefaultInstance(java.util.Properties, javax.mail.Authenticator)"><CODE>Session.getDefaultInstance(java.util.Properties,
javax.mail.Authenticator)</CODE></A>,
<A HREF="../../javax/mail/Session.html#requestPasswordAuthentication(java.net.InetAddress, int, java.lang.String, java.lang.String, java.lang.String)"><CODE>Session.requestPasswordAuthentication(java.net.InetAddress, int, java.lang.String, java.lang.String, java.lang.String)</CODE></A>,
<A HREF="../../javax/mail/PasswordAuthentication.html"><CODE>PasswordAuthentication</CODE></A></DL>
<HR>
<P>
<!-- ======== INNER CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD><CODE><B><A HREF="../../javax/mail/Authenticator.html#Authenticator()">Authenticator</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Authenticator.html#getDefaultUserName()">getDefaultUserName</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../javax/mail/PasswordAuthentication.html">PasswordAuthentication</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Authenticator.html#getPasswordAuthentication()">getPasswordAuthentication</A></B>()</CODE>
<BR>
Called when password authentication is needed.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Authenticator.html#getRequestingPort()">getRequestingPort</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Authenticator.html#getRequestingPrompt()">getRequestingPrompt</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Authenticator.html#getRequestingProtocol()">getRequestingProtocol</A></B>()</CODE>
<BR>
Give the protocol that's requesting the connection.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected java.net.InetAddress</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Authenticator.html#getRequestingSite()">getRequestingSite</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" ID="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD><CODE>clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="Authenticator()"><!-- --></A><H3>
Authenticator</H3>
<PRE>
public <B>Authenticator</B>()</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="getRequestingSite()"><!-- --></A><H3>
getRequestingSite</H3>
<PRE>
protected final java.net.InetAddress <B>getRequestingSite</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Returns:</B><DD>the InetAddress of the site requesting authorization, or null
if it's not available.</DL>
</DD>
</DL>
<HR>
<A NAME="getRequestingPort()"><!-- --></A><H3>
getRequestingPort</H3>
<PRE>
protected final int <B>getRequestingPort</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Returns:</B><DD>the port for the requested connection</DL>
</DD>
</DL>
<HR>
<A NAME="getRequestingProtocol()"><!-- --></A><H3>
getRequestingProtocol</H3>
<PRE>
protected final java.lang.String <B>getRequestingProtocol</B>()</PRE>
<DL>
<DD>Give the protocol that's requesting the connection. Often this
will be based on a URLName.<DD><DL>
<DT><B>Returns:</B><DD>the protcol<DT><B>See Also: </B><DD><A HREF="../../javax/mail/URLName.html#getProtocol()"><CODE>URLName.getProtocol()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getRequestingPrompt()"><!-- --></A><H3>
getRequestingPrompt</H3>
<PRE>
protected final java.lang.String <B>getRequestingPrompt</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Returns:</B><DD>the prompt string given by the requestor</DL>
</DD>
</DL>
<HR>
<A NAME="getDefaultUserName()"><!-- --></A><H3>
getDefaultUserName</H3>
<PRE>
protected final java.lang.String <B>getDefaultUserName</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Returns:</B><DD>the default user name given by the requestor</DL>
</DD>
</DL>
<HR>
<A NAME="getPasswordAuthentication()"><!-- --></A><H3>
getPasswordAuthentication</H3>
<PRE>
protected <A HREF="../../javax/mail/PasswordAuthentication.html">PasswordAuthentication</A> <B>getPasswordAuthentication</B>()</PRE>
<DL>
<DD>Called when password authentication is needed. Subclasses should
override the default implementation, which returns null. <p>
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.<DD><DL>
<DT><B>Returns:</B><DD>The PasswordAuthentication collected from the
user, or null if none is provided.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" ID="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT ID="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" ID="NavBarCell1Rev"> <FONT ID="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="class-use/Authenticator.html"><FONT ID="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" ID="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../javax/mail/Address.html"><B>PREV CLASS</B></A>
<A HREF="../../javax/mail/BodyPart.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" ID="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="Authenticator.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -