use of org.xdi.oxauth.model.appliance.GluuAppliance in project oxAuth by GluuFederation.
the class AppInitializer method loadAppliance.
private GluuAppliance loadAppliance(LdapEntryManager localLdapEntryManager, String... ldapReturnAttributes) {
String baseDn = configurationFactory.getBaseDn().getAppliance();
String applianceInum = configurationFactory.getAppConfiguration().getApplianceInum();
if (StringHelper.isEmpty(baseDn) || StringHelper.isEmpty(applianceInum)) {
return null;
}
String applianceDn = String.format("inum=%s,%s", applianceInum, baseDn);
GluuAppliance appliance = null;
try {
appliance = localLdapEntryManager.find(GluuAppliance.class, applianceDn, ldapReturnAttributes);
} catch (LdapMappingException ex) {
log.error("Failed to load appliance entry from Ldap", ex);
return null;
}
return appliance;
}
use of org.xdi.oxauth.model.appliance.GluuAppliance in project oxAuth by GluuFederation.
the class AppInitializer method setDefaultAuthenticationMethod.
private void setDefaultAuthenticationMethod(LdapEntryManager localLdapEntryManager) {
GluuAppliance appliance = loadAppliance(localLdapEntryManager, "oxAuthenticationMode");
authenticationMode = null;
if (appliance != null) {
this.authenticationMode = new AuthenticationMode(appliance.getAuthenticationMode());
}
authenticationModeInstance.destroy(authenticationModeInstance.get());
}
use of org.xdi.oxauth.model.appliance.GluuAppliance in project oxAuth by GluuFederation.
the class LdapCustomAuthenticationConfigurationService method getCustomAuthenticationConfigurations.
public List<CustomAuthenticationConfiguration> getCustomAuthenticationConfigurations() {
GluuAppliance gluuAppliance = applianceService.getAppliance();
List<String> configurationJsons = gluuAppliance.getOxIDPAuthentication();
List<CustomAuthenticationConfiguration> customAuthenticationConfigurations = new ArrayList<CustomAuthenticationConfiguration>();
if (configurationJsons == null) {
return customAuthenticationConfigurations;
}
for (String configurationJson : configurationJsons) {
oxIDPAuthConf configuration;
try {
configuration = (oxIDPAuthConf) jsonToObject(configurationJson, oxIDPAuthConf.class);
if (configuration.getEnabled() && configuration.getType().equalsIgnoreCase("customAuthentication")) {
CustomAuthenticationConfiguration customAuthenticationConfiguration = mapCustomAuthentication(configuration);
customAuthenticationConfigurations.add(customAuthenticationConfiguration);
}
} catch (Exception ex) {
log.error("Failed to create object by json: '{}'", ex, configurationJson);
}
}
return customAuthenticationConfigurations;
}
use of org.xdi.oxauth.model.appliance.GluuAppliance in project oxAuth by GluuFederation.
the class AppInitializer method loadLdapIdpAuthConfigs.
private List<oxIDPAuthConf> loadLdapIdpAuthConfigs(LdapEntryManager localLdapEntryManager) {
GluuAppliance appliance = loadAppliance(localLdapEntryManager, "oxIDPAuthentication");
if ((appliance == null) || (appliance.getOxIDPAuthentication() == null)) {
return null;
}
List<oxIDPAuthConf> configurations = new ArrayList<oxIDPAuthConf>();
for (String configurationJson : appliance.getOxIDPAuthentication()) {
try {
oxIDPAuthConf configuration = (oxIDPAuthConf) jsonToObject(configurationJson, oxIDPAuthConf.class);
if (configuration.getType().equalsIgnoreCase("ldap") || configuration.getType().equalsIgnoreCase("auth")) {
configurations.add(configuration);
}
} catch (Exception ex) {
log.error("Failed to create object by json: '{}'", ex, configurationJson);
}
}
return configurations;
}
use of org.xdi.oxauth.model.appliance.GluuAppliance in project oxAuth by GluuFederation.
the class ApplicationFactory method getSmtpConfiguration.
@Produces
@ApplicationScoped
public SmtpConfiguration getSmtpConfiguration() {
GluuAppliance appliance = applianceService.getAppliance();
SmtpConfiguration smtpConfiguration = appliance.getSmtpConfiguration();
if (smtpConfiguration == null) {
return null;
}
String password = smtpConfiguration.getPassword();
if (StringHelper.isNotEmpty(password)) {
try {
smtpConfiguration.setPasswordDecrypted(encryptionService.decrypt(password));
} catch (EncryptionException ex) {
log.error("Failed to decript SMTP user password", ex);
}
}
return smtpConfiguration;
}
Aggregations