use of org.gluu.oxtrust.api.server.model.OxtrustSetting in project oxTrust by GluuFederation.
the class OxtrustSettingWebResource method getOxtrustSettings.
@GET
@Operation(summary = "Get oxtrust settings", description = "Get oxtrust settings")
@ApiResponses(value = { @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = OxtrustSetting.class)), description = Constants.RESULT_SUCCESS), @ApiResponse(responseCode = "500", description = "Server error") })
@ProtectedApi(scopes = { READ_ACCESS })
public Response getOxtrustSettings() {
try {
log(logger, "Processing oxtrust settings retrieval request");
GluuConfiguration configurationUpdate = configurationService.getConfiguration();
OxtrustSetting setting = new OxtrustSetting();
setting.setAllowPasswordReset(String.valueOf(configurationUpdate.isPasswordResetAllowed()));
setting.setAllowProfileManagement(String.valueOf(configurationUpdate.isProfileManagment()));
setting.setEnablePassport(String.valueOf(configurationUpdate.isPassportEnabled()));
setting.setEnableScim(String.valueOf(configurationUpdate.isScimEnabled()));
return Response.ok(setting).build();
} catch (Exception e) {
log(logger, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
}
use of org.gluu.oxtrust.api.server.model.OxtrustSetting in project oxTrust by GluuFederation.
the class OxtrustSettingWebResourceTest method updateOxtrustSettingTest.
@Test
public void updateOxtrustSettingTest() {
OxtrustSetting oxtrustSetting = getOxTrustSetting();
try {
HttpPut second = new HttpPut(BASE_URL + ApiConstants.BASE_API_URL + ApiConstants.CONFIGURATION + ApiConstants.OXTRUST_SETTINGS);
HttpEntity entity = new ByteArrayEntity(mapper.writeValueAsString(oxtrustSetting).toString().getBytes("UTF-8"), ContentType.APPLICATION_FORM_URLENCODED);
second.setEntity(entity);
second.setHeader(CONTENT_TYPE, MediaType.APPLICATION_JSON);
HttpResponse response = handle(second);
Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
} catch (ParseException | IOException e) {
e.printStackTrace();
Assert.assertTrue(false);
}
}
use of org.gluu.oxtrust.api.server.model.OxtrustSetting in project oxTrust by GluuFederation.
the class OxtrustSettingWebResourceTest method getOxTrustSetting.
private OxtrustSetting getOxTrustSetting() {
OxtrustSetting oxtrustSetting = new OxtrustSetting();
oxtrustSetting.setAllowPasswordReset(GluuBoolean.ENABLED.getValue());
oxtrustSetting.setAllowProfileManagement(GluuBoolean.ENABLED.getValue());
oxtrustSetting.setEnablePassport(GluuBoolean.ENABLED.getValue());
oxtrustSetting.setEnableScim(GluuBoolean.ENABLED.getValue());
return oxtrustSetting;
}
Aggregations