Search in sources :

Example 1 with LdapConnectionData

use of org.gluu.oxtrust.util.LdapConnectionData in project oxTrust by GluuFederation.

the class LDAPAuthenticationWebResource method getLdapConfigurationStatusByName.

@GET
@Path(ApiConstants.NAME_PARAM_PATH + ApiConstants.STATUS)
@Operation(summary = "Check the status of an existing configuration", description = "Check the status of an existing configuration")
@ApiResponses(value = { @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ConnectionStatusDTO.class)), description = "Success") })
@ProtectedApi(scopes = { READ_ACCESS })
public Response getLdapConfigurationStatusByName(@PathParam("name") String name) {
    log(logger, "Check the status of an existing configuration");
    try {
        GluuLdapConfiguration ldapConfiguration = ldapConfigurationService.findLdapConfigurationByName(name);
        org.gluu.oxtrust.util.LdapConnectionData ldapConnectionData = LdapConnectionData.from(ldapConfiguration);
        ConnectionStatusDTO connectionStatus = ConnectionStatusDTO.from(this.connectionStatus.isUp(ldapConnectionData));
        return Response.ok(connectionStatus).build();
    } catch (Exception e) {
        log(logger, e);
        return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
    }
}
Also used : LdapConnectionData(org.gluu.oxtrust.util.LdapConnectionData) ConnectionStatusDTO(org.gluu.oxtrust.api.server.model.ConnectionStatusDTO) GluuLdapConfiguration(org.gluu.model.ldap.GluuLdapConfiguration) LdapConfigurationDuplicatedException(org.gluu.oxtrust.api.server.util.LdapConfigurationDuplicatedException) ProtectedApi(org.gluu.oxtrust.service.filter.ProtectedApi) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Aggregations

Operation (io.swagger.v3.oas.annotations.Operation)1 ApiResponses (io.swagger.v3.oas.annotations.responses.ApiResponses)1 GluuLdapConfiguration (org.gluu.model.ldap.GluuLdapConfiguration)1 ConnectionStatusDTO (org.gluu.oxtrust.api.server.model.ConnectionStatusDTO)1 LdapConfigurationDuplicatedException (org.gluu.oxtrust.api.server.util.LdapConfigurationDuplicatedException)1 ProtectedApi (org.gluu.oxtrust.service.filter.ProtectedApi)1 LdapConnectionData (org.gluu.oxtrust.util.LdapConnectionData)1