use of org.xdi.config.oxtrust.LdapOxPassportConfiguration 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.xdi.config.oxtrust.LdapOxPassportConfiguration in project oxTrust by GluuFederation.
the class ManagePersonAuthenticationAction method modifyImpl.
public String modifyImpl() {
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");
List<OxIDPAuthConf> list = getIDPAuthConfOrNull(appliance);
this.sourceConfigs = new ArrayList<GluuLdapConfiguration>();
if (list != null) {
for (OxIDPAuthConf oxIDPAuthConf : list) {
GluuLdapConfiguration oxldapConfig = mapLdapConfig(oxIDPAuthConf.getConfig());
this.sourceConfigs.add(oxldapConfig);
}
}
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.xdi.config.oxtrust.LdapOxPassportConfiguration in project oxTrust by GluuFederation.
the class PassportRestWebService method getPassportConfig.
@GET
@Produces({ MediaType.APPLICATION_JSON })
public Response getPassportConfig(@HeaderParam("Authorization") String authorization) {
Response authorizationResponse = processAuthorization(authorization);
if (authorizationResponse != null) {
return authorizationResponse;
}
PassportConfigResponse passportConfigResponse = new PassportConfigResponse();
Map<String, Map> strategies = new HashMap<String, Map>();
LdapOxPassportConfiguration ldapOxPassportConfiguration = passportService.loadConfigurationFromLdap();
if (ldapOxPassportConfiguration != null) {
for (org.xdi.model.passport.PassportConfiguration passportConfiguration : ldapOxPassportConfiguration.getPassportConfigurations()) {
if (passportConfiguration != null) {
Map<String, String> map = new HashMap();
List<FieldSet> passList = passportConfiguration.getFieldset();
for (FieldSet fieldset : passList) {
map.put(fieldset.getKey(), fieldset.getValue());
}
strategies.put(passportConfiguration.getStrategy(), map);
}
}
}
passportConfigResponse.setPassportStrategies(strategies);
String passportConfigResponseJson;
try {
passportConfigResponseJson = jsonService.objectToPerttyJson(passportConfigResponse);
} catch (IOException ex) {
return getErrorResponse(Response.Status.FORBIDDEN, "Failed to prepare configuration");
}
return Response.status(Response.Status.OK).entity(passportConfigResponseJson).build();
}
use of org.xdi.config.oxtrust.LdapOxPassportConfiguration in project oxTrust by GluuFederation.
the class PassportRestWebService method getPassportConfig.
@GET
@Produces({ MediaType.APPLICATION_JSON })
@ProtectedApi
public Response getPassportConfig() {
PassportConfigResponse passportConfigResponse = new PassportConfigResponse();
Map<String, Map> strategies = new HashMap<String, Map>();
LdapOxPassportConfiguration ldapOxPassportConfiguration = passportService.loadConfigurationFromLdap();
if (ldapOxPassportConfiguration != null) {
for (org.xdi.model.passport.PassportConfiguration passportConfiguration : ldapOxPassportConfiguration.getPassportConfigurations()) {
if (passportConfiguration != null) {
Map<String, String> map = new HashMap<String, String>();
List<SimpleExtendedCustomProperty> passList = passportConfiguration.getFieldset();
if (passList != null) {
for (SimpleExtendedCustomProperty fieldset : passList) {
map.put(fieldset.getValue1(), fieldset.getValue2());
}
}
strategies.put(passportConfiguration.getStrategy(), map);
}
}
}
passportConfigResponse.setPassportStrategies(strategies);
String passportConfigResponseJson;
try {
passportConfigResponseJson = jsonService.objectToPerttyJson(passportConfigResponse);
} catch (IOException ex) {
return getErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Failed to prepare configuration");
}
return Response.status(Response.Status.OK).entity(passportConfigResponseJson).build();
}
Aggregations