Search in sources :

Example 1 with CASProtocolConfiguration

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

the class CasProtocolWebResource method update.

@PUT
@Operation(summary = "Update the configuration", description = "Update the configuration")
@ApiResponses(value = { @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = CasProtocolDTO.class)), description = "Success") })
@ProtectedApi(scopes = { WRITE_ACCESS })
public Response update(@Valid CasProtocolDTO casProtocol) {
    log(logger, "Update the configuration");
    try {
        CASProtocolConfiguration casProtocolConfiguration = casProtocolDtoAssembly.fromDto(casProtocol);
        casProtocolConfiguration.save(casService);
        shibbolethService.update(casProtocolConfiguration);
        return getCasConfig();
    } catch (Exception e) {
        log(logger, e);
        return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
    }
}
Also used : CASProtocolConfiguration(org.gluu.oxtrust.util.CASProtocolConfiguration) ProtectedApi(org.gluu.oxtrust.service.filter.ProtectedApi) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Example 2 with CASProtocolConfiguration

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

the class CasProtocolWebResource method getCasConfig.

@GET
@Operation(summary = "Get existing configuration", description = "Get the existing configuration")
@ApiResponses(value = { @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = CasProtocolDTO.class)), description = "Success") })
@ProtectedApi(scopes = { READ_ACCESS })
public Response getCasConfig() {
    log(logger, "Get the existing cas configuration");
    try {
        CASProtocolConfiguration casProtocolConfiguration = casProtocolConfigurationProvider.get();
        CasProtocolDTO casProtocolDto = casProtocolDtoAssembly.toDto(casProtocolConfiguration);
        return Response.ok(casProtocolDto).build();
    } catch (Exception e) {
        log(logger, e);
        return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
    }
}
Also used : CASProtocolConfiguration(org.gluu.oxtrust.util.CASProtocolConfiguration) CasProtocolDTO(org.gluu.oxtrust.api.server.model.CasProtocolDTO) 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)2 ApiResponses (io.swagger.v3.oas.annotations.responses.ApiResponses)2 ProtectedApi (org.gluu.oxtrust.service.filter.ProtectedApi)2 CASProtocolConfiguration (org.gluu.oxtrust.util.CASProtocolConfiguration)2 CasProtocolDTO (org.gluu.oxtrust.api.server.model.CasProtocolDTO)1