0

In my Quarkus application, there are two types of authentication:

  1. Locally => I'm using quarkus-smallrye-jwt to authen local.
<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-smallrye-jwt</artifactId>
</dependency>
  1. SSO via Keycloak => I'm using quarkus-oidc to authen with Keycloak
<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-oidc</artifactId>
</dependency>

For the controllers are marked @Authenticated then @Inject JsonWebToken it will return DefaultJWTCallerPrincipal(proxy OidcJsonWebTokenProducer).

@Authenticated
@Path("/api/v1/oidc")
public class OIDCController {

    @Inject
    @IdToken
    JsonWebToken jwt;

    @POST
    @Path("/login")
    @Produces(MediaType.APPLICATION_JSON)
    public Uni<Response> login() {
        ...
    }
}

For normal controllers used local JWT then @Inject JsonWebToken it will return NullJsonWebToken(proxy OidcJsonWebTokenProducer) => my expected is that it will return DefaultJWTCallerPrincipal(proxy JwtPrincipalProducer) instead.

@Path("/api/v1/auth")
public class AuthenticationController {

    @Inject
    JsonWebToken jwt;

    @POST
    @Path("/login")
    @Produces(MediaType.APPLICATION_JSON)
    public Uni<Response> login() {
        ...
    }
}

So, do we have any ways to configure this one?

0 Answers0