@Test
    public void shouldTerminateOnBlacklistedToken() throws CertificateEncodingException, IOException {
        config.setRequireTransportSecurity(true);
        config.setBlacklistUnsafeTokens(true);
        apiRequest.setTransportSecure(false);

        // First, do a request that causes the token to be blacklisted.
        String encoded = generateAndSerializeToken();
        apiRequest.getHeaders().put("Authorization", "Bearer " + encoded);
        keycloakOauthPolicy.apply(apiRequest, mContext, config, mChain);

        // Second, do the request again with the blacklisted token *with secure*.
        // It *must* still be blocked.
        apiRequest.setTransportSecure(true);
        keycloakOauthPolicy.apply(apiRequest, mContext, config, mChain);

        verify(mChain, times(2)).doFailure(any(PolicyFailure.class));
        verify(mChain, never()).doApply(any(ApiRequest.class));
    }
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