Skip to content

GraphQL extension does not handle invalid authorization tokens #26410

Open
@chschroe74

Description

Describe the bug

When we add authentication to a GraphQL endpoint (as Phillip Krüger did in his example project), we should get an HTTP 200 response with a valid JSON document if authentication fails (e.g., because of a missing token).

However, if an unparseable token is provided, we instead get an HTTP 401 response with no body. This behavior is inconsistent and makes it difficult to handle authentication failures in the client.

Expected behavior

We should get the same HTTP 200 response with an exception inside for any possible authentication failures. It should not matter if authentication fails because of a missing, invalid, or unparseable token or because of insufficient permissions (i.e. authorization).

Actual behavior

No response

How to Reproduce?

Use the example at https://github.com/phillip-kruger/graphql-experimental/tree/main/security-example

Pass an unparseable bearer token, like "foobar".

Output of uname -a or ver

No response

Output of java -version

openjdk version "17" 2021-09-14 // OpenJDK Runtime Environment (build 17+35-2724) // OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.10.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

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