in src/main/java/org/apache/sling/auth/form/impl/FormAuthenticationHandler.java [564:619]
protected void activate(FormAuthenticationHandlerConfig config, ComponentContext componentContext)
throws InvalidKeyException, NoSuchAlgorithmException, IllegalStateException {
this.jaasHelper = new JaasHelper(this, componentContext.getBundleContext(), config);
this.loginForm = config.form_login_form();
log.info("Login Form URL {}", loginForm);
final String authName = config.form_auth_name();
String defaultCookieDomain = config.form_default_cookie_domain();
if (defaultCookieDomain.length() == 0) {
defaultCookieDomain = null;
}
final String formAuthStorage = config.form_auth_storage();
if (FormAuthenticationHandlerConfig.AUTH_STORAGE_SESSION_ATTRIBUTE.equals(formAuthStorage)) {
this.authStorage = new SessionStorage(authName);
log.info("Using HTTP Session store with attribute name {}", authName);
} else {
this.authStorage = new CookieStorage(authName, defaultCookieDomain);
log.info("Using Cookie store with name {}", authName);
}
this.attrCookieAuthData = config.form_credentials_name();
log.info("Setting Auth Data attribute name {}", attrCookieAuthData);
int timeoutMinutes = config.form_auth_timeout();
if (timeoutMinutes < 1) {
timeoutMinutes = FormAuthenticationHandlerConfig.DEFAULT_AUTH_TIMEOUT;
}
log.info("Setting session timeout {} minutes", timeoutMinutes);
this.sessionTimeout = MINUTES * timeoutMinutes;
final String tokenFileName = config.form_token_file();
final File tokenFile = getTokenFile(tokenFileName, componentContext.getBundleContext());
final boolean fastSeed = config.form_token_fastseed();
log.info("Storing tokens in {}", tokenFile.getAbsolutePath());
this.tokenStore = new TokenStore(tokenFile, sessionTimeout, fastSeed);
this.loginModule = null;
if (!jaasHelper.enabled()) {
try {
this.loginModule = FormLoginModulePlugin.register(this, componentContext.getBundleContext());
} catch (Throwable t) { //NOSONAR
log.info(
"Cannot register FormLoginModulePlugin. This is expected if Sling LoginModulePlugin services are not supported");
log.debug("dump", t);
}
}
this.includeLoginForm = config.useInclude();
this.loginAfterExpire = config.form_onexpire_login();
this.preferReasonCode = config.preferReasonCode();
}