SecurityDataFetcherExceptionResolver handles AuthenticationException

This is unlikely to happen as authentication happens prior to reaching
the GraphQL APIs. However, a user may decide to implement security within
GraphQL as it is possible to do through a Spring Controller.
This commit is contained in:
Rob Winch
2021-06-22 15:32:38 -05:00
parent cedb5fb40d
commit 4aed51438a

View File

@@ -28,7 +28,7 @@ public class SecurityDataFetcherExceptionResolver implements DataFetcherExceptio
@Override
public Mono<List<GraphQLError>> resolveException(Throwable exception, DataFetchingEnvironment environment) {
if (exception instanceof AuthenticationException) {
// TOTO: should this be empty ?
return unauthorized(environment);
}
if (exception instanceof AccessDeniedException) {
return ReactiveSecurityContextHolder.getContext()