APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.security.provider

public final Class ConfigFile

extends Configuration
Class Inheritance
Imports
java.io.*, java.net.MalformedURLException, .URI, .URL, java.security.Security, .URIParameter, java.text.MessageFormat, java.util.*, javax.security.auth.login.AppConfigurationEntry, .AppConfigurationEntry.LoginModuleControlFlag, .Configuration, .ConfigurationSpi, sun.security.util.Debug, .PropertyExpander, .ResourcesMgr

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 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.
  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.

See Also
javax.security.auth.login.LoginContext, security properties

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final ConfigFile.Spi

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public AppConfigurationEntry[]
getAppConfigurationEntry(String appName)

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

Retrieve the AppConfigurationEntries for the specified name from this Configuration.

private static URL
newURL(String spec)

public synchronized void
refresh()

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

Refresh and reload the Configuration.

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()

Method Detail

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

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

Doc from javax.security.auth.login.Configuration.getAppConfigurationEntry.

Retrieve the AppConfigurationEntries for the specified name from this Configuration.

Annotations
@Override
newURLback to summary
private static URL newURL(String spec) throws MalformedURLException
Annotations
@SuppressWarnings:deprecation
refreshback to summary
public synchronized void refresh()

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

Doc from javax.security.auth.login.Configuration.refresh.

Refresh and reload the Configuration.

This method causes this Configuration object to refresh/reload its contents in an implementation-dependent manner. For example, if this Configuration object stores its entries in a file, calling refresh may cause the file to be re-read.

The default implementation of this method does nothing. This method should be overridden if a refresh operation is supported by the implementation.

Annotations
@Override
sun.security.provider back to summary

public final Class ConfigFile.Spi

extends ConfigurationSpi
Class Inheritance

Field Summary

Modifier and TypeField and Description
private Map<String, List<AppConfigurationEntry>>
private static final Debug
private static final Debug
private boolean
private int
private int
private StreamTokenizer
private URL

Constructor Summary

AccessConstructor and Description
public
Spi()

Creates a new ConfigurationSpi object.

public
Spi(URI
the URI
uri
)

Creates a new ConfigurationSpi object from the specified URI.

public

Method Summary

Modifier and TypeMethod and Description
public AppConfigurationEntry[]

Returns:

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

Implements abstract javax.security.auth.login.ConfigurationSpi.engineGetAppConfigurationEntry.

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

public synchronized void
engineRefresh()

Overrides javax.security.auth.login.ConfigurationSpi.engineRefresh.

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

private String
expand(String value)

private InputStream
private void
init()

Read and initialize the entire login Configuration from the configured URL.

private void
init(URL config, Map<String, List<AppConfigurationEntry>> newConfig)

private IOException
ioException(String resourceKey, Object... args)

private String
match(String expect)

private int
private void
private boolean
peek(String expect)

private void

Field Detail

configurationback to summary
private Map<String, List<AppConfigurationEntry>> configuration
debugConfigback to summary
private static final Debug debugConfig
debugParserback to summary
private static final Debug debugParser
expandPropback to summary
private boolean expandProp
linenumback to summary
private int linenum
lookaheadback to summary
private int lookahead
stback to summary
private StreamTokenizer st
urlback to summary
private URL url

Constructor Detail

Spiback to summary
public Spi()

Creates a new ConfigurationSpi object.

Exceptions
SecurityException:
if the ConfigurationSpi can not be initialized
Spiback to summary
public Spi(URI uri)

Creates a new ConfigurationSpi object from the specified URI.

Parameters
uri:URI

the URI

Exceptions
SecurityException:
if the ConfigurationSpi can not be initialized
NullPointerException:
if uri is null
Spiback to summary
public Spi(final Configuration.Parameters params) throws IOException

Method Detail

engineGetAppConfigurationEntryback to summary
public AppConfigurationEntry[] engineGetAppConfigurationEntry(String applicationName)

Implements abstract javax.security.auth.login.ConfigurationSpi.engineGetAppConfigurationEntry.

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 AppConfigurationEntries which correspond to the stacked configuration of LoginModules for this application, or null if this application has no configured LoginModules.

Annotations
@Override
engineRefreshback to summary
public synchronized void engineRefresh()

Overrides javax.security.auth.login.ConfigurationSpi.engineRefresh.

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

Annotations
@Override
expandback to summary
private String expand(String value) throws ExpandException, IOException
getInputStreamback to summary
private InputStream getInputStream(URL url) throws IOException
initback to summary
private void init() throws IOException

Read and initialize the entire login Configuration from the configured URL.

Exceptions
IOException:
if the Configuration can not be initialized
initback to summary
private void init(URL config, Map<String, List<AppConfigurationEntry>> newConfig) throws IOException
ioExceptionback to summary
private IOException ioException(String resourceKey, Object... args)
matchback to summary
private String match(String expect) throws IOException
nextTokenback to summary
private int nextToken() throws IOException
parseLoginEntryback to summary
private void parseLoginEntry(Map<String, List<AppConfigurationEntry>> newConfig) throws IOException
peekback to summary
private boolean peek(String expect)
readConfigback to summary
private void readConfig(Reader reader, Map<String, List<AppConfigurationEntry>> newConfig) throws IOException