use of org.gluu.oxtrust.api.server.model.CasProtocolDTO 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();
}
}
use of org.gluu.oxtrust.api.server.model.CasProtocolDTO in project oxTrust by GluuFederation.
the class CasProtocolWebResourceTest method getCasConfigTest.
@Test
public void getCasConfigTest() {
HttpUriRequest request = new HttpGet(BASE_URL + ApiConstants.BASE_API_URL + ApiConstants.CONFIGURATION + ApiConstants.CAS);
HttpResponse response = handle(request);
Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
HttpEntity entity = response.getEntity();
try {
String content = EntityUtils.toString(entity);
CasProtocolDTO configuration = mapper.readValue(content, CasProtocolDTO.class);
Assert.assertNotNull(configuration);
} catch (ParseException | IOException e) {
e.printStackTrace();
Assert.assertTrue(false);
}
}
use of org.gluu.oxtrust.api.server.model.CasProtocolDTO in project oxTrust by GluuFederation.
the class CasProtocolDtoAssembly method toDto.
public CasProtocolDTO toDto(CASProtocolConfiguration casProtocolConfiguration) {
CasProtocolDTO casProtocolDTO = new CasProtocolDTO();
casProtocolDTO.setCasBaseURL(casProtocolConfiguration.getCasBaseURL());
casProtocolDTO.setShibbolethCASProtocolConfiguration(toDto(casProtocolConfiguration.getConfiguration()));
return casProtocolDTO;
}
Aggregations