use of io.getlime.core.rest.model.base.response.ErrorResponse in project powerauth-restful-integration by lime-company.
the class PowerAuthApiAuthenticationEntryPoint method commence.
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException {
ErrorResponse errorResponse = new ErrorResponse(Error.Code.ERROR_GENERIC, "POWER_AUTH_SIGNATURE_INVALID");
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.getOutputStream().println(new ObjectMapper().writeValueAsString(errorResponse));
response.getOutputStream().flush();
}
use of io.getlime.core.rest.model.base.response.ErrorResponse in project powerauth-restful-integration by lime-company.
the class PowerAuthExceptionHandler method handleUnauthorizedException.
/**
* Handle PowerAuthAuthenticationException exceptions.
* @param ex Exception instance.
* @return Error response.
*/
@ExceptionHandler(value = PowerAuthAuthenticationException.class)
@ResponseStatus(value = HttpStatus.UNAUTHORIZED)
@ResponseBody
public ErrorResponse handleUnauthorizedException(Exception ex) {
PowerAuthAuthenticationException paex = (PowerAuthAuthenticationException) ex;
Logger.getLogger(PowerAuthExceptionHandler.class.getName()).log(Level.SEVERE, paex.getMessage(), paex);
return new ErrorResponse(paex.getDefaultCode(), paex);
}
use of io.getlime.core.rest.model.base.response.ErrorResponse in project powerauth-restful-integration by lime-company.
the class PowerAuthExceptionHandler method handleActivationException.
/**
* Handle PowerAuthActivationException exceptions.
* @param ex Exception instance.
* @return Error response.
*/
@ExceptionHandler(value = PowerAuthActivationException.class)
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
@ResponseBody
public ErrorResponse handleActivationException(Exception ex) {
PowerAuthActivationException paex = (PowerAuthActivationException) ex;
Logger.getLogger(PowerAuthExceptionHandler.class.getName()).log(Level.SEVERE, paex.getMessage(), paex);
return new ErrorResponse(paex.getDefaultCode(), paex);
}
use of io.getlime.core.rest.model.base.response.ErrorResponse in project powerauth-restful-integration by lime-company.
the class PowerAuthExceptionHandler method handleSecureVaultException.
/**
* Handle PowerAuthSecureVaultException exceptions.
* @param ex Exception instance.
* @return Error response.
*/
@ExceptionHandler(value = PowerAuthSecureVaultException.class)
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
@ResponseBody
public ErrorResponse handleSecureVaultException(Exception ex) {
PowerAuthSecureVaultException paex = (PowerAuthSecureVaultException) ex;
Logger.getLogger(PowerAuthExceptionHandler.class.getName()).log(Level.SEVERE, paex.getMessage(), paex);
return new ErrorResponse(paex.getDefaultCode(), paex);
}
Aggregations