configuration.html
来自「SUN公司官方J2EE中文帮助文档 应该不错 有兴趣的下来看看 html格式的」· HTML 代码 · 共 423 行 · 第 1/2 页
HTML
423 行
<!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: Class Configuration
</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">
<A HREF="../../../../javax/security/auth/login/AppConfigurationEntry.LoginModuleControlFlag.html"><B>PREV CLASS</B></A>
<A HREF="../../../../javax/security/auth/login/LoginContext.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="Configuration.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="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.security.auth.login</FONT>
<BR>
Class Configuration</H2>
<PRE>
java.lang.Object
|
+--<B>javax.security.auth.login.Configuration</B>
</PRE>
<HR>
<DL>
<DT>public abstract class <B>Configuration</B><DT>extends java.lang.Object</DL>
<P>
<p> This is an abstract class for representing the configuration of
LoginModules under an application. The <code>Configuration</code> specifies
which LoginModules should be used for a particular application, and in what
order the LoginModules should be invoked.
This abstract class needs to be subclassed to provide an implementation
which reads and loads the actual <code>Configuration</code>.
<p> When the <code>LoginContext</code> needs to read the Configuration
to determine which LoginModules are configured for a particular
application, <i>appName</i>, it makes the following calls:
<pre>
config = Configuration.getConfiguration();
entries = config.getAppConfigurationEntry(appName);
</pre>
<p> A login configuration contains the following information.
Note that this example only represents the default syntax for the
<code>Configuration</code>. Subclass implementations of this class
may implement alternative syntaxes and may retrieve the
<code>Configuration</code> from any source such as files, databases,
or servers.
<pre>
Application {
Module Flag ModuleOptions;
Module Flag ModuleOptions;
Module Flag ModuleOptions;
};
Application {
Module Flag ModuleOptions;
Module Flag ModuleOptions;
};
other {
Module Flag ModuleOptions;
Module Flag ModuleOptions;
};
</pre>
<p> Each entry in the <code>Configuration</code> is indexed via an
application name, <i>Application</i>, and contains a list of
LoginModules configured for that application. Authentication proceeds
down the list in the exact order specified. If an application
does not have specific entry, it defaults to the specific entry
for "<i>other</i>".
<p> The <i>Flag</i> value controls the overall behavior as authentication
proceeds down the stack. The following represents a description of the
valid values for <i>Flag</i> and their respective semantics:
<pre>
1) Required - The <code>LoginModule</code> is required to succeed.
If it succeeds or fails, authentication still continues
to proceed down the <code>LoginModule</code> list.
2) Requisite - The <code>LoginModule</code> is required to succeed.
If it succeeds, authentication continues down the
<code>LoginModule</code> list. If it fails,
control immediately returns to the application
(authentication does not proceed down the
<code>LoginModule</code> list).
3) Sufficient - The <code>LoginModule</code> is not required to
succeed. If it does succeed, control immediately
returns to the application (authentication does not
proceed down the <code>LoginModule</code> list).
If it fails, authentication continues down the
<code>LoginModule</code> list.
4) Optional - The <code>LoginModule</code> is not required to
succeed. If it succeeds or fails,
authentication still continues to proceed down the
<code>LoginModule</code> list.
</pre>
<p> The overall authentication succeeds only if all <i>Required</i> and
<i>Requisite</i> LoginModules succeed. If a <i>Sufficient</i>
<code>LoginModule</code> is configured and succeeds,
then only the <i>Required</i> and <i>Requisite</i> LoginModules prior to
that <i>Sufficient</i> <code>LoginModule</code> need to have succeeded for
the overall authentication to succeed. If no <i>Required</i> or
<i>Requisite</i> LoginModules are configured for an application,
then at least one <i>Sufficient</i> or <i>Optional</i>
<code>LoginModule</code> must succeed.
<p> <i>ModuleOptions</i> is a space separated list of
<code>LoginModule</code>-specific values which are passed directly to
the underlying LoginModules. 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. The correct way to specify options in the
<code>Configuration</code> is by using the following key-value pairing:
<i>debug=true</i>. The key and value should be separated by an
'equals' symbol. Note that there is no limit to the number of
options a <code>LoginModule</code> may define.
<p> The following represents an example <code>Configuration</code> entry
based on the syntax above:
<pre>
Login {
sun.modules.SmartCard required;
sun.modules.Kerberos optional debug=true;
};
</pre>
<p> This <code>Configuration</code> specifies that an application named,
"Login", requires users to first authenticate to the
<i>sun.modules.SmartCard</i> <code>LoginModule</code>, which is
required to succeed. Even if the <i>sun.modules.SmartCard</i>
authentication fails (an incorrect pin was entered), the
<i>sun.modules.Kerberos</i> <code>LoginModule</code> still gets invoked.
This helps hide the source of failure. Since the <i>sun.modules.Kerberos</i>
<code>LoginModule</code> is <i>Optional</i>, the overall
authentication succeeds only if the <i>sun.modules.SmartCard</i>
<code>LoginModule</code> (<i>Required</i>) succeeds.
<p> Also note that the LoginModule-specific option, <i>debug=true</i>,
is passed to the <i>sun.modules.Kerberos</i> LoginModule. This turns on
a debugging flag, which outputs helpful debugging information to a file.
<p> The default Configuration implementation can be changed by setting the
value of the "login.configuration.provider" security property (in the Java
security properties file) to the fully qualified name of
the desired Configuration implementation class.
The Java security properties file is located in the file named
<JAVA_HOME>/lib/security/java.security, where <JAVA_HOME>
refers to the directory where the JDK was installed.
<P>
<DL>
<DT><B>See Also: </B><DD><A HREF="../../../../javax/security/auth/login/LoginContext.html"><CODE>LoginContext</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%">
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?