use of io.strimzi.api.kafka.model.KafkaAuthorizationOpaBuilder in project strimzi by strimzi.
the class KafkaBrokerConfigurationBuilderTest method testOpaAuthorization.
@ParallelTest
public void testOpaAuthorization() {
KafkaAuthorization auth = new KafkaAuthorizationOpaBuilder().withUrl("http://opa:8181/v1/data/kafka/allow").withAllowOnError(true).withInitialCacheCapacity(1000).withMaximumCacheSize(10000).withExpireAfterMs(60000).addToSuperUsers("jack", "CN=conor").build();
String configuration = new KafkaBrokerConfigurationBuilder(Reconciliation.DUMMY_RECONCILIATION).withAuthorization("my-cluster", auth).build();
assertThat(configuration, isEquivalent("authorizer.class.name=org.openpolicyagent.kafka.OpaAuthorizer\n" + "opa.authorizer.url=http://opa:8181/v1/data/kafka/allow\n" + "opa.authorizer.allow.on.error=true\n" + "opa.authorizer.metrics.enabled=false\n" + "opa.authorizer.cache.initial.capacity=1000\n" + "opa.authorizer.cache.maximum.size=10000\n" + "opa.authorizer.cache.expire.after.seconds=60\n" + "super.users=User:CN=my-cluster-kafka,O=io.strimzi;User:CN=my-cluster-entity-topic-operator,O=io.strimzi;User:CN=my-cluster-entity-user-operator,O=io.strimzi;User:CN=my-cluster-kafka-exporter,O=io.strimzi;User:CN=my-cluster-cruise-control,O=io.strimzi;User:CN=cluster-operator,O=io.strimzi;User:jack;User:CN=conor"));
}
use of io.strimzi.api.kafka.model.KafkaAuthorizationOpaBuilder in project strimzi-kafka-operator by strimzi.
the class KafkaBrokerConfigurationBuilderTest method testOpaAuthorization.
@ParallelTest
public void testOpaAuthorization() {
KafkaAuthorization auth = new KafkaAuthorizationOpaBuilder().withUrl("http://opa:8181/v1/data/kafka/allow").withAllowOnError(true).withInitialCacheCapacity(1000).withMaximumCacheSize(10000).withExpireAfterMs(60000).addToSuperUsers("jack", "CN=conor").build();
String configuration = new KafkaBrokerConfigurationBuilder(Reconciliation.DUMMY_RECONCILIATION).withAuthorization("my-cluster", auth).build();
assertThat(configuration, isEquivalent("authorizer.class.name=org.openpolicyagent.kafka.OpaAuthorizer\n" + "opa.authorizer.url=http://opa:8181/v1/data/kafka/allow\n" + "opa.authorizer.allow.on.error=true\n" + "opa.authorizer.metrics.enabled=false\n" + "opa.authorizer.cache.initial.capacity=1000\n" + "opa.authorizer.cache.maximum.size=10000\n" + "opa.authorizer.cache.expire.after.seconds=60\n" + "super.users=User:CN=my-cluster-kafka,O=io.strimzi;User:CN=my-cluster-entity-topic-operator,O=io.strimzi;User:CN=my-cluster-entity-user-operator,O=io.strimzi;User:CN=my-cluster-kafka-exporter,O=io.strimzi;User:CN=my-cluster-cruise-control,O=io.strimzi;User:CN=cluster-operator,O=io.strimzi;User:jack;User:CN=conor"));
}
use of io.strimzi.api.kafka.model.KafkaAuthorizationOpaBuilder in project strimzi-kafka-operator by strimzi.
the class KafkaBrokerConfigurationBuilderTest method testOpaAuthorizationWithDefaults.
@ParallelTest
public void testOpaAuthorizationWithDefaults() {
KafkaAuthorization auth = new KafkaAuthorizationOpaBuilder().withUrl("http://opa:8181/v1/data/kafka/allow").build();
String configuration = new KafkaBrokerConfigurationBuilder(Reconciliation.DUMMY_RECONCILIATION).withAuthorization("my-cluster", auth).build();
assertThat(configuration, isEquivalent("authorizer.class.name=org.openpolicyagent.kafka.OpaAuthorizer\n" + "opa.authorizer.url=http://opa:8181/v1/data/kafka/allow\n" + "opa.authorizer.allow.on.error=false\n" + "opa.authorizer.metrics.enabled=false\n" + "opa.authorizer.cache.initial.capacity=5000\n" + "opa.authorizer.cache.maximum.size=50000\n" + "opa.authorizer.cache.expire.after.seconds=3600\n" + "super.users=User:CN=my-cluster-kafka,O=io.strimzi;User:CN=my-cluster-entity-topic-operator,O=io.strimzi;User:CN=my-cluster-entity-user-operator,O=io.strimzi;User:CN=my-cluster-kafka-exporter,O=io.strimzi;User:CN=my-cluster-cruise-control,O=io.strimzi;User:CN=cluster-operator,O=io.strimzi"));
}
use of io.strimzi.api.kafka.model.KafkaAuthorizationOpaBuilder in project strimzi by strimzi.
the class KafkaBrokerConfigurationBuilderTest method testOpaAuthorizationWithDefaults.
@ParallelTest
public void testOpaAuthorizationWithDefaults() {
KafkaAuthorization auth = new KafkaAuthorizationOpaBuilder().withUrl("http://opa:8181/v1/data/kafka/allow").build();
String configuration = new KafkaBrokerConfigurationBuilder(Reconciliation.DUMMY_RECONCILIATION).withAuthorization("my-cluster", auth).build();
assertThat(configuration, isEquivalent("authorizer.class.name=org.openpolicyagent.kafka.OpaAuthorizer\n" + "opa.authorizer.url=http://opa:8181/v1/data/kafka/allow\n" + "opa.authorizer.allow.on.error=false\n" + "opa.authorizer.metrics.enabled=false\n" + "opa.authorizer.cache.initial.capacity=5000\n" + "opa.authorizer.cache.maximum.size=50000\n" + "opa.authorizer.cache.expire.after.seconds=3600\n" + "super.users=User:CN=my-cluster-kafka,O=io.strimzi;User:CN=my-cluster-entity-topic-operator,O=io.strimzi;User:CN=my-cluster-entity-user-operator,O=io.strimzi;User:CN=my-cluster-kafka-exporter,O=io.strimzi;User:CN=my-cluster-cruise-control,O=io.strimzi;User:CN=cluster-operator,O=io.strimzi"));
}
Aggregations