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 DataFetcherExceptionResolverAdapter
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected @Nullable graphql.GraphQLErrorresolveToSingleError(Throwable ex, graphql.schema.DataFetchingEnvironment environment) Override this method to resolve an Exception to a single GraphQL error.voidsetAuthenticationTrustResolver(org.springframework.security.authentication.AuthenticationTrustResolver trustResolver) Set the resolver to use to check if an authentication is anonymous that in turn determines whetherAccessDeniedExceptionis classified as "unauthorized" or "forbidden".Methods inherited from class 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 whetherAccessDeniedExceptionis classified as "unauthorized" or "forbidden".- Parameters:
trustResolver- the resolver to use
-
resolveToSingleError
protected @Nullable graphql.GraphQLError resolveToSingleError(Throwable ex, graphql.schema.DataFetchingEnvironment environment) Description copied from class:DataFetcherExceptionResolverAdapterOverride this method to resolve an Exception to a single GraphQL error.- Overrides:
resolveToSingleErrorin classDataFetcherExceptionResolverAdapter- Parameters:
ex- the exception to resolveenvironment- the environment for the invokedDataFetcher- Returns:
- the resolved error or
nullif unresolved
-