APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.security.auth.login

public Class ConfigFile

extends Configuration
Class Inheritance
Imports
javax.security.auth.login.AppConfigurationEntry, .Configuration, java.net.URI

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:

  1. 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.
  2. The 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.
  3. 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.
  4. 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
javax.security.auth.login.LoginContext, security properties

Field Summary

Modifier and TypeField and Description
private final ConfigFile.Spi

Constructor Summary

AccessConstructor and Description
public
ConfigFile()

Create a new Configuration object.

public
ConfigFile(URI
the URI
uri
)

Create a new Configuration object from the specified URI.

Method Summary

Modifier and TypeMethod and Description
public AppConfigurationEntry[]

Returns:

an array of AppConfigurationEntry which correspond to the stacked configuration of LoginModules for this application, or null if this application has no configured LoginModules.
getAppConfigurationEntry
(String
the name used to index the Configuration
applicationName
)

Implements abstract javax.security.auth.login.Configuration.getAppConfigurationEntry.

Retrieve an entry from the Configuration using an application name as an index.

public void
refresh()

Overrides javax.security.auth.login.Configuration.refresh.

Refresh and reload the Configuration by re-reading all of the login configurations.

Inherited from javax.security.auth.login.Configuration:
getConfigurationgetInstancegetInstancegetInstancegetParametersgetProvidergetTypesetConfiguration

Field Detail

spiback to summary
private final ConfigFile.Spi spi

Constructor Detail

ConfigFileback to summary
public ConfigFile()

Create a new Configuration object.

Exceptions
SecurityException:
if the Configuration can not be initialized
ConfigFileback to summary
public ConfigFile(URI uri)

Create a new Configuration object from the specified URI.

Parameters
uri:URI

the URI

Exceptions
SecurityException:
if the Configuration can not be initialized
NullPointerException:
if uri is null

Method Detail

getAppConfigurationEntryback to summary
public AppConfigurationEntry[] getAppConfigurationEntry(String applicationName)

Implements abstract javax.security.auth.login.Configuration.getAppConfigurationEntry.

Retrieve an entry from the Configuration using an application name as an index.

Parameters
applicationName:String

the name used to index the Configuration

Returns:AppConfigurationEntry[]

an array of AppConfigurationEntry which correspond to the stacked configuration of LoginModules for this application, or null if this application has no configured LoginModules.

Annotations
@Override
refreshback to summary
public void refresh()

Overrides javax.security.auth.login.Configuration.refresh.

Refresh and reload the Configuration by re-reading all of the login configurations.

Annotations
@Override