Class SecurityDataFetcherExceptionResolver
java.lang.Object
org.springframework.graphql.execution.DataFetcherExceptionResolverAdapter
org.springframework.graphql.execution.SecurityDataFetcherExceptionResolver
- All Implemented Interfaces:
DataFetcherExceptionResolver
DataFetcherExceptionResolver
for Spring Security exceptions. For use in applications with a non-reactive
transport (e.g. Spring MVC HTTP endpoint).- Since:
- 1.0.0
- Author:
- Rob Winch, Rossen Stoyanchev
-
Field Summary
Fields inherited from class org.springframework.graphql.execution.DataFetcherExceptionResolverAdapter
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected GraphQLError
resolveToSingleError
(Throwable ex, DataFetchingEnvironment environment) Override this method to resolve an Exception to a single GraphQL error.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".Methods inherited from class org.springframework.graphql.execution.DataFetcherExceptionResolverAdapter
isThreadLocalContextAware, resolveException, resolveToMultipleErrors, setThreadLocalContextAware
-
Constructor Details
-
SecurityDataFetcherExceptionResolver
public SecurityDataFetcherExceptionResolver()
-
-
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
-
resolveToSingleError
Description copied from class:DataFetcherExceptionResolverAdapter
Override this method to resolve an Exception to a single GraphQL error.- Overrides:
resolveToSingleError
in classDataFetcherExceptionResolverAdapter
- Parameters:
ex
- the exception to resolveenvironment
- the environment for the invokedDataFetcher
- Returns:
- the resolved error or
null
if unresolved
-