Repository navigation
SASL/SCRAM authentication end-to-end (SCRAM-SHA-1/256/512) - #8
Merged
Merged
Conversation
Wire the client to authenticate against a secured Infinispan server. `RemoteCache::setAuthentication(user, pass, realm, serverName, mechanism)` (flat setter, default SCRAM-SHA-256) enables a SASL handshake that runs on every connection the client opens — the seed connection and every topology-discovered member — inside MultiplexedConnection::connect(), after TCP connect and before the read-loop thread starts. - Generalize SCRAM across the digest family (SHA-1/256/512) over OpenSSL EVP; PBKDF2/HMAC/H lengths derived from EVP_MD_size. SHA-256 stays the default. - New SaslAuthenticator driving the two-turn SCRAM exchange over a testable SaslTransport seam (ConnectionSaslTransport in production). The client completes on its own side after verifying the server signature — no confirmation round, ignores the server `completed` flag (mirrors Java AuthHandler; avoids Elytron ELY05037). Non-SCRAM mechanisms throw a typed HotRodClientException at connect(). - New public headers: Authentication.h, AuthCodec.h, SaslAuthenticator.h. - Tests: +19 unit (AuthCodec + parameterized SaslAuthenticator over a fake OpenSSL server, incl. failure paths) and +5 integration (AuthIntegrationTest: SCRAM-SHA-1/256/512 put/get, wrong-password, no-credentials) — green live against a Dockerized auth-enabled Infinispan 16. - Docs: new AsciiDoc user guide (documentation/index.adoc + topics/), with a fully written security.adoc; quickstart README auth snippet; STATUS.md, DECISIONS.md, README refreshed. Cross-checked against the authoritative sources: Java client (AuthHandler / AuthOperation) for behavior and Kaitai hotrod40.ksy for byte layout. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wires the client to authenticate against a secured Infinispan server. Until now SCRAM crypto existed but was dead code — no code path ever authenticated. This adds end-to-end SASL authentication for the whole SCRAM family (
SCRAM-SHA-1/SCRAM-SHA-256/SCRAM-SHA-512).RemoteCache::setAuthentication(username, password, realm="default", serverName="infinispan", mechanism="SCRAM-SHA-256")— a flat setter matching the existingsetClientIntelligence/setProtocolVersionidiom — enables a SASL handshake that runs on every connection the client opens (the seed connection and every topology-discovered cluster member), insideMultiplexedConnection::connect(), after TCP connect and before the read-loop thread starts.What's included
EVP_MD_size. SHA-256 stays the default; existingSCRAMTeststill passes.SaslAuthenticatordrives the two-turn SCRAM exchange over a testableSaslTransportseam (ConnectionSaslTransportin production). The client completes on its own side after verifying the server signature — no confirmation round, and it ignores the servercompletedflag (mirrors JavaAuthHandler; sending an extra round triggers ElytronELY05037).HotRodClientExceptionatconnect().Authentication.h,AuthCodec.h,SaslAuthenticator.h.documentation/index.adoc+topics/) with a fully writtensecurity.adoc; auth snippet in the quickstart README;docs/STATUS.md,docs/DECISIONS.md, andREADME.mdrefreshed.Testing
AuthCodecTestbody round-trips + parameterizedSaslAuthenticatorTestover SCRAM-SHA-1/256/512 driven by a fake OpenSSL server, plus mech-not-offered / unsupported-mech / bad-server-signature failure paths). Full suite 223/223 green, strict build (-Wall -Wextra -Werror -pedantic).AuthIntegrationTest: SCRAM-SHA-1/256/512 put/get round-trips, wrong-password throws at connect, no-credentials-against-secured-server fails) — verified live against a Dockerized auth-enabled Infinispan 16.Protocol provenance
Cross-checked against the two authoritative sources per
AGENTS.md: the Java client (AuthHandler/AuthOperation) for behavior and the Kaitai schemahotrod40.ksyfor byte layout. Rationale and the load-bearing "two client turns, client completes on its own side" finding are recorded indocs/DECISIONS.md.🤖 Generated with Claude Code