com.sun.security.auth.login
public class: ConfigFile [javadoc |
source]
java.lang.Object
javax.security.auth.login.Configuration
com.sun.security.auth.login.ConfigFile
This class represents a default implementation for
javax.security.auth.login.Configuration.
This object stores the runtime login configuration representation,
and is the amalgamation of multiple static login
configurations that resides in files.
The algorithm for locating the login configuration file(s) and reading their
information into this Configuration object is:
-
Loop through the
java.security.Security properties,
login.config.url.1, login.config.url.2, ...,
login.config.url.X. These properties are set
in the Java security properties file, which is located in the file named
<JAVA_HOME>/lib/security/java.security.
<JAVA_HOME> refers to the value of the java.home system property,
and specifies the directory where the JRE is installed.
Each property value specifies a URL pointing to a
login configuration file to be loaded. Read in and load
each configuration.
-
The
java.lang.System property
java.security.auth.login.config
may also be set to a URL pointing to another
login configuration file
(which is the case when a user uses the -D switch at runtime).
If this property is defined, and its use is allowed by the
security property file (the Security property,
policy.allowSystemProperty is set to true),
also load that login configuration.
-
If the java.security.auth.login.config property is defined using
"==" (rather than "="), then ignore all other specified
login configurations and only load this configuration.
-
If no system or security properties were set, try to read from the file,
${user.home}/.java.login.config, where ${user.home} is the value
represented by the "user.home" System property.
The configuration syntax supported by this implementation
is exactly that syntax specified in the
javax.security.auth.login.Configuration class.
| Method from com.sun.security.auth.login.ConfigFile Detail: |
public AppConfigurationEntry[] getAppConfigurationEntry(String applicationName) {
LinkedList< AppConfigurationEntry > list = null;
synchronized (configuration) {
list = configuration.get(applicationName);
}
if (list == null || list.size() == 0)
return null;
AppConfigurationEntry[] entries =
new AppConfigurationEntry[list.size()];
Iterator< AppConfigurationEntry > iterator = list.iterator();
for (int i = 0; iterator.hasNext(); i++) {
AppConfigurationEntry e = iterator.next();
entries[i] = new AppConfigurationEntry(e.getLoginModuleName(),
e.getControlFlag(),
e.getOptions());
}
return entries;
}
Retrieve an entry from the Configuration using an application name
as an index.
|
public synchronized void refresh() {
java.lang.SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(new AuthPermission("refreshLoginConfiguration"));
java.security.AccessController.doPrivileged
(new java.security.PrivilegedAction< Void >() {
public Void run() {
try {
init(url);
} catch (java.io.IOException ioe) {
throw (SecurityException) new SecurityException
(ioe.getLocalizedMessage()).initCause(ioe);
}
return null;
}
});
}
Refresh and reload the Configuration by re-reading all of the
login configurations.
|