You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(spanner): implement OPAQUE login authentication for Spanner Omni (#20085)
### ⚠️ Note to Reviewers:
> Of the ~3k lines changed in this PR, approximately ~1.3k lines are
auto-generated protobuf classes. Specifically, the files
`spanner/omni/authentication.pb.go` and `spanner/omni/login.pb.go`
account for the vast majority of the diff.
> The actual hand-written logic is small and contained within the core
auth implementation and connection classes. This PR introduces native
authentication support for Spanner Omni endpoints using the OPAQUE
password-authenticated key exchange protocol.
**Key Changes:**
* **Omni Login Protocol:** Added generated protobufs
(`omni/authentication.pb.go`, `omni/login.pb.go`) to handle the
authentication handshake with Omni endpoints.
* **OPAQUE Protocol Support**: Implemented
[userAuthenticator](file:///usr/local/google/home/sagnikghosh/Documents/go/google-cloud-go/spanner/omni/opaque.go)
to handle the secure OPAQUE cryptographic login flow, using timing-safe
`crypto/subtle` checks for MAC and auth tag verification.
* **omniTokenSource**: Added a new
[omniTokenSource](file:///usr/local/google/home/sagnikghosh/Documents/go/google-cloud-go/spanner/omni/connection.go)
(`oauth2.TokenSource` implementation) to dial Omni endpoints, perform
authentication handshakes, and cache the returned OAuth2 token payload.
* **Client Integration:** Updated
[ClientConfig](file:///usr/local/google/home/sagnikghosh/Documents/go/google-cloud-go/spanner/client.go)
and
[OmniClientConfig](file:///usr/local/google/home/sagnikghosh/Documents/go/google-cloud-go/spanner/admin/database/apiv1/omni_client.go)
to accept `Username` and `Password` credentials, automatically injecting
the `omniTokenSource` as a client option.
To run Integration Tests with auth login, run:
```bash
go test -v -parallel 1 -run ^TestIntegration_ . -args \
-it.omni-endpoint="localhost:15000" \
-it.omni-ca-cert="/path/to/ca.crt" \
-it.omni-username="admin" \
-it.omni-password="admin"
```
0 commit comments