use of org.craftercms.studio.model.rest.ResultOne in project studio by craftercms.
the class SecurityController method encryptText.
@PostMapping("/encrypt")
public ResponseBody encryptText(@RequestBody EncryptRequest request) throws ServiceLayerException {
String encrypted = encryptionService.encrypt(request.getSiteId(), request.getText());
ResultOne<String> result = new ResultOne<>();
result.setEntity(RESULT_KEY_ITEM, encrypted);
result.setResponse(ApiResponse.OK);
ResponseBody response = new ResponseBody();
response.setResult(result);
return response;
}
use of org.craftercms.studio.model.rest.ResultOne in project studio by craftercms.
the class UiController method getActiveEnvironment.
@GetMapping("/system/active_environment")
public ResponseBody getActiveEnvironment() throws AuthenticationException {
ResultOne<String> result = new ResultOne<String>();
result.setResponse(ApiResponse.OK);
result.setEntity(RESULT_KEY_ENVIRONMENT, uiService.getActiveEnvironment());
ResponseBody responseBody = new ResponseBody();
responseBody.setResult(result);
return responseBody;
}
use of org.craftercms.studio.model.rest.ResultOne in project studio by craftercms.
the class UsersController method getCurrentUserSsoLogoutUrl.
/**
* Get the SSO SP logout URL for the current authenticated user. The system should redirect to this logout URL
* <strong>AFTER</strong> local logout. Response entity can be null if user is not authenticated through SSO
* or if logout is disabled
*
* @return Response containing SSO logout URL for the current authenticated user
*/
@GetMapping(ME + LOGOUT_SSO_URL)
public ResponseBody getCurrentUserSsoLogoutUrl() throws ServiceLayerException, AuthenticationException {
String logoutUrl = userService.getCurrentUserSsoLogoutUrl();
ResultOne<String> result = new ResultOne<>();
result.setResponse(OK);
result.setEntity(RESULT_KEY_LOGOUT_URL, logoutUrl);
ResponseBody responseBody = new ResponseBody();
responseBody.setResult(result);
return responseBody;
}
use of org.craftercms.studio.model.rest.ResultOne in project studio by craftercms.
the class UsersController method changePassword.
@PostMapping(ME + CHANGE_PASSWORD)
public ResponseBody changePassword(@RequestBody ChangePasswordRequest changePasswordRequest) throws PasswordDoesNotMatchException, ServiceLayerException, UserExternallyManagedException, AuthenticationException, UserNotFoundException {
User result = userService.changePassword(changePasswordRequest.getUsername(), changePasswordRequest.getCurrent(), changePasswordRequest.getNewPassword());
ResponseBody responseBody = new ResponseBody();
ResultOne<User> resultOne = new ResultOne<User>();
resultOne.setEntity(RESULT_KEY_USER, result);
resultOne.setResponse(OK);
responseBody.setResult(resultOne);
return responseBody;
}
use of org.craftercms.studio.model.rest.ResultOne in project studio by craftercms.
the class UsersController method updateUser.
/**
* Update user API
*
* @param user User to update
* @return Response object
*/
@PatchMapping(value = "", consumes = APPLICATION_JSON_VALUE)
public ResponseBody updateUser(@RequestBody User user) throws ServiceLayerException, UserNotFoundException, AuthenticationException {
userService.updateUser(user);
ResponseBody responseBody = new ResponseBody();
ResultOne<User> result = new ResultOne<>();
result.setResponse(OK);
result.setEntity(RESULT_KEY_USER, user);
responseBody.setResult(result);
return responseBody;
}
Aggregations