Skip to content

Raise AuthenticationCredentialsNotFoundException if Principal is not present and declared as not optional #714

Closed as not planned
@koenpunt

Description

@koenpunt

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions