Generate the StudioAPI proto at build time and complete authentication - #20
stefanrammo wants to merge 1 commit into
Conversation
StudioAPI.java is generated from a vendored studioapi.proto by protobuf-maven-plugin (protoc 3.25.5), the hand-committed copy is dropped. protobuf-java 3.21.5 -> 3.25.5. Version 2.0.0: AuthRequest gains getSuggestedUsers(). The Readme and pom descriptions mention authentication. Authentication (RSA EncryptedPassword/LDAP and PasswordHash): - Deliver the additional challenges of an AuthResponse to the AuthRequest. Map result code 0 to CREDENTIALS_REQUIRED and a missing result_code to INVALID_CHALLENGE_RESPONSE. Fill rolesAssigned from role_assigned. - Answer the server's EncryptedPassword request from a copy of the credentials, forgotten once granted. An empty password sends no hash response, an empty username builds no request. - PasswordHash, NewPasswordHash and challengeHash lowercase ASCII 'A'-'Z' only and encode UTF-8, so the digest matches the server's on any JVM locale and default charset. - One prompt per re-authentication cycle, answering the server's latest challenge. Each connection remembers the prompt whose answer it last received: a rejected or username-less answer opens a correction prompt for the connections it failed on, a cycle start joins the current prompt, and an answered prompt older than five seconds is dropped before any request is routed. Report the reauth round's own result at handshake acceptance. Expose Hello.suggested_users. Report a missing username as "Username required". TLS: Transport.onSetSSLParameters calls super first, so setTrustedCertificates(certs, true) verifies the server host name and false disables it. Its javadoc describes the check and the generated StudioAPI.crt's subject. Values: eUSHORT/eUCHAR/eSHORT/eCHAR parse numerically, eUINT/eUINT64 parse and print unsigned, the clock delta applies to a non-zero timestamp only. Unit tests cover auth, re-authentication (ClientReauthTest, 15 cases), Hello parse, TLS parameters and value decoding. CDP-5665
|
If the PR is about adding authentication then @martlaak is probably the best to review it. |
| if (valueType == CDPValueType.eUNDEFINED) return "<invalid variant>"; | ||
| if (valueType == CDPValueType.eUINT) | ||
| return Integer.toUnsignedString((Integer) value); | ||
| if (valueType == CDPValueType.eUINT64) |
There was a problem hiding this comment.
What about eUCHAR and eUSHORT?
| } | ||
|
|
||
| /** Get the Variant's value as a printable String. */ | ||
| /** Get the Variant's value as a printable String. Unsigned types print their unsigned value. */ |
There was a problem hiding this comment.
Not sure the comment change is useful
| break; | ||
| case eUSHORT: | ||
| pbv.setUsValue((Short) value.getValue()); | ||
| pbv.setUsValue(((Number) value.getValue()).intValue()); |
There was a problem hiding this comment.
What was wrong with the existing code?
| import java.util.function.BiConsumer; | ||
|
|
||
| /** | ||
| * Main Client class for initializing the CDP Java client. |
There was a problem hiding this comment.
Should this here or the overview.html be updated with the new APIs and auth methods? Those two are the main getting started guides and the latter is the landing page of javadoc
|
Verdict: approve with minor follow-ups. The wire format matches CDP securitylib, StudioAPIServer and the canonical Verified compatible with CDP
Findings (low severity)
Behavior changes (fine for 2.0.0, please mention in release notes)
|
StudioAPI.java is generated from a vendored studioapi.proto by protobuf-maven-plugin (protoc 3.25.5), the hand-committed copy is dropped. protobuf-java 3.21.5 -> 3.25.5. Version 2.0.0: AuthRequest gains getSuggestedUsers(). The Readme and pom descriptions mention authentication.
Authentication (RSA EncryptedPassword/LDAP and PasswordHash):
TLS: Transport.onSetSSLParameters calls super first, so setTrustedCertificates(certs, true) verifies the server host name and false disables it. Its javadoc describes the check and the generated StudioAPI.crt's subject.
Values: eUSHORT/eUCHAR/eSHORT/eCHAR parse numerically, eUINT/eUINT64 parse and print unsigned, the clock delta applies to a non-zero timestamp only.
Unit tests cover auth, re-authentication (ClientReauthTest, 15 cases), Hello parse, TLS parameters and value decoding.
CDP-5665