forked from eugenp/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
24 changed files
with
251 additions
and
23 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
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
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
18 changes: 17 additions & 1 deletion
18
spring-ai-2/src/main/java/com/baeldung/spring/ai/om/OrderManagementApplication.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
10 changes: 9 additions & 1 deletion
10
spring-ai-2/src/main/java/com/baeldung/springai/chromadb/Application.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
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
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
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
23 changes: 23 additions & 0 deletions
23
spring-kafka/src/main/java/com/baeldung/sasl/KafkaConsumer.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,23 @@ | ||
package com.baeldung.sasl; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.kafka.clients.consumer.ConsumerRecord; | ||
import org.springframework.kafka.annotation.KafkaListener; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Component | ||
@Slf4j | ||
public class KafkaConsumer { | ||
|
||
public static final String TOPIC = "test-topic"; | ||
public final List<String> messages = new ArrayList<>(); | ||
|
||
@KafkaListener(topics = TOPIC) | ||
public void receive(ConsumerRecord<String, String> consumerRecord) { | ||
log.info("Received payload: '{}'", consumerRecord.toString()); | ||
messages.add(consumerRecord.value()); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
spring-kafka/src/main/java/com/baeldung/sasl/KafkaSaslApplication.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,13 @@ | ||
package com.baeldung.sasl; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class KafkaSaslApplication { | ||
|
||
public static void main(String[] args) { | ||
System.setProperty("spring.config.name", "application-sasl"); | ||
SpringApplication.run(KafkaSaslApplication.class, args); | ||
} | ||
} |
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,19 @@ | ||
spring: | ||
kafka: | ||
bootstrap-servers: localhost:9092 | ||
properties: | ||
sasl.mechanism: GSSAPI | ||
sasl.jaas.config: > | ||
com.sun.security.auth.module.Krb5LoginModule required | ||
useKeyTab=true | ||
storeKey=true | ||
keyTab="./src/test/resources/sasl/keytabs/client.keytab" | ||
principal="[email protected]" | ||
serviceName="kafka"; | ||
security: | ||
protocol: "SASL_PLAINTEXT" | ||
consumer: | ||
group-id: test | ||
auto-offset-reset: earliest | ||
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer | ||
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer |
15 changes: 15 additions & 0 deletions
15
spring-kafka/src/test/java/com/baeldung/sasl/SprintContextTest.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,15 @@ | ||
package com.baeldung.sasl; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
|
||
@ExtendWith(SpringExtension.class) | ||
@SpringBootTest(classes = KafkaSaslApplication.class) | ||
class SpringContextTest { | ||
|
||
@Test | ||
void whenSpringContextIsBootstrapped_thenNoExceptions() { | ||
} | ||
} |
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,15 @@ | ||
# Use a minimal base image | ||
FROM debian:bullseye | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y krb5-kdc krb5-admin-server krb5-user && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY config/krb5.conf /etc/krb5.conf | ||
COPY setup_kdc.sh /setup_kdc.sh | ||
|
||
RUN chmod +x /setup_kdc.sh | ||
|
||
EXPOSE 88 749 | ||
|
||
CMD ["/setup_kdc.sh"] |
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 @@ | ||
*/[email protected] * |
17 changes: 17 additions & 0 deletions
17
spring-kafka/src/test/resources/sasl/config/kafka_server_jaas.conf
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,17 @@ | ||
KafkaServer { | ||
com.sun.security.auth.module.Krb5LoginModule required | ||
useKeyTab=true | ||
storeKey=true | ||
keyTab="/etc/kafka/keytabs/kafka.keytab" | ||
principal="kafka/[email protected]" | ||
serviceName="kafka"; | ||
}; | ||
|
||
Client { | ||
com.sun.security.auth.module.Krb5LoginModule required | ||
useKeyTab=true | ||
storeKey=true | ||
keyTab="/etc/kafka/keytabs/client.keytab" | ||
principal="[email protected]" | ||
serviceName="kafka"; | ||
}; |
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,17 @@ | ||
[libdefaults] | ||
default_realm = BAELDUNG.COM | ||
dns_lookup_realm = false | ||
dns_lookup_kdc = false | ||
forwardable = true | ||
rdns = true | ||
|
||
[realms] | ||
BAELDUNG.COM = { | ||
kdc = kdc | ||
admin_server = kdc | ||
} | ||
|
||
[logging] | ||
default = FILE:/var/log/krb5libs.log | ||
kdc = FILE:/var/log/krb5kdc.log | ||
admin_server = FILE:/var/log/kadmind.log |
7 changes: 7 additions & 0 deletions
7
spring-kafka/src/test/resources/sasl/config/zookeeper_jaas.conf
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,7 @@ | ||
Server { | ||
com.sun.security.auth.module.Krb5LoginModule required | ||
useKeyTab=true | ||
storeKey=true | ||
keyTab="/etc/kafka/keytabs/zookeeper.keytab" | ||
principal="zookeeper/[email protected]"; | ||
}; |
Oops, something went wrong.