Search in sources :

Example 1 with LdapOxPassportConfiguration

use of org.gluu.config.oxtrust.LdapOxPassportConfiguration in project oxTrust by GluuFederation.

the class PassportRestWebService method getPassportConfig.

@GET
@Produces({ MediaType.APPLICATION_JSON })
@ProtectedApi
public Response getPassportConfig() {
    Status status;
    String jsonResponse;
    try {
        Object obj = Optional.ofNullable(passportService.loadConfigurationFromLdap()).map(LdapOxPassportConfiguration::getPassportConfiguration).map(Object.class::cast).orElse(Collections.emptyMap());
        jsonResponse = jsonService.objectToPerttyJson(obj);
        status = Status.OK;
    } catch (Exception e) {
        jsonResponse = "Failed to prepare configuration: " + e.getMessage();
        status = Status.INTERNAL_SERVER_ERROR;
        log.error(e.getMessage(), e);
    }
    log.trace("Passport endpoint config response is\n{}", jsonResponse);
    return Response.status(status).entity(jsonResponse).build();
}
Also used : Status(javax.ws.rs.core.Response.Status) LdapOxPassportConfiguration(org.gluu.config.oxtrust.LdapOxPassportConfiguration) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) ProtectedApi(org.gluu.oxtrust.service.filter.ProtectedApi)

Aggregations

GET (javax.ws.rs.GET)1 Produces (javax.ws.rs.Produces)1 Status (javax.ws.rs.core.Response.Status)1 LdapOxPassportConfiguration (org.gluu.config.oxtrust.LdapOxPassportConfiguration)1 ProtectedApi (org.gluu.oxtrust.service.filter.ProtectedApi)1