use of jakarta.annotation.PostConstruct in project jans by JanssenProject.
the class SelectAccountAction method prepare.
@PostConstruct
public void prepare() {
currentSessions = Lists.newArrayList();
Set<String> uids = Sets.newHashSet();
for (SessionId session : sessionIdService.getCurrentSessions()) {
final User user = sessionIdService.getUser(session);
if (user == null) {
log.error("Failed to get user for session. Skipping it from current_sessions, id: {}", session.getId());
continue;
}
final String uid = StringUtils.isNotBlank(user.getUserId()) ? user.getUserId() : user.getDn();
if (!currentSessions.contains(session) && !uids.contains(uid)) {
log.trace("User: {}, sessionId: {}", uid, session.getId());
currentSessions.add(session);
uids.add(uid);
}
}
log.trace("Found {} sessions", currentSessions.size());
}
use of jakarta.annotation.PostConstruct in project jans by JanssenProject.
the class ConfigurationFactory method init.
@PostConstruct
public void init() {
this.isActive = new AtomicBoolean(true);
try {
this.persistenceConfiguration = persistanceFactoryService.loadPersistenceConfiguration(LDAP_PROPERTIES_FILE);
loadBaseConfiguration();
String confDir = confDir();
this.configFilePath = confDir + CONFIG_FILE_NAME;
this.errorsFilePath = confDir + ERRORS_FILE_NAME;
this.staticConfFilePath = confDir + STATIC_CONF_FILE_NAME;
String certsDir = this.baseConfiguration.getString(CERTS_DIR);
if (StringHelper.isEmpty(certsDir)) {
certsDir = confDir;
}
this.webKeysFilePath = certsDir + File.separator + WEB_KEYS_FILE_NAME;
this.saltFilePath = confDir + SALT_FILE_NAME;
loadCryptoConfigurationSalt();
} finally {
this.isActive.set(false);
}
}
use of jakarta.annotation.PostConstruct in project jans by JanssenProject.
the class ActionService method init.
@PostConstruct
private void init() {
URL url = null;
try {
url = new URL(String.format("file://%s%s/", econf.getRootDir(), econf.getScriptsPath()));
} catch (MalformedURLException e) {
logger.error(e.getMessage());
throw new RuntimeException(e);
}
logger.debug("Creating a Groovy Script Engine based at {}", url.toString());
gse = new GroovyScriptEngine(new URL[] { url });
/*
//Failed attempt to force scripts have java extension instead of groovy:
//Dependant scripts are not found if .groovy is not used
CompilerConfiguration cc = gse.getConfig();
cc.setDefaultScriptExtension(CLASS_SUFFIX.substring(1));
//Set it so change takes effect
gse.setConfig(cc);
*/
loader = gse.getGroovyClassLoader();
loader.setShouldRecompile(true);
mapper = new ObjectMapper();
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
}
use of jakarta.annotation.PostConstruct in project jans by JanssenProject.
the class ServicesFactory method init.
@PostConstruct
public void init() {
mapper = new ObjectMapper();
econfig = new EngineConfig();
}
use of jakarta.annotation.PostConstruct in project jans by JanssenProject.
the class TemplatingService method init.
@PostConstruct
private void init() {
fmConfig = new Configuration(Configuration.VERSION_2_3_31);
fmConfig.setDefaultEncoding(UTF_8.toString());
fmConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
fmConfig.setLogTemplateExceptions(false);
fmConfig.setWrapUncheckedExceptions(true);
fmConfig.setFallbackOnNullLoopVariable(false);
try {
fmConfig.setDirectoryForTemplateLoading(Paths.get(econf.getRootDir()).toFile());
} catch (IOException e) {
logger.error("Error configuring directory for UI templates: {}", e.getMessage());
throw new RuntimeException(e);
}
}
Aggregations