use of org.gluu.oxtrust.model.OxIDPAuthConf in project oxTrust by GluuFederation.
the class ManagePersonAuthenticationAction method modify.
public String modify() {
if (this.initialized) {
return OxTrustConstants.RESULT_SUCCESS;
}
try {
GluuAppliance appliance = applianceService.getAppliance();
if (appliance == null) {
return OxTrustConstants.RESULT_FAILURE;
}
passportEnable = appliance.getPassportEnabled();
log.info("passport enabled value : '{}'", passportEnable);
this.customScripts = customScriptService.findCustomScripts(Arrays.asList(CustomScriptType.PERSON_AUTHENTICATION), "displayName", "oxLevel", "gluuStatus");
OxIDPAuthConf idpConf = getIDPAuthConfOrNull(appliance);
if (idpConf != null) {
this.ldapConfig = mapLdapConfig(idpConf.getConfig());
}
this.existLdapConfigIdpAuthConf = this.ldapConfig != null;
if (this.ldapConfig == null) {
this.ldapConfig = new GluuLdapConfiguration();
}
this.authenticationMode = appliance.getAuthenticationMode();
this.oxTrustAuthenticationMode = appliance.getOxTrustAuthenticationMode();
ldapOxPassportConfiguration = passportService.loadConfigurationFromLdap();
if (ldapOxPassportConfiguration == null) {
ldapOxPassportConfiguration = new LdapOxPassportConfiguration();
}
this.ldapPassportConfigurations = ldapOxPassportConfiguration.getPassportConfigurations();
} catch (Exception ex) {
log.error("Failed to load appliance configuration", ex);
return OxTrustConstants.RESULT_FAILURE;
}
this.initialized = true;
return OxTrustConstants.RESULT_SUCCESS;
}
use of org.gluu.oxtrust.model.OxIDPAuthConf in project oxTrust by GluuFederation.
the class ManagePersonAuthenticationAction method save.
public String save() {
try {
// Reload entry to include latest changes
GluuAppliance appliance = applianceService.getAppliance();
boolean updateAuthenticationMode = false;
boolean updateOxTrustAuthenticationMode = false;
OxIDPAuthConf idpConf = getIDPAuthConfOrNull(appliance);
if (idpConf != null && idpConf.getName() != null) {
if (idpConf.getName().equals(this.authenticationMode)) {
updateAuthenticationMode = true;
}
if (idpConf.getName().equals(this.oxTrustAuthenticationMode)) {
updateOxTrustAuthenticationMode = true;
}
}
this.ldapConfig.updateStringsLists();
updateAuthConf(appliance);
String updatedAuthMode = updateAuthenticationMode ? this.ldapConfig.getConfigId() : this.authenticationMode;
String updatedOxTrustAuthMode = updateOxTrustAuthenticationMode ? this.ldapConfig.getConfigId() : this.oxTrustAuthenticationMode;
appliance.setAuthenticationMode(updatedAuthMode);
appliance.setOxTrustAuthenticationMode(updatedOxTrustAuthMode);
appliance.setPassportEnabled(passportEnable);
applianceService.updateAppliance(appliance);
ldapOxPassportConfiguration.setPassportConfigurations(ldapPassportConfigurations);
passportService.updateLdapOxPassportConfiguration(ldapOxPassportConfiguration);
} catch (LdapMappingException ex) {
log.error("Failed to update appliance configuration", ex);
facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to update appliance");
return OxTrustConstants.RESULT_FAILURE;
}
reset();
return modify();
}
use of org.gluu.oxtrust.model.OxIDPAuthConf in project oxTrust by GluuFederation.
the class ManagePersonAuthenticationAction method updateAuthConf.
public boolean updateAuthConf(GluuAppliance appliance) {
try {
List<OxIDPAuthConf> idpConf = new ArrayList<OxIDPAuthConf>();
if (this.existLdapConfigIdpAuthConf) {
if (this.ldapConfig.isUseAnonymousBind()) {
this.ldapConfig.setBindDN(null);
}
OxIDPAuthConf ldapConfigIdpAuthConf = new OxIDPAuthConf();
ldapConfigIdpAuthConf.setType("auth");
ldapConfigIdpAuthConf.setVersion(ldapConfigIdpAuthConf.getVersion() + 1);
ldapConfigIdpAuthConf.setName(this.ldapConfig.getConfigId());
ldapConfigIdpAuthConf.setEnabled(this.ldapConfig.isEnabled());
ldapConfigIdpAuthConf.setConfig(objectToJson(this.ldapConfig));
idpConf.add(ldapConfigIdpAuthConf);
}
appliance.setOxIDPAuthentication(idpConf);
} catch (Exception ex) {
log.error("An Error occured ", ex);
return false;
}
return true;
}
Aggregations