Class ConfigFile
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 security properties,
login.config.url.1, login.config.url.2, ...,
login.config.url.X.
Each property value specifies a
URL
pointing to a login configuration file to be loaded. Read in and load each configuration. -
The system property
java.security.auth.login.config
may also be set to aURL
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. In addition, the
security property policy.expandProperties can be used to control
whether system properties in the configuration file are expanded. If not
set, the default value is true which means that properties will
be expanded.
- Since:
- 1.4
- See Also:
-
Nested Class Summary
Nested classes/interfaces declared in class Configuration
Configuration.Parameters
Modifier and TypeClassDescriptionstatic interface
This represents a marker interface for Configuration parameters. -
Constructor Summary
ConstructorsConstructorDescriptionCreate a newConfiguration
object.ConfigFile
(URI uri) Create a newConfiguration
object from the specifiedURI
. -
Method Summary
Modifier and TypeMethodDescriptiongetAppConfigurationEntry
(String applicationName) Retrieve an entry from theConfiguration
using an application name as an index.void
refresh()
Refresh and reload theConfiguration
by re-reading all of the login configurations.Methods declared in class Configuration
getConfiguration, getInstance, getInstance, getInstance, getParameters, getProvider, getType, setConfiguration
Modifier and TypeMethodDescriptionstatic Configuration
Get the installed login Configuration.static Configuration
getInstance
(String type, Configuration.Parameters params) Returns a Configuration object of the specified type.static Configuration
getInstance
(String type, Configuration.Parameters params, String provider) Returns a Configuration object of the specified type.static Configuration
getInstance
(String type, Configuration.Parameters params, Provider provider) Returns a Configuration object of the specified type.Return Configuration parameters.Return the Provider of this Configuration.getType()
Return the type of this Configuration.static void
setConfiguration
(Configuration configuration) Set the loginConfiguration
.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Modifier and TypeMethodDescriptionprotected Object
clone()
Creates and returns a copy of this object.boolean
Indicates whether some other object is "equal to" this one.protected void
finalize()
Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class
<?> getClass()
Returns the runtime class of thisObject
.int
hashCode()
Returns a hash code value for this object.final void
notify()
Wakes up a single thread that is waiting on this object's monitor.final void
Wakes up all threads that are waiting on this object's monitor.toString()
Returns a string representation of the object.final void
wait()
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final void
wait
(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final void
wait
(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
ConfigFile
public ConfigFile()Create a newConfiguration
object.- Throws:
SecurityException
- if theConfiguration
can not be initialized
-
ConfigFile
Create a newConfiguration
object from the specifiedURI
.- Parameters:
uri
- theURI
- Throws:
SecurityException
- if theConfiguration
can not be initializedNullPointerException
- ifuri
is null
-
-
Method Details
-
getAppConfigurationEntry
Retrieve an entry from theConfiguration
using an application name as an index.- Specified by:
getAppConfigurationEntry
in classConfiguration
- Parameters:
applicationName
- the name used to index theConfiguration
- Returns:
- an array of
AppConfigurationEntry
which correspond to the stacked configuration ofLoginModule
s for this application, or null if this application has no configuredLoginModule
s.
-
refresh
public void refresh()Refresh and reload theConfiguration
by re-reading all of the login configurations.- Overrides:
refresh
in classConfiguration
-