Skip to content

Disable OidcClientFilter at runtime for simpler application testing #37360

@sberyozkin

Description

@sberyozkin

Discussed in #37283

Originally posted by lmartella1 November 23, 2023
Hello,
in our Quarkus application we rely on the OidcClientFilter to instrument Quarkus in acquiring a token before calling a given REST Client.
In certain cases, such as when we run quarkus tests or we deploy the application in a local environment, we believe it could be useful to disable the OidcClientFilter in a way that the token is not acquired and the client call is made to the remote (in many cases mocked) server without any bearer token. In all these cases, is more relevant to test the application business logic than the actual token acquisition and security aspects.

Looking at the current available configuration for the oidc-client, I don't see any runtime-overridable configuration that can serve this scope and instrument Quarkus to just ignore the OidcClientFilter annotation either globally, for all the oidc clients, or specifically for a given named oidc client.

What is your vision about this use case? Is it a feature that could be implemented in a future version of the framework?

For reference, we have already played with :

  • quarkus.oidc-client.enabled=false which works globally in disabling the token acquisition for all the annotated OidcClientFilter REST Clients but which is fixed at build time and cannot be overridden at runtime.
  • quarkus.oidc-client."id".client-enabled=false which is disabling a given oidc-client configuration in a way that, if the client is used then the following runtime exception is raised: io.quarkus.oidc.client.runtime.DisabledOidcClientException.

Thanks in advance,

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions