-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow annotations to be used to specify scram users
- Loading branch information
Showing
6 changed files
with
193 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
impl/src/main/java/io/kroxylicious/testing/kafka/common/SaslMechanism.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright Kroxylicious Authors. | ||
* | ||
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package io.kroxylicious.testing.kafka.common; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import io.kroxylicious.testing.kafka.api.KafkaClusterConstraint; | ||
import io.kroxylicious.testing.kafka.api.KafkaClusterProvisioningStrategy; | ||
|
||
/** | ||
* Annotation constraining a {@link KafkaClusterProvisioningStrategy} to | ||
* provide a cluster with an external listener configured to expect the given | ||
* SASL mechanism. | ||
*/ | ||
@Target({ ElementType.PARAMETER, ElementType.FIELD }) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@KafkaClusterConstraint | ||
public @interface SaslMechanism { | ||
String value(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
impl/src/main/java/io/kroxylicious/testing/kafka/common/SaslUser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright Kroxylicious Authors. | ||
* | ||
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package io.kroxylicious.testing.kafka.common; | ||
|
||
import java.lang.annotation.*; | ||
|
||
import io.kroxylicious.testing.kafka.api.KafkaClusterConstraint; | ||
import io.kroxylicious.testing.kafka.api.KafkaClusterProvisioningStrategy; | ||
|
||
/** | ||
* Annotation constraining a {@link KafkaClusterProvisioningStrategy} to | ||
* provide a cluster with SASL enabled listener with the given user. | ||
* <br/> | ||
* If a @{@link SaslMechanism} constraint is not also provided, SASL PLAIN | ||
* is assumed. | ||
*/ | ||
@Target({ ElementType.PARAMETER, ElementType.FIELD }) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Repeatable(SaslUser.List.class) | ||
@KafkaClusterConstraint | ||
public @interface SaslUser { | ||
|
||
String user(); | ||
|
||
String password(); | ||
|
||
/** | ||
* The interface User password. | ||
*/ | ||
@Target({ ElementType.FIELD, ElementType.PARAMETER }) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@KafkaClusterConstraint | ||
@interface List { | ||
SaslUser[] value(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters