use of org.xdi.model.passport.FieldSet 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();
}
Aggregations