Skip to content

Commit

Permalink
AuthTransport -> GoogleAuthTransport.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmehta19 committed Dec 21, 2024
1 parent ce74e45 commit 8ce3a4d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ public class ComputeEngineCredentials extends GoogleCredentials
static final int MAX_COMPUTE_PING_TRIES = 3;
static final int COMPUTE_PING_CONNECTION_TIMEOUT_MS = 500;

public enum AuthTransport {
public enum GoogleAuthTransport {
// Authenticating to Google APIs via DirectPath
ALTS("alts"),
// Authenticating to Google APIs via GFE
MTLS("mtls");

private final String label;

private AuthTransport(String label) {
private GoogleAuthTransport(String label) {
this.label = label;
}

Expand Down Expand Up @@ -156,7 +156,7 @@ public String getLabel() {

private final Collection<String> scopes;

private final AuthTransport transport;
private final GoogleAuthTransport transport;
private final BindingEnforcement bindingEnforcement;

private transient HttpTransportFactory transportFactory;
Expand Down Expand Up @@ -189,7 +189,7 @@ private ComputeEngineCredentials(ComputeEngineCredentials.Builder builder) {
scopeList.removeAll(Arrays.asList("", null));
this.scopes = ImmutableSet.<String>copyOf(scopeList);
}
this.transport = builder.getAuthTransport();
this.transport = builder.getGoogleAuthTransport();
this.bindingEnforcement = builder.getBindingEnforcement();
}

Expand Down Expand Up @@ -691,7 +691,7 @@ public static class Builder extends GoogleCredentials.Builder {
private Collection<String> scopes;
private Collection<String> defaultScopes;

private AuthTransport transport;
private GoogleAuthTransport transport;
private BindingEnforcement bindingEnforcement;

protected Builder() {
Expand Down Expand Up @@ -736,19 +736,19 @@ public Builder setQuotaProjectId(String quotaProjectId) {
}

/**
* Set the {@code AuthTransport} type.
*
* Set the {@code GoogleAuthTransport} type.
*
* @param transport the transport type over which to authenticate to Google APIs
*/
@CanIgnoreReturnValue
public Builder setAuthTransport(AuthTransport transport) {
public Builder setGoogleAuthTransport(GoogleAuthTransport transport) {
this.transport = transport;
return this;
}

/**
* Set the {@code BindingEnforcement} type.
*
*
* @param bindingEnforcement the token binding enforcement policy.
*/
@CanIgnoreReturnValue
Expand All @@ -770,17 +770,17 @@ public Collection<String> getDefaultScopes() {
}

/**
* Get the {@code AuthTransport} type.
*
* Get the {@code GoogleAuthTransport} type.
*
* @return the transport type over which to authenticate to Google APIs
*/
public AuthTransport getAuthTransport() {
public GoogleAuthTransport getGoogleAuthTransport() {
return transport;
}

/**
* Get the {@code BindingEnforcement} type.
*
*
* @return the token binding enforcement policy.
*/
public BindingEnforcement getBindingEnforcement() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public void buildTokenUrlWithScopes_defaultScopes() {
public void buildTokenUrl_nullTransport() {
ComputeEngineCredentials credentials =
ComputeEngineCredentials.newBuilder()
.setAuthTransport(null)
.setGoogleAuthTransport(null)
.setBindingEnforcement(ComputeEngineCredentials.BindingEnforcement.ON)
.build();
String softBoundTokenUrl = credentials.createTokenUrlWithScopes();
Expand All @@ -206,7 +206,7 @@ public void buildTokenUrl_nullTransport() {
public void buildTokenUrl_nullBindingEnforcement() {
ComputeEngineCredentials credentials =
ComputeEngineCredentials.newBuilder()
.setAuthTransport(ComputeEngineCredentials.AuthTransport.MTLS)
.setGoogleAuthTransport(ComputeEngineCredentials.GoogleAuthTransport.MTLS)
.setBindingEnforcement(null)
.build();
String softBoundTokenUrl = credentials.createTokenUrlWithScopes();
Expand All @@ -218,7 +218,7 @@ public void buildTokenUrl_nullBindingEnforcement() {
public void buildTokenUrl_nullTransport_nullBindingEnforcement() {
ComputeEngineCredentials credentials =
ComputeEngineCredentials.newBuilder()
.setAuthTransport(null)
.setGoogleAuthTransport(null)
.setBindingEnforcement(null)
.build();
String softBoundTokenUrl = credentials.createTokenUrlWithScopes();
Expand All @@ -230,7 +230,7 @@ public void buildTokenUrl_nullTransport_nullBindingEnforcement() {
public void buildTokenUrlSoftMtlsBound_mtls_transport() {
ComputeEngineCredentials credentials =
ComputeEngineCredentials.newBuilder()
.setAuthTransport(ComputeEngineCredentials.AuthTransport.MTLS)
.setGoogleAuthTransport(ComputeEngineCredentials.GoogleAuthTransport.MTLS)
.build();
String softBoundTokenUrl = credentials.createTokenUrlWithScopes();

Expand All @@ -252,7 +252,7 @@ public void buildTokenUrlSoftMtlsBound_iam_enforcement() {
public void buildTokenUrlSoftMtlsBound_mtls_transport_iam_enforcement() {
ComputeEngineCredentials credentials =
ComputeEngineCredentials.newBuilder()
.setAuthTransport(ComputeEngineCredentials.AuthTransport.MTLS)
.setGoogleAuthTransport(ComputeEngineCredentials.GoogleAuthTransport.MTLS)
.setBindingEnforcement(ComputeEngineCredentials.BindingEnforcement.IAM_POLICY)
.build();
String softBoundTokenUrl = credentials.createTokenUrlWithScopes();
Expand All @@ -275,7 +275,7 @@ public void buildTokenUrlHardMtlsBound_always_enforced() {
public void buildTokenUrlHardMtlsBound_mtls_transport_always_enforced() {
ComputeEngineCredentials credentials =
ComputeEngineCredentials.newBuilder()
.setAuthTransport(ComputeEngineCredentials.AuthTransport.MTLS)
.setGoogleAuthTransport(ComputeEngineCredentials.GoogleAuthTransport.MTLS)
.setBindingEnforcement(ComputeEngineCredentials.BindingEnforcement.ON)
.build();
String softBoundTokenUrl = credentials.createTokenUrlWithScopes();
Expand All @@ -287,7 +287,7 @@ public void buildTokenUrlHardMtlsBound_mtls_transport_always_enforced() {
public void buildTokenUrlHardDirectPathBound_alts_transport() {
ComputeEngineCredentials credentials =
ComputeEngineCredentials.newBuilder()
.setAuthTransport(ComputeEngineCredentials.AuthTransport.ALTS)
.setGoogleAuthTransport(ComputeEngineCredentials.GoogleAuthTransport.ALTS)
.build();
String softBoundTokenUrl = credentials.createTokenUrlWithScopes();

Expand Down

0 comments on commit 8ce3a4d

Please sign in to comment.