use of org.gluu.oxtrust.model.passport.PassportConfigResponse 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.gluu.oxtrust.model.passport.PassportConfigResponse 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