Skip to content

Commit

Permalink
fix: Make supporting classes of AwsCredentials serializable
Browse files Browse the repository at this point in the history
  • Loading branch information
jmahonin committed Jan 9, 2023
1 parent 240c26b commit 04cf78a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import com.google.common.base.MoreObjects;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.math.BigDecimal;
import java.net.URI;
import java.nio.charset.StandardCharsets;
Expand All @@ -67,7 +68,9 @@
public abstract class ExternalAccountCredentials extends GoogleCredentials {

/** Base credential source class. Dictates the retrieval method of the external credential. */
abstract static class CredentialSource {
abstract static class CredentialSource implements Serializable {

private static final long serialVersionUID = 8204657811562399944L;

CredentialSource(Map<String, Object> credentialSourceMap) {
checkNotNull(credentialSourceMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableMap;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
Expand Down Expand Up @@ -700,4 +701,9 @@ public ImpersonatedCredentials build() {
return new ImpersonatedCredentials(this);
}
}

private void readObject(ObjectInputStream input) throws IOException, ClassNotFoundException {
input.defaultReadObject();
transportFactory = newInstance(transportFactoryClassName);
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package com.google.auth.oauth2;

import java.io.Serializable;

/** Represents the default system environment provider. */
class SystemEnvironmentProvider implements EnvironmentProvider {
class SystemEnvironmentProvider implements EnvironmentProvider, Serializable {
static final SystemEnvironmentProvider INSTANCE = new SystemEnvironmentProvider();
private static final long serialVersionUID = -4698164985883575244L;

private SystemEnvironmentProvider() {}

Expand Down

0 comments on commit 04cf78a

Please sign in to comment.