Currently when defining a query or mutation method that has a non-nullable Principal argument, it fails with "Unresolved NullPointerException for executionId ..." when no principal is present in the security context.
The same scenario in a @RestController would result in 401 Unauthorized response.
It would be convenient if spring-graphql automatically validated the presence of a principal, when the argument is defined as non-null, and throws an AuthenticationException when not set, which then could be handled in an exception resolver.
Currently when defining a query or mutation method that has a non-nullable
Principalargument, it fails with "Unresolved NullPointerException for executionId ..." when no principal is present in the security context.The same scenario in a
@RestControllerwould result in401 Unauthorizedresponse.It would be convenient if spring-graphql automatically validated the presence of a principal, when the argument is defined as non-null, and throws an
AuthenticationExceptionwhen not set, which then could be handled in an exception resolver.