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
{{ message }}
Repository navigation
Commit a3e3324
Browse filesBrowse the repository at this point in the historyBrowse files
fix(auth): fix serialization gaps in DownscopedCredentials and UrlIdentityPoolSubjectTokenSupplier (#14341)
Fixes serialization issues tracked in
#12580
### Problem
1. **`DownscopedCredentials`**:
- Held a `private final transient HttpTransportFactory
transportFactory;` without retaining its class name or defining a
`readObject` method. Upon deserialization, `transportFactory` was null,
throwing a `NullPointerException` on `transportFactory.create()` during
token refresh.
- Contained a non-serializable `CredentialAccessBoundary` field,
preventing instances of `DownscopedCredentials` from being serialized at
all (`NotSerializableException`).
2. **`UrlIdentityPoolSubjectTokenSupplier`**:
- Held a `private final transient HttpTransportFactory
transportFactory;` without retaining its class name or defining
`readObject`. When deserialized (either directly or as part of an
`IdentityPoolCredentials` configured with a URL source),
`transportFactory` was null, throwing a `NullPointerException` on
`transportFactory.create()` when retrieving the subject token.
### Solution
- Implemented `readObject()` in both `DownscopedCredentials` and
`UrlIdentityPoolSubjectTokenSupplier` to reconstruct `transportFactory`
via `newInstance(transportFactoryClassName)` /
`OAuth2Credentials.newInstance(transportFactoryClassName)`.
- Preserved backward compatibility by explicitly setting
`serialVersionUID` for `DownscopedCredentials` to its previously
computed default UID (`3159528426501345486L`).
- Made `CredentialAccessBoundary` and its inner classes
(`AccessBoundaryRule`, `AvailabilityCondition`) implement
`Serializable`.
- Added serialization unit tests in `DownscopedCredentialsTest`,
`IdentityPoolCredentialsTest`, and `CredentialAccessBoundaryTest`
verifying deserialization and token refresh using in-memory mock
transports.
0 commit comments