I have the following controller:
class Controller {
@ResponseStatus(HttpStatus.OK)
@RequestMapping(value = "/verifyCert", method = RequestMethod.GET)
public void verifyCertificate() throws CertificateExpiredException, CertificateNotYetValidException {
certificate.checkValidity();
}
@ResponseStatus(HttpStatus.FORBIDDEN)
@ExceptionHandler({CertificateExpiredException.class, CertificateNotYetValidException.class})
public void handleCertificateValidityException(Exception e) {}
}
My goal is to that controller redirects to exception handler if certificate is not valid.