Class ReactiveSecurityDataFetcherExceptionResolver
java.lang.Object
org.springframework.graphql.execution.ReactiveSecurityDataFetcherExceptionResolver
- All Implemented Interfaces:
DataFetcherExceptionResolver
public class ReactiveSecurityDataFetcherExceptionResolver
extends Object
implements DataFetcherExceptionResolver
Reactive
DataFetcherExceptionResolver
for Spring Security exceptions. For use in applications with a reactive
transport (e.g. WebFlux HTTP endpoint).- Since:
- 1.0.0
- Author:
- Rob Winch, Rossen Stoyanchev
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<List<GraphQLError>>
resolveException
(Throwable ex, DataFetchingEnvironment environment) Resolve the given exception and return the error(s) to add to the response.void
setAuthenticationTrustResolver
(org.springframework.security.authentication.AuthenticationTrustResolver trustResolver) Set the resolver to use to check if an authentication is anonymous that in turn determines whetherAccessDeniedException
is classified as "unauthorized" or "forbidden".
-
Constructor Details
-
ReactiveSecurityDataFetcherExceptionResolver
public ReactiveSecurityDataFetcherExceptionResolver()
-
-
Method Details
-
setAuthenticationTrustResolver
public void setAuthenticationTrustResolver(org.springframework.security.authentication.AuthenticationTrustResolver trustResolver) Set the resolver to use to check if an authentication is anonymous that in turn determines whetherAccessDeniedException
is classified as "unauthorized" or "forbidden".- Parameters:
trustResolver
- the resolver to use
-
resolveException
public reactor.core.publisher.Mono<List<GraphQLError>> resolveException(Throwable ex, DataFetchingEnvironment environment) Description copied from interface:DataFetcherExceptionResolver
Resolve the given exception and return the error(s) to add to the response.Implementations can use
GraphqlErrorBuilder.newError(DataFetchingEnvironment)
to create an error with the coordinates of the target field, and useErrorType
to specify a category for the error.- Specified by:
resolveException
in interfaceDataFetcherExceptionResolver
- Parameters:
ex
- the exception to resolveenvironment
- the environment for the invokedDataFetcher
- Returns:
- a
Mono
with errors to add to the GraphQL response; if theMono
completes with an empty List, the exception is resolved without any errors added to the response; if theMono
completes empty, without emitting a List, the exception remains unresolved and that allows other resolvers to resolve it.
-