Skip to content

Port IAM authentication to Java - #10

Merged
alexr-bq merged 13 commits into
release-2from
port-iam-authentication-to-java-a9f91d0a
Sep 17, 2026
Merged

alexr-bq merged 13 commits into
release-2from
port-iam-authentication-to-java-a9f91d0a

Conversation

@alexr-bq

Copy link
Copy Markdown
Collaborator

Summary

  • Add the Java IAM authentication token generator, tests, documentation, and runnable TLS example.
  • Add parity coverage for validation, region resolution, credential handling, signing, and public API consumption.

Verification

  • Corretto 8 library build: 26 tests passed.
  • Separate example/consumer build: 2 tests passed.

Comment thread .github/workflows/java.yml Fixed
Comment thread .github/workflows/java.yml Outdated
Comment thread java/CHANGELOG.md
@alexr-bq
alexr-bq changed the base branch from main to release-2 September 10, 2026 23:48

@mwaisaida-13 mwaisaida-13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid port, the same known-answer vectors as Python/Node, and a complete test suite.

A few small changes before approving: centralize the supported Java versions like we do with pyproject.toml; use the Java builder parameter names in error messages; add a Lettuce RedisCredentialsProvider example alongside the RESP one; move PublicApiTest into a java/integration-tests/ dir so examples/ stays for documentation; order the README sections like python/README.md and add the engine floor. Thank you!

Comment thread .github/workflows/java.yml Outdated
fail-fast: false
matrix:
os: [ubuntu-latest]
java-version: ["8", "11", "17", "21"]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we have the supported versions centralized? that way it's simpler to add more versions. For python we store and extract them from the .toml

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in pom.xml

.region(region)
.build();

SSLSocketFactory socketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! a client-independent example showing the wire exchange is useful for custom clients and proxies. Could we also add a Lettuce RedisCredentialsProvider example alongside it, mirroring python/examples/connect_valkey.py, so typical client users see the short integration path?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added ConnectWithLettuce

@@ -0,0 +1,27 @@
/*

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we really need this test since the examples are mainly for documentation purposes, what do you think?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

@@ -0,0 +1,26 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This is really a consumer-side check against the installed jar, not an example. Could it move to its own java/integration-tests/ dir?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved

Target target = resolveTarget(builder.serverlessCacheName, builder.replicationGroupId);
this.cacheName = target.cacheName;
this.serverless = target.serverless;
this.userId = validateAndNormalize("user_id", builder.userId, USER_ID_PATTERN);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: These messages name the Python parameters ('serverless_cache_name', 'replication_group_id', 'user_id'), but here we use serverlessCacheName, replicationGroupId, userId. Please use the Java names so the error points at something the caller can easily find.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Comment thread java/CHANGELOG.md
Comment thread java/README.md
@@ -0,0 +1,101 @@
# Developer Toolkit for Amazon ElastiCache (Java)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you order the sections like python/README.md (Installation → what you need → Generate a token → Reconnecting clients → Security → License) so the three READMEs read the same, and add the engine floor (Valkey 7.2+ / Redis OSS 7.0+) to the prerequisites?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reordered the README to Installation → What you need → Generate a token → Reconnecting clients → Security → License, and added both engine minimums.

Comment thread java/README.md
`credentialsProvider(...)`.

Missing credentials are reported when a token is requested. Expired or otherwise
invalid credentials cannot be detected during local signing: token generation can

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This note is great, we should copy it to the other packages

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied

@mwaisaida-13

Copy link
Copy Markdown
Collaborator

Hey @alexr-bq, could you have a look at the merge conflicts?

@alexr-bq
alexr-bq force-pushed the port-iam-authentication-to-java-a9f91d0a branch from 071b86e to 5fd9a6a Compare September 16, 2026 16:15
@alexr-bq

Copy link
Copy Markdown
Collaborator Author

@mwaisaida-13 resolved

@alexr-bq
alexr-bq added this pull request to stack #14 September 17, 2026 16:21
@alexr-bq
alexr-bq removed this pull request from stack #14 September 17, 2026 16:21
@alexr-bq
alexr-bq merged commit 3e42742 into release-2 Sep 17, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants