Search code examples
javajax-rsresteasy

JAX-RS cannot handle a Authorization header with a JWT



*Possibly a duplicate but cannot find it lol*

I'm using Quarkus with quarkus-resteasy and I'm trying to implement a simple GET method that will syso the headers, but before that, I needed to create a method that could handle a curl request :

@GET
public Response foo() {
    return Response.status(200).entity("Hello world !").build();
}
curl --location 'localhost:8080/api/...''
> Hello world !

Everything was fine until i tried to put an Authorization Header with a bearer :

curl --location 'localhost:8080/api/...' --header 'Authorization: Bearer eyJhbGc....'
>

I firstly tough Authorization was a "banned" header for some reason.. but if i try the same request with a different value..

curl --location 'localhost:8080/api/...' --header 'Authorization: foo'
> Hello World !

I'm getting an Hello World !..

I've also tried to use @HeaderParam("Authorization") but same problem, with a Bearer I cannot "target" my endpoint Anyone ever face this problem ?
May the value is too long.. (1795 chars)


Solution

  • I've found the problem !!

    It's simply because I didnt setup my project properly : https://quarkus.io/guides/security-oidc-bearer-token-authentication

    I can't send request with a bearer like i'm doing, i've to "configure" the project before.. ups !!