|
40 | 40 | import org.slf4j.Logger;
|
41 | 41 | import org.slf4j.LoggerFactory;
|
42 | 42 |
|
| 43 | +import com.azure.identity.DefaultAzureCredential; |
| 44 | +import com.azure.identity.DefaultAzureCredentialBuilder; |
| 45 | + |
43 | 46 | import redis.clients.authentication.core.IdentityProvider;
|
44 | 47 | import redis.clients.authentication.core.IdentityProviderConfig;
|
45 | 48 | import redis.clients.authentication.core.SimpleToken;
|
46 | 49 | import redis.clients.authentication.core.Token;
|
47 | 50 | import redis.clients.authentication.core.TokenAuthConfig;
|
| 51 | +import redis.clients.authentication.entraid.AzureTokenAuthConfigBuilder; |
48 | 52 | import redis.clients.authentication.entraid.EntraIDIdentityProvider;
|
49 | 53 | import redis.clients.authentication.entraid.EntraIDIdentityProviderConfig;
|
50 | 54 | import redis.clients.authentication.entraid.EntraIDTokenAuthConfigBuilder;
|
@@ -378,4 +382,22 @@ private void triggerNetworkFailure() {
|
378 | 382 | }
|
379 | 383 | log.info("Action id: {}", actionResponse.getActionId());
|
380 | 384 | }
|
| 385 | + |
| 386 | + @Test |
| 387 | + public void withDefaultCredentials_azureCredentialsIntegrationTest() { |
| 388 | + DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); |
| 389 | + TokenAuthConfig tokenAuthConfig = AzureTokenAuthConfigBuilder.builder() |
| 390 | + .defaultAzureCredential(credential).tokenRequestExecTimeoutInMs(2000) |
| 391 | + .build(); |
| 392 | + |
| 393 | + DefaultJedisClientConfig jedisConfig = DefaultJedisClientConfig.builder() |
| 394 | + .authXManager(new AuthXManager(tokenAuthConfig)).build(); |
| 395 | + |
| 396 | + try (JedisPooled jedis = new JedisPooled(hnp, jedisConfig)) { |
| 397 | + String key = UUID.randomUUID().toString(); |
| 398 | + jedis.set(key, "value"); |
| 399 | + assertEquals("value", jedis.get(key)); |
| 400 | + jedis.del(key); |
| 401 | + } |
| 402 | + } |
381 | 403 | }
|
0 commit comments