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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected GraphQLErrorresolveToSingleError(Throwable ex, 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 org.springframework.graphql.execution.DataFetcherExceptionResolverAdapter
from, 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
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
-