loginmodule.html
来自「SUN公司官方J2EE中文帮助文档 应该不错 有兴趣的下来看看 html格式的」· HTML 代码 · 共 408 行 · 第 1/2 页
HTML
408 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Thu Jan 17 03:51:37 PST 2002 -->
<TITLE>
Java 2 Platform EE v1.3: Interface LoginModule
</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" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="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" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV CLASS
NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="LoginModule.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
javax.security.auth.spi</FONT>
<BR>
Interface LoginModule</H2>
<HR>
<DL>
<DT>public interface <B>LoginModule</B></DL>
<P>
<p> <code>LoginModule</code> describes the interface
implemented by authentication technology providers. LoginModules
are plugged in under applications to provide a particular type of
authentication.
<p> While applications write to the <code>LoginContext</code> API,
authentication technology providers implement the
<code>LoginModule</code> interface.
A <code>Configuration</code> specifies the LoginModule(s)
to be used with a particular login application. Therefore different
LoginModules can be plugged in under the application without
requiring any modifications to the application itself.
<p> The <code>LoginContext</code> is responsible for reading the
<code>Configuration</code> and instantiating the appropriate
LoginModules. Each <code>LoginModule</code> is initialized with
a <code>Subject</code>, a <code>CallbackHandler</code>, shared
<code>LoginModule</code> state, and LoginModule-specific options.
The <code>Subject</code> represents the
<code>Subject</code> currently being authenticated and is updated
with relevant Credentials if authentication succeeds.
LoginModules use the <code>CallbackHandler</code> to
communicate with users. The <code>CallbackHandler</code> may be
used to prompt for usernames and passwords, for example.
Note that the <code>CallbackHandler</code> may be null. LoginModules
which absolutely require a <code>CallbackHandler</code> to authenticate
the <code>Subject</code> may throw a <code>LoginException</code>.
LoginModules optionally use the shared state to share information
or data among themselves.
<p> The LoginModule-specific options represent the options
configured for this <code>LoginModule</code> by an administrator or user
in the login <code>Configuration</code>.
The options are defined by the <code>LoginModule</code> itself
and control the behavior within it. For example, a
<code>LoginModule</code> may define options to support debugging/testing
capabilities. Options are defined using a key-value syntax,
such as <i>debug=true</i>. The <code>LoginModule</code>
stores the options as a <code>Map</code> so that the values may
be retrieved using the key. Note that there is no limit to the number
of options a <code>LoginModule</code> chooses to define.
<p> The calling application sees the authentication process as a single
operation. However, the authentication process within the
<code>LoginModule</code> proceeds in two distinct phases.
In the first phase, the LoginModule's
<code>login</code> method gets invoked by the LoginContext's
<code>login</code> method. The <code>login</code>
method for the <code>LoginModule</code> then performs
the actual authentication (prompt for and verify a password for example)
and saves its authentication status as private state
information. Once finished, the LoginModule's <code>login</code>
method either returns <code>true</code> (if it succeeded) or
<code>false</code> (if it should be ignored), or throws a
<code>LoginException</code> to specify a failure.
In the failure case, the <code>LoginModule</code> must not retry the
authentication or introduce delays. The responsibility of such tasks
belongs to the application. If the application attempts to retry
the authentication, the LoginModule's <code>login</code> method will be
called again.
<p> In the second phase, if the LoginContext's overall authentication
succeeded (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL
LoginModules succeeded), then the <code>commit</code>
method for the <code>LoginModule</code> gets invoked.
The <code>commit</code> method for a <code>LoginModule</code> checks its
privately saved state to see if its own authentication succeeded.
If the overall <code>LoginContext</code> authentication succeeded
and the LoginModule's own authentication succeeded, then the
<code>commit</code> method associates the relevant
Principals (authenticated identities) and Credentials (authentication data
such as cryptographic keys) with the <code>Subject</code>
located within the <code>LoginModule</code>.
<p> If the LoginContext's overall authentication failed (the relevant
REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules did not succeed),
then the <code>abort</code> method for each <code>LoginModule</code>
gets invoked. In this case, the <code>LoginModule</code> removes/destroys
any authentication state originally saved.
<p> Logging out a <code>Subject</code> involves only one phase.
The <code>LoginContext</code> invokes the LoginModule's <code>logout</code>
method. The <code>logout</code> method for the <code>LoginModule</code>
then performs the logout procedures, such as removing Principals or
Credentials from the <code>Subject</code> or logging session information.
<p> A <code>LoginModule</code> implementation must have a constructor with
no arguments. This allows classes which load the <code>LoginModule</code>
to instantiate it.
<P>
<DL>
<DT><B>See Also: </B><DD><A HREF="../../../../javax/security/auth/login/LoginContext.html"><CODE>LoginContext</CODE></A>,
<A HREF="../../../../javax/security/auth/login/Configuration.html"><CODE>Configuration</CODE></A></DL>
<HR>
<P>
<!-- ======== INNER CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/security/auth/spi/LoginModule.html#abort()">abort</A></B>()</CODE>
<BR>
Method to abort the authentication process (phase 2).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/security/auth/spi/LoginModule.html#commit()">commit</A></B>()</CODE>
<BR>
Method to commit the authentication process (phase 2).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/security/auth/spi/LoginModule.html#initialize(javax.security.auth.Subject, javax.security.auth.callback.CallbackHandler, java.util.Map, java.util.Map)">initialize</A></B>(<A HREF="../../../../javax/security/auth/Subject.html">Subject</A> subject,
<A HREF="../../../../javax/security/auth/callback/CallbackHandler.html">CallbackHandler</A> callbackHandler,
java.util.Map sharedState,
java.util.Map options)</CODE>
<BR>
Initialize this LoginModule.</TD>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?