Tracing.logInfo("Added authentication Provider: name='"
+ authProvider.getName() + "' enabled='" + (authProvider.isEnabled() ? "yes" : "no") + "'.", LoginModule.class);
}
Configuration defProviderConf = moduleConfig.getChild("DefaultAuthProvider");
if (defProviderConf == null)
throw new StartupException("No DefaultAuthProvider defined. Please fix.");
defaultProviderName = defProviderConf.getAttribute("name");
if (defaultProviderName == null)
throw new StartupException("No DefaultAuthProvider defined. Please fix.");
AuthenticationProvider defaultProvider = getAuthenticationProvider(defaultProviderName);
if (defaultProvider == null || !defaultProvider.isEnabled())
throw new StartupException("Defined DefaultAuthProvider::" + defaultProviderName + " not existent or not enabled. Please fix.");
Tracing.logInfo("Using default authentication provider '" + defaultProviderName + "'.", LoginModule.class);
// check attack prevention
Configuration attack_conf = moduleConfig.getChild(CONF_ATTACK);
if (attack_conf != null) {
String attack_enabled = attack_conf.getAttribute(CONF_ATTACK_ENABLED);
if (attack_enabled != null &&
(attack_enabled.toLowerCase().equals("true") || attack_enabled.toLowerCase().equals("yes"))) {
attackPreventionEnabled = true;
String attack_maxattempts = attack_conf.getAttribute(CONF_ATTACK_MAXATTEMPTS);
String attack_timeoutmin = attack_conf.getAttribute(CONF_ATTACK_TIMEOUTMIN);
try {
attackPreventionMaxAttempts = Integer.parseInt(attack_maxattempts);
attackPreventionTimeout = Integer.parseInt(attack_timeoutmin);
} catch (NumberFormatException nfe) {
throw new StartupException("Attribute 'attempts' and/or 'timeoutmin' of config Parameter AttackPrevention are either missing or not a number. Please fix!");
}
// configure timed cache default params: refresh 1 minute, timeout according to configuration
failedLoginCache = CoordinatorManager.getCoordinator().getCacher().getOrCreateCache(this.getClass(), "blockafterfailedattempts");
Tracing.logInfo("Attack prevention enabled. Max number of attempts: " + attack_maxattempts + ", timeout: " + attack_timeoutmin + " minutes.", LoginModule.class);