public class ReactiveSecurityDataFetcherExceptionResolver extends Object implements DataFetcherExceptionResolver
DataFetcherExceptionResolver
for Spring Security exceptions. For use in applications with a reactive
transport (e.g. WebFlux HTTP endpoint).Constructor and Description |
---|
ReactiveSecurityDataFetcherExceptionResolver() |
Modifier and Type | Method and Description |
---|---|
reactor.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 whether
AccessDeniedException is classified
as "unauthorized" or "forbidden". |
public ReactiveSecurityDataFetcherExceptionResolver()
public void setAuthenticationTrustResolver(org.springframework.security.authentication.AuthenticationTrustResolver trustResolver)
AccessDeniedException
is classified
as "unauthorized" or "forbidden".trustResolver
- the resolver to usepublic reactor.core.publisher.Mono<List<GraphQLError>> resolveException(Throwable ex, DataFetchingEnvironment environment)
DataFetcherExceptionResolver
Implementations can use
GraphqlErrorBuilder.newError(DataFetchingEnvironment)
to
create an error with the coordinates of the target field, and use
ErrorType
to specify a category for the error.
resolveException
in interface DataFetcherExceptionResolver
ex
- the exception to resolveenvironment
- the environment for the invoked DataFetcher
Mono
with errors to add to the GraphQL response;
if the Mono
completes with an empty List, the exception is resolved
without any errors added to the response; if the Mono
completes
empty, without emitting a List, the exception remains unresolved and gives
other resolvers a chance.