Class SecurityDataFetcherExceptionResolver

java.lang.Object
org.springframework.graphql.execution.DataFetcherExceptionResolverAdapter
org.springframework.graphql.execution.SecurityDataFetcherExceptionResolver
All Implemented Interfaces:
DataFetcherExceptionResolver

public class SecurityDataFetcherExceptionResolver extends DataFetcherExceptionResolverAdapter
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
  • 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 whether AccessDeniedException is classified as "unauthorized" or "forbidden".
      Parameters:
      trustResolver - the resolver to use
    • resolveToSingleError

      protected GraphQLError resolveToSingleError(Throwable ex, DataFetchingEnvironment environment)
      Description copied from class: DataFetcherExceptionResolverAdapter
      Override this method to resolve an Exception to a single GraphQL error.
      Overrides:
      resolveToSingleError in class DataFetcherExceptionResolverAdapter
      Parameters:
      ex - the exception to resolve
      environment - the environment for the invoked DataFetcher
      Returns:
      the resolved error or null if unresolved