private void initializeJwksBackend() {
        JWK[] jwk = {JWKBuilder.create()
                .kid(KeyUtils.createKeyId(idpPair.getPublic()))
                .algorithm("RS256")
                .rsa(idpPair.getPublic(), idpCertificates[0])};
        JSONWebKeySet jwks = new JSONWebKeySet();
        jwks.setKeys(jwk);

        String jwksString = null;
        try {
            jwksString = new ObjectMapper().writeValueAsString(jwks);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }

        mockServerClient.when(request()
                .withMethod("GET")
                .withPath("/auth/realms/apiman-realm/protocol/openid-connect/certs"))
                .respond(response().withStatusCode(200).withBody(jwksString));

        mockServerClient.when(request()
                .withMethod("GET")
                .withPath("/auth/realms/apiman-realm/.well-known/openid-configuration"))
                .respond(response().withStatusCode(200)
                .withBody("{\n" +
                        "  \"issuer\": \"http://localhost:1080/auth/realms/apiman-realm\",\n" +
                        "  \"authorization_endpoint\": \"http://localhost:1080/auth/realms/apiman-realm/protocol/openid-connect/auth\",\n" +
                        "  \"token_endpoint\": \"http://localhost:1080/auth/realms/apiman-realm/protocol/openid-connect/token\",\n" +
                        "  \"token_introspection_endpoint\": \"http://localhost:1080/auth/realms/apiman-realm/protocol/openid-connect/token/introspect\",\n" +
                        "  \"userinfo_endpoint\": \"http://localhost:1080/auth/realms/apiman-realm/protocol/openid-connect/userinfo\",\n" +
                        "  \"end_session_endpoint\": \"http://localhost:1080/auth/realms/apiman-realm/protocol/openid-connect/logout\",\n" +
                        "  \"jwks_uri\": \"http://localhost:1080/auth/realms/apiman-realm/protocol/openid-connect/certs\",\n" +
                        "  \"check_session_iframe\": \"http://localhost:1080/auth/realms/apiman-realm/protocol/openid-connect/login-status-iframe.html\",\n" +
                        "  \"introspection_endpoint\": \"http://localhost:1080/auth/realms/apiman-realm/protocol/openid-connect/token/introspect\"\n" +
                        "}"));
    }
Test the {@link KeycloakOauthPolicy}.

With thanks to the Keycloak project for their RSAVerifierTest whose setup procedures are adapted here for
our requirements.

@author Marc Savy {@literal <msavy@redhat.com>}
plugins/keycloak-oauth-policy/src/test/java/io/apiman/plugins/keycloak_oauth_policy/KeycloakOauthPolicyTest.java