Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
koenpunt opened this issue Jun 2, 2023 · 2 comments
Labels
status: superseded Issue is superseded by another type: enhancement A general enhancement

Comments

@koenpunt
Copy link
Contributor

koenpunt commented Jun 2, 2023

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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 2, 2023
@rstoyanchev rstoyanchev added this to the 1.3 Backlog milestone Jun 28, 2023
@rstoyanchev rstoyanchev added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 28, 2023
@rstoyanchev
Copy link
Contributor

Seems like a reasonable enhancement. /cc @rwinch for comment if any.

@rstoyanchev rstoyanchev changed the title Non-nullable Principal argument should raise "Unauthorized" exception Raise AuthenticationCredentialsNotFoundException if Principal is not present and declared as not optional Sep 14, 2023
@rstoyanchev
Copy link
Contributor

Superseded by #790.

@rstoyanchev rstoyanchev closed this as not planned Won't fix, can't repro, duplicate, stale Sep 14, 2023
@rstoyanchev rstoyanchev added the status: superseded Issue is superseded by another label Sep 14, 2023
@rstoyanchev rstoyanchev removed this from the 1.3 Backlog milestone Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded Issue is superseded by another type: enhancement A general enhancement
Projects
None yet
3 participants