| Method from org.jboss.security.auth.login.XMLLoginConfigImpl Detail: |
public void addAppConfig(String appName,
AppConfigurationEntry[] entries) {
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(REFRESH_PERM);
AuthenticationInfo authInfo = new AuthenticationInfo();
authInfo.setAppConfigurationEntry(entries);
appConfigs.put(appName, authInfo);
}
Add an application configuration |
public void clear() {
}
|
public AppConfigurationEntry[] getAppConfigurationEntry(String appName) {
// If the config has not been loaded try to do so
if (loginConfigURL == null)
{
loadConfig();
}
AppConfigurationEntry[] entry = null;
AuthenticationInfo authInfo = (AuthenticationInfo) appConfigs.get(appName);
if (authInfo == null)
{
if (parentConfig != null)
entry = parentConfig.getAppConfigurationEntry(appName);
if (entry == null)
authInfo = (AuthenticationInfo) appConfigs.get(DEFAULT_APP_CONFIG_NAME);
}
if (authInfo != null)
{
if (log.isTraceEnabled())
log.trace("getAppConfigurationEntry("+appName+"), authInfo=" + authInfo);
// Make a copy of the authInfo object
final AuthenticationInfo theAuthInfo = authInfo;
PrivilegedAction action = new PrivilegedAction()
{
public Object run()
{
return theAuthInfo.copyAppConfigurationEntry();
}
};
entry = (AppConfigurationEntry[]) AccessController.doPrivileged(action);
}
return entry;
}
|
public URL getConfigURL() {
return loginConfigURL;
}
Set the URL of the XML login configuration file that should
be loaded by this mbean on startup. |
public boolean getValidateDTD() {
return this.validateDTD;
}
Get whether the login config xml document is validated againsts its DTD |
public void loadConfig() {
// Try to load the java.security.auth.login.config property
String loginConfig = System.getProperty("java.security.auth.login.config");
if (loginConfig == null)
loginConfig = "login-config.xml";
// If there is no loginConfigURL build it from the loginConfig
if (loginConfigURL == null)
{
try
{
// Try as a URL
loginConfigURL = new URL(loginConfig);
}
catch (MalformedURLException e)
{
// Try as a resource
try
{
setConfigResource(loginConfig);
}
catch (IOException ignore)
{
// Try as a file
File configFile = new File(loginConfig);
try
{
setConfigURL(configFile.toURL());
}
catch (MalformedURLException ignore2)
{
}
}
}
}
if (loginConfigURL == null)
{
log.warn("Failed to find config: " + loginConfig);
return;
}
// Try to load the config if found
try
{
loadConfig(loginConfigURL);
}
catch (Exception e)
{
log.warn("Failed to load config: " + loginConfigURL, e);
}
}
Called to try to load the config from the java.security.auth.login.config
property value when there is no loginConfigURL. |
protected String[] loadConfig(URL config) throws Exception {
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(REFRESH_PERM);
ArrayList configNames = new ArrayList();
log.debug("Try loading config as XML, url=" + config);
try
{
loadXMLConfig(config, configNames);
}
catch(Throwable e)
{
log.debug("Failed to load config as XML", e);
log.debug("Try loading config as Sun format, url=" + config);
loadSunConfig(config, configNames);
}
String[] names = new String[configNames.size()];
configNames.toArray(names);
return names;
}
|
public void refresh() {
// --- Begin Configuration method overrrides
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(REFRESH_PERM);
appConfigs.clear();
loadConfig();
}
|
public void removeAppConfig(String appName) {
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(REFRESH_PERM);
appConfigs.remove(appName);
}
|
public void setConfigResource(String resourceName) throws IOException {
ClassLoader tcl = Thread.currentThread().getContextClassLoader();
loginConfigURL = tcl.getResource(resourceName);
if (loginConfigURL == null)
throw new IOException("Failed to find resource: " + resourceName);
}
|
public void setConfigURL(URL loginConfigURL) {
this.loginConfigURL = loginConfigURL;
}
Set the URL of the XML login configuration file that should
be loaded by this mbean on startup. |
public void setParentConfig(Configuration parentConfig) {
this.parentConfig = parentConfig;
}
|
public void setValidateDTD(boolean flag) {
this.validateDTD = flag;
}
Set whether the login config xml document is validated againsts its DTD |