Search in sources :

Example 41 with KafkaListenerAuthenticationOAuthBuilder

use of io.strimzi.api.kafka.model.listener.KafkaListenerAuthenticationOAuthBuilder in project strimzi by strimzi.

the class KafkaClusterOAuthValidationTest method testOAuthValidationWithOAuthWithJwksWithNotJwt.

@ParallelTest
public void testOAuthValidationWithOAuthWithJwksWithNotJwt() {
    assertThrows(InvalidResourceException.class, () -> {
        KafkaListenerAuthenticationOAuth auth = new KafkaListenerAuthenticationOAuthBuilder().withValidIssuerUri("http://valid-issuer").withJwksEndpointUri("http://jwks-endpoint").withJwksExpirySeconds(160).withJwksRefreshSeconds(50).withUserNameClaim("preferred_username").withAccessTokenIsJwt(false).build();
        ListenersValidator.validate(Reconciliation.DUMMY_RECONCILIATION, 3, getListeners(auth));
    });
}
Also used : KafkaListenerAuthenticationOAuth(io.strimzi.api.kafka.model.listener.KafkaListenerAuthenticationOAuth) KafkaListenerAuthenticationOAuthBuilder(io.strimzi.api.kafka.model.listener.KafkaListenerAuthenticationOAuthBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 42 with KafkaListenerAuthenticationOAuthBuilder

use of io.strimzi.api.kafka.model.listener.KafkaListenerAuthenticationOAuthBuilder in project strimzi by strimzi.

the class KafkaClusterOAuthValidationTest method testOAuthValidationExpirySecondsWithoutEndpointUri.

@ParallelTest
public void testOAuthValidationExpirySecondsWithoutEndpointUri() {
    assertThrows(InvalidResourceException.class, () -> {
        KafkaListenerAuthenticationOAuth auth = new KafkaListenerAuthenticationOAuthBuilder().withIntrospectionEndpointUri("http://introspection").withClientId("my-client-id").withJwksExpirySeconds(100).build();
        ListenersValidator.validate(Reconciliation.DUMMY_RECONCILIATION, 3, getListeners(auth));
    });
}
Also used : KafkaListenerAuthenticationOAuth(io.strimzi.api.kafka.model.listener.KafkaListenerAuthenticationOAuth) KafkaListenerAuthenticationOAuthBuilder(io.strimzi.api.kafka.model.listener.KafkaListenerAuthenticationOAuthBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 43 with KafkaListenerAuthenticationOAuthBuilder

use of io.strimzi.api.kafka.model.listener.KafkaListenerAuthenticationOAuthBuilder in project strimzi by strimzi.

the class KafkaClusterOAuthValidationTest method testOAuthValidationWithIntrospectionMinimalPlain.

@ParallelTest
public void testOAuthValidationWithIntrospectionMinimalPlain() {
    KafkaListenerAuthenticationOAuth auth = new KafkaListenerAuthenticationOAuthBuilder().withClientId("my-client-id").withValidIssuerUri("http://valid-issuer").withIntrospectionEndpointUri("http://introspection").withNewClientSecret().withSecretName("my-secret-secret").withKey("my-secret-key").endClientSecret().build();
    ListenersValidator.validate(Reconciliation.DUMMY_RECONCILIATION, 3, getListeners(auth));
}
Also used : KafkaListenerAuthenticationOAuth(io.strimzi.api.kafka.model.listener.KafkaListenerAuthenticationOAuth) KafkaListenerAuthenticationOAuthBuilder(io.strimzi.api.kafka.model.listener.KafkaListenerAuthenticationOAuthBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 44 with KafkaListenerAuthenticationOAuthBuilder

use of io.strimzi.api.kafka.model.listener.KafkaListenerAuthenticationOAuthBuilder in project strimzi by strimzi.

the class KafkaClusterOAuthValidationTest method testOAuthValidationWithJwksExpiryAndIntrospection.

@ParallelTest
public void testOAuthValidationWithJwksExpiryAndIntrospection() {
    assertThrows(InvalidResourceException.class, () -> {
        KafkaListenerAuthenticationOAuth auth = new KafkaListenerAuthenticationOAuthBuilder().withClientId("my-client-id").withValidIssuerUri("http://valid-issuer").withIntrospectionEndpointUri("http://introspection").withJwksExpirySeconds(120).withNewClientSecret().withSecretName("my-secret-secret").withKey("my-secret-key").endClientSecret().build();
        ListenersValidator.validate(Reconciliation.DUMMY_RECONCILIATION, 3, getListeners(auth));
    });
}
Also used : KafkaListenerAuthenticationOAuth(io.strimzi.api.kafka.model.listener.KafkaListenerAuthenticationOAuth) KafkaListenerAuthenticationOAuthBuilder(io.strimzi.api.kafka.model.listener.KafkaListenerAuthenticationOAuthBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 45 with KafkaListenerAuthenticationOAuthBuilder

use of io.strimzi.api.kafka.model.listener.KafkaListenerAuthenticationOAuthBuilder in project strimzi by strimzi.

the class KafkaClusterOAuthValidationTest method testOAuthValidationWithReauthAndIntrospection.

@ParallelTest
public void testOAuthValidationWithReauthAndIntrospection() {
    KafkaListenerAuthenticationOAuth auth = new KafkaListenerAuthenticationOAuthBuilder().withClientId("my-client-id").withValidIssuerUri("http://valid-issuer").withIntrospectionEndpointUri("http://introspection").withMaxSecondsWithoutReauthentication(1800).withNewClientSecret().withSecretName("my-secret-secret").withKey("my-secret-key").endClientSecret().build();
    ListenersValidator.validate(Reconciliation.DUMMY_RECONCILIATION, 3, getListeners(auth));
}
Also used : KafkaListenerAuthenticationOAuth(io.strimzi.api.kafka.model.listener.KafkaListenerAuthenticationOAuth) KafkaListenerAuthenticationOAuthBuilder(io.strimzi.api.kafka.model.listener.KafkaListenerAuthenticationOAuthBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Aggregations

KafkaListenerAuthenticationOAuthBuilder (io.strimzi.api.kafka.model.listener.KafkaListenerAuthenticationOAuthBuilder)64 ParallelTest (io.strimzi.test.annotations.ParallelTest)64 KafkaListenerAuthenticationOAuth (io.strimzi.api.kafka.model.listener.KafkaListenerAuthenticationOAuth)44 GenericKafkaListenerBuilder (io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListenerBuilder)20 GenericKafkaListener (io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListener)12 Kafka (io.strimzi.api.kafka.model.Kafka)10 KafkaBuilder (io.strimzi.api.kafka.model.KafkaBuilder)10 Container (io.fabric8.kubernetes.api.model.Container)8 StatefulSet (io.fabric8.kubernetes.api.model.apps.StatefulSet)8 ArrayList (java.util.ArrayList)8 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)6 ConfigMapKeySelectorBuilder (io.fabric8.kubernetes.api.model.ConfigMapKeySelectorBuilder)6 ContainerPort (io.fabric8.kubernetes.api.model.ContainerPort)6 EnvVar (io.fabric8.kubernetes.api.model.EnvVar)6 HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)6 HostAlias (io.fabric8.kubernetes.api.model.HostAlias)6 HostAliasBuilder (io.fabric8.kubernetes.api.model.HostAliasBuilder)6 IntOrString (io.fabric8.kubernetes.api.model.IntOrString)6 LabelSelectorBuilder (io.fabric8.kubernetes.api.model.LabelSelectorBuilder)6 LabelSelectorRequirementBuilder (io.fabric8.kubernetes.api.model.LabelSelectorRequirementBuilder)6