List of usage examples for org.springframework.boot.actuate.autoconfigure.cloudfoundry CloudFoundryAuthorizationException getMessage
public String getMessage()
From source file:org.springframework.boot.actuate.autoconfigure.cloudfoundry.CloudFoundrySecurityInterceptor.java
SecurityResponse preHandle(HttpServletRequest request, String endpointId) { if (CorsUtils.isPreFlightRequest(request)) { return SecurityResponse.success(); }//from ww w . j a v a 2s. c o m try { if (!StringUtils.hasText(this.applicationId)) { throw new CloudFoundryAuthorizationException( CloudFoundryAuthorizationException.Reason.SERVICE_UNAVAILABLE, "Application id is not available"); } if (this.cloudFoundrySecurityService == null) { throw new CloudFoundryAuthorizationException( CloudFoundryAuthorizationException.Reason.SERVICE_UNAVAILABLE, "Cloud controller URL is not available"); } if (HttpMethod.OPTIONS.matches(request.getMethod())) { return SUCCESS; } check(request, endpointId); } catch (Exception ex) { logger.error(ex); if (ex instanceof CloudFoundryAuthorizationException) { CloudFoundryAuthorizationException cfException = (CloudFoundryAuthorizationException) ex; return new SecurityResponse(cfException.getStatusCode(), "{\"security_error\":\"" + cfException.getMessage() + "\"}"); } return new SecurityResponse(HttpStatus.INTERNAL_SERVER_ERROR, ex.getMessage()); } return SecurityResponse.success(); }
From source file:org.springframework.boot.actuate.autoconfigure.cloudfoundry.reactive.CloudFoundrySecurityInterceptor.java
private Mono<SecurityResponse> getErrorResponse(Throwable throwable) { if (throwable instanceof CloudFoundryAuthorizationException) { CloudFoundryAuthorizationException cfException = (CloudFoundryAuthorizationException) throwable; return Mono.just(new SecurityResponse(cfException.getStatusCode(), "{\"security_error\":\"" + cfException.getMessage() + "\"}")); }//from ww w.jav a 2s .c o m return Mono.just(new SecurityResponse(HttpStatus.INTERNAL_SERVER_ERROR, throwable.getMessage())); }
From source file:org.springframework.boot.actuate.autoconfigure.cloudfoundry.servlet.CloudFoundrySecurityInterceptor.java
SecurityResponse preHandle(HttpServletRequest request, String endpointId) { if (CorsUtils.isPreFlightRequest(request)) { return SecurityResponse.success(); }//from w ww . j a va 2s. c om try { if (!StringUtils.hasText(this.applicationId)) { throw new CloudFoundryAuthorizationException(Reason.SERVICE_UNAVAILABLE, "Application id is not available"); } if (this.cloudFoundrySecurityService == null) { throw new CloudFoundryAuthorizationException(Reason.SERVICE_UNAVAILABLE, "Cloud controller URL is not available"); } if (HttpMethod.OPTIONS.matches(request.getMethod())) { return SUCCESS; } check(request, endpointId); } catch (Exception ex) { logger.error(ex); if (ex instanceof CloudFoundryAuthorizationException) { CloudFoundryAuthorizationException cfException = (CloudFoundryAuthorizationException) ex; return new SecurityResponse(cfException.getStatusCode(), "{\"security_error\":\"" + cfException.getMessage() + "\"}"); } return new SecurityResponse(HttpStatus.INTERNAL_SERVER_ERROR, ex.getMessage()); } return SecurityResponse.success(); }