private void configureKeycloakDeployment(KeycloakOauthConfigBean config) {
        if (config.getRealm() == null) return;

        AdapterConfig adapterConfig = new AdapterConfig();
        String realmUrl = getRealmUrl(config);
        adapterConfig.setRealm(getRealmName(realmUrl));
        adapterConfig.setAuthServerUrl(getAuthServerUrl(realmUrl));
        // We just need a dummy resource because we only need the keycloak deployment for validating tokens
        adapterConfig.setResource("api-gateway-api");

        keycloakDeployment = KeycloakDeploymentBuilder.build(adapterConfig);
        keycloakDeployment.setPublicKeyLocator(new JWKPublicKeyLocator());

        realmCache = realmUrl;
    }
@see io.apiman.gateway.engine.policies.AbstractMappedPolicy#doApply(io.apiman.gateway.engine.beans.ApiRequest,
     io.apiman.gateway.engine.policy.IPolicyContext, java.lang.Object,
     io.apiman.gateway.engine.policy.IPolicyChain)
plugins/keycloak-oauth-policy/src/main/java/io/apiman/plugins/keycloak_oauth_policy/KeycloakOauthPolicy.java