title: Quarkus: Integration tests - how to mock OIDC?
body: <p>I am trying to run some integration tests with Quarkus and protecting our JAX-RS application using Bearer Token Authorization.</p>
  <p>Based on what we can see on the <a href="https://quarkus.io/guides/security-openid-connect#wiremock" rel="nofollow noreferrer">Quarkus Guide</a> in theory it is possible to mock the behaviour of the authorization mechanism just to not need to have an Authorization Server (like Keycloak) running in local.</p>
  <p>The problem I found is that I can't find the <code>OidcWiremockTestResource.class</code> in any of the dependencies described. Where it is?</p>
  <p>Also, how we can avoid having an Authorization Server running for running some tests against our endpoints?</p>
  <p>I found that it is possible to mock the <code>JsonWebToken</code> and the <code>SecurityIdentity</code> just using:</p>
  <pre><code>    @InjectMock
      SecurityIdentity identity;
  
      @InjectMock
      JsonWebToken token;
  </code></pre>
  <p>and it worked pretty well, but still when I try to run the integration tests the Authorization Server is required to be up and running. Otherwise Quarkus fails trying to connect to it.</p>
  <p>I tried to disable the OIDC extension (<code>quarkus.oidc.enabled=false</code>) but then, of course, the code does not compile (the endpoints do not recognize the dependencies).</p>
  <p>So, which one is the best approach for just skip the OIDC connection when running some Integration Test?</p>
  <p>Best,</p>