Skip to content

Commit c1822a7

Browse files
author
admitrov
committed
fix: update JWT decoder to use JWK Set URI and adjust SSL requirement in test realm
1 parent 8a2abb3 commit c1822a7

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

embedded-dynamodb/src/main/java/com/playtika/testcontainer/dynamodb/EmbeddedDynamoDBBootstrapConfiguration.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,26 @@ public GenericContainer<?> dynamoDb(DynamoDBProperties properties, Optional<Netw
6868
}
6969

7070
@Bean
71-
public DynamicPropertyRegistrar dynamodbDynamicPropertyRegistrar(@Qualifier(BEAN_NAME_EMBEDDED_DYNAMODB) GenericContainer<?> container, DynamoDBProperties properties) {
71+
public DynamicPropertyRegistrar dynamodbDynamicPropertyRegistrar(
72+
@Qualifier(BEAN_NAME_EMBEDDED_DYNAMODB) GenericContainer<?> container, DynamoDBProperties properties) {
7273
return registry -> {
73-
registry.add("embedded.dynamodb.port", () -> container.getMappedPort(properties.port));
74-
registry.add("embedded.dynamodb.host", container::getHost);
75-
registry.add("embedded.dynamodb.accessKey", properties::getAccessKey);
76-
registry.add("embedded.dynamodb.secretKey", properties::getSecretKey);
74+
var mappedPort = container.getMappedPort(properties.port);
75+
var host = container.getHost();
76+
var accessKey = properties.getAccessKey();
77+
var secretKey = properties.getSecretKey();
78+
79+
registry.add("embedded.dynamodb.port", () -> mappedPort);
80+
registry.add("embedded.dynamodb.host", () -> host);
81+
registry.add("embedded.dynamodb.accessKey", () -> accessKey);
82+
registry.add("embedded.dynamodb.secretKey", () -> secretKey);
7783
registry.add("embedded.dynamodb.networkAlias", () -> DYNAMODB_NETWORK_ALIAS);
7884
registry.add("embedded.dynamodb.internalPort", properties::getPort);
85+
86+
log.info("Started DynamoDb server. Connection details: host: {}, port: {}, accessKey:{}, secretKey: {}",
87+
host, mappedPort, accessKey, secretKey);
88+
log.info("Consult with the doc " +
89+
"https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.UsageNotes.html " +
90+
"for more details");
7991
};
8092
}
8193

embedded-keycloak/src/test/java/com/playtika/testcontainer/keycloak/spring/SpringTestApplication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ public class SpringTestApplication {
2828
public JwtDecoder jwtDecoder(@Value("${embedded.keycloak.host}") String host,
2929
@Value("${embedded.keycloak.http-port}") String port,
3030
@Value("${testing.keycloak.realm}") String realm) {
31-
String issuerUri = String.format("http://%s:%s/realms/%s", host, port, realm);
32-
return NimbusJwtDecoder.withIssuerLocation(issuerUri).build();
31+
String jwkSetUri = String.format("http://%s:%s/realms/%s/protocol/openid-connect/certs", host, port, realm);
32+
return NimbusJwtDecoder.withJwkSetUri(jwkSetUri).build();
3333
}
3434

3535
@Bean

embedded-keycloak/src/test/resources/test-realm.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"realm": "test-realm",
33
"enabled": true,
4-
"sslRequired": "external",
4+
"sslRequired": "none",
55
"clients": [
66
{
77
"id": "9b60057a-9bb1-44dd-8851-2794de9369ab",

0 commit comments

Comments
 (0)