@Override public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) { String methodName = returnType.getMethod().getName(); if ("_createConsent".equals(methodName)) { response.getHeaders().add("Aspsp-Sca-Approach", getScaApproach().name()); if (!hasError(body)) { ConsentsResponse201 consentResponse = (ConsentsResponse201) body; response.getHeaders().add("Location", Optional.ofNullable(consentResponse.getLinks().get("self")) .map(Object::toString) .orElse(null)); } } else if ("_startConsentAuthorisation".equals(methodName) || "_updateConsentsPsuData".equals(methodName)) { response.getHeaders().add("Aspsp-Sca-Approach", getScaApproach().name()); } return body; } }
@Override public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) { String methodName = returnType.getMethod().getName(); if ("_createConsent".equals(methodName)) { response.getHeaders().add("Aspsp-Sca-Approach", getScaApproach().name()); if (!hasError(body, ConsentsResponse201.class)) { ConsentsResponse201 consentResponse = (ConsentsResponse201) body; response.getHeaders().add("Location", Optional.ofNullable(consentResponse.getLinks().get("self")) .map(Object::toString) .orElse(null)); } } else if ("_startConsentAuthorisation".equals(methodName) || "_updateConsentsPsuData".equals(methodName)) { response.getHeaders().add("Aspsp-Sca-Approach", getScaApproach().name()); } return body; } }
@Override public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) { String methodName = returnType.getMethod().getName(); if ("_createConsent".equals(methodName)) { response.getHeaders().add("Aspsp-Sca-Approach", getScaApproach().name()); if (!hasError(body, ConsentsResponse201.class)) { ConsentsResponse201 consentResponse = (ConsentsResponse201) body; response.getHeaders().add("Location", Optional.ofNullable(consentResponse.getLinks().get("self")) .map(Object::toString) .orElse(null)); } } else if ("_startConsentAuthorisation".equals(methodName) || "_updateConsentsPsuData".equals(methodName)) { response.getHeaders().add("Aspsp-Sca-Approach", getScaApproach().name()); } return body; } }