Skip to content

Commit

Permalink
Revert "fix: Issue #1347: ExternalAccountCredentials serialization is…
Browse files Browse the repository at this point in the history
… broken" (#1359)
  • Loading branch information
BigTailWolf committed Jan 25, 2024
1 parent 64ce8a1 commit 5a2d943
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
Expand Up @@ -42,7 +42,6 @@
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.math.BigDecimal;
import java.net.URI;
import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -541,13 +540,6 @@ public CredentialSource getCredentialSource() {
return credentialSource;
}

@SuppressWarnings("unused")
private void readObject(ObjectInputStream input) throws IOException, ClassNotFoundException {
// Properly deserialize the transient transportFactory.
input.defaultReadObject();
transportFactory = newInstance(transportFactoryClassName);
}

@Nullable
public String getServiceAccountImpersonationUrl() {
return serviceAccountImpersonationUrl;
Expand Down
Expand Up @@ -1117,9 +1117,6 @@ public void serialize() throws IOException, ClassNotFoundException {
testCredentials.getServiceAccountImpersonationOptions().getLifetime(),
deserializedCredentials.getServiceAccountImpersonationOptions().getLifetime());
assertSame(deserializedCredentials.clock, Clock.SYSTEM);
assertEquals(
MockExternalAccountCredentialsTransportFactory.class,
deserializedCredentials.toBuilder().getHttpTransportFactory().getClass());
}

@Test
Expand Down Expand Up @@ -1310,30 +1307,17 @@ protected TestCredentialSource(Map<String, Object> credentialSourceMap) {
}
}

@Override
public Builder toBuilder() {
return new Builder(this);
}

public static Builder newBuilder() {
return new Builder();
}

static class Builder extends ExternalAccountCredentials.Builder {
Builder() {}

Builder(TestExternalAccountCredentials credentials) {
super(credentials);
}

@Override
public TestExternalAccountCredentials build() {
return new TestExternalAccountCredentials(this);
}

public HttpTransportFactory getHttpTransportFactory() {
return transportFactory;
}
}

protected TestExternalAccountCredentials(ExternalAccountCredentials.Builder builder) {
Expand Down

0 comments on commit 5a2d943

Please sign in to comment.