Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ public class AwsCredentials extends ExternalAccountCredentials {
// Check that one and only one of supplier or credential source are provided.
if (builder.awsSecurityCredentialsSupplier != null && builder.credentialSource != null) {
throw new IllegalArgumentException(
"AwsCredentials cannot have both an awsSecurityCredentialsSupplier and a credentialSource.");
"AwsCredentials cannot have both an awsSecurityCredentialsSupplier and a"
+ " credentialSource.");
}
if (builder.awsSecurityCredentialsSupplier == null && builder.credentialSource == null) {
throw new IllegalArgumentException(
Expand Down Expand Up @@ -203,8 +204,7 @@ AwsSecurityCredentialsSupplier getAwsSecurityCredentialsSupplier() {
return this.awsSecurityCredentialsSupplier;
}

@Nullable
public String getRegionalCredentialVerificationUrlOverride() {
public @Nullable String getRegionalCredentialVerificationUrlOverride() {
return this.regionalCredentialVerificationUrlOverride;
}

Expand Down Expand Up @@ -237,9 +237,9 @@ public Builder toBuilder() {

public static class Builder extends ExternalAccountCredentials.Builder {

private AwsSecurityCredentialsSupplier awsSecurityCredentialsSupplier;
private @Nullable AwsSecurityCredentialsSupplier awsSecurityCredentialsSupplier;

private String regionalCredentialVerificationUrlOverride;
private @Nullable String regionalCredentialVerificationUrlOverride;

Builder() {}

Expand All @@ -261,7 +261,7 @@ public static class Builder extends ExternalAccountCredentials.Builder {
*/
@CanIgnoreReturnValue
public Builder setAwsSecurityCredentialsSupplier(
AwsSecurityCredentialsSupplier awsSecurityCredentialsSupplier) {
@Nullable AwsSecurityCredentialsSupplier awsSecurityCredentialsSupplier) {
this.awsSecurityCredentialsSupplier = awsSecurityCredentialsSupplier;
return this;
}
Expand All @@ -277,37 +277,42 @@ public Builder setAwsSecurityCredentialsSupplier(
*/
@CanIgnoreReturnValue
public Builder setRegionalCredentialVerificationUrlOverride(
String regionalCredentialVerificationUrlOverride) {
@Nullable String regionalCredentialVerificationUrlOverride) {
this.regionalCredentialVerificationUrlOverride = regionalCredentialVerificationUrlOverride;
return this;
}

@Override
@CanIgnoreReturnValue
public Builder setHttpTransportFactory(HttpTransportFactory transportFactory) {
public Builder setHttpTransportFactory(@Nullable HttpTransportFactory transportFactory) {
super.setHttpTransportFactory(transportFactory);
return this;
}

@Override
@CanIgnoreReturnValue
public Builder setAudience(String audience) {
super.setAudience(audience);
return this;
}

@Override
@CanIgnoreReturnValue
public Builder setSubjectTokenType(String subjectTokenType) {
super.setSubjectTokenType(subjectTokenType);
return this;
}

@Override
@CanIgnoreReturnValue
public Builder setSubjectTokenType(SubjectTokenTypes subjectTokenType) {
super.setSubjectTokenType(subjectTokenType);
return this;
}

@Override
@CanIgnoreReturnValue
public Builder setTokenUrl(String tokenUrl) {
public Builder setTokenUrl(@Nullable String tokenUrl) {
super.setTokenUrl(tokenUrl);
return this;
}
Expand All @@ -318,62 +323,73 @@ public Builder setCredentialSource(AwsCredentialSource credentialSource) {
return this;
}

@Override
@CanIgnoreReturnValue
public Builder setServiceAccountImpersonationUrl(String serviceAccountImpersonationUrl) {
public Builder setServiceAccountImpersonationUrl(
@Nullable String serviceAccountImpersonationUrl) {
super.setServiceAccountImpersonationUrl(serviceAccountImpersonationUrl);
return this;
}

@Override
@CanIgnoreReturnValue
public Builder setTokenInfoUrl(String tokenInfoUrl) {
public Builder setTokenInfoUrl(@Nullable String tokenInfoUrl) {
super.setTokenInfoUrl(tokenInfoUrl);
return this;
}

@Override
@CanIgnoreReturnValue
public Builder setQuotaProjectId(String quotaProjectId) {
public Builder setQuotaProjectId(@Nullable String quotaProjectId) {
super.setQuotaProjectId(quotaProjectId);
return this;
}

@Override
@CanIgnoreReturnValue
public Builder setClientId(String clientId) {
public Builder setClientId(@Nullable String clientId) {
super.setClientId(clientId);
return this;
}

@Override
@CanIgnoreReturnValue
public Builder setClientSecret(String clientSecret) {
public Builder setClientSecret(@Nullable String clientSecret) {
super.setClientSecret(clientSecret);
return this;
}

@Override
@CanIgnoreReturnValue
public Builder setScopes(Collection<String> scopes) {
public Builder setScopes(@Nullable Collection<String> scopes) {
super.setScopes(scopes);
return this;
}

@Override
@CanIgnoreReturnValue
public Builder setWorkforcePoolUserProject(String workforcePoolUserProject) {
public Builder setWorkforcePoolUserProject(@Nullable String workforcePoolUserProject) {
super.setWorkforcePoolUserProject(workforcePoolUserProject);
return this;
}

@Override
@CanIgnoreReturnValue
public Builder setServiceAccountImpersonationOptions(Map<String, Object> optionsMap) {
public Builder setServiceAccountImpersonationOptions(@Nullable Map<String, Object> optionsMap) {
super.setServiceAccountImpersonationOptions(optionsMap);
return this;
}

@Override
@CanIgnoreReturnValue
public Builder setUniverseDomain(String universeDomain) {
public Builder setUniverseDomain(@Nullable String universeDomain) {
super.setUniverseDomain(universeDomain);
return this;
}

@Override
@CanIgnoreReturnValue
Builder setEnvironmentProvider(EnvironmentProvider environmentProvider) {
Builder setEnvironmentProvider(@Nullable EnvironmentProvider environmentProvider) {
super.setEnvironmentProvider(environmentProvider);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
import com.google.api.client.json.GenericJson;
import com.google.api.client.json.JsonObjectParser;
import com.google.api.client.util.GenericData;
import com.google.api.client.util.Preconditions;
import com.google.auth.http.HttpTransportFactory;
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.io.BaseEncoding;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException;
Expand Down Expand Up @@ -84,17 +84,17 @@

private static final long serialVersionUID = -2181779590486283287L;

private final String transportFactoryClassName;
private final String audience;
private final String tokenUrl;
private final String tokenInfoUrl;
private final String revokeUrl;
private final String clientId;
private final String clientSecret;
private final @Nullable String transportFactoryClassName;
private final @Nullable String audience;
private final @Nullable String tokenUrl;
private final @Nullable String tokenInfoUrl;
private final @Nullable String revokeUrl;
private final @Nullable String clientId;
private final @Nullable String clientSecret;

private String refreshToken;
private @Nullable String refreshToken;

private transient HttpTransportFactory transportFactory;
private transient @Nullable HttpTransportFactory transportFactory;

/**
* Internal constructor.
Expand Down Expand Up @@ -134,7 +134,7 @@
* external source for authentication to Google Cloud Platform, you must validate it before
* providing it to any Google API or library. Providing an unvalidated credential configuration to
* Google APIs can compromise the security of your systems and data. For more information, refer
* to {@see <a

Check failure on line 137 in google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ExternalAccountAuthorizedUserCredentials.java

View workflow job for this annotation

GitHub Actions / BomContentAssertionsTest (Test for assertion logic in BomContentTest)

no tag name after @

Check failure on line 137 in google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ExternalAccountAuthorizedUserCredentials.java

View workflow job for this annotation

GitHub Actions / bom-content-test

no tag name after @
* href="https://cloud.google.com/docs/authentication/external/externally-sourced-credentials">documentation</a>}.
*
* @param credentialsStream the stream with the credential definition
Expand All @@ -153,7 +153,7 @@
* external source for authentication to Google Cloud Platform, you must validate it before
* providing it to any Google API or library. Providing an unvalidated credential configuration to
* Google APIs can compromise the security of your systems and data. For more information, refer
* to {@see <a

Check failure on line 156 in google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ExternalAccountAuthorizedUserCredentials.java

View workflow job for this annotation

GitHub Actions / BomContentAssertionsTest (Test for assertion logic in BomContentTest)

no tag name after @

Check failure on line 156 in google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ExternalAccountAuthorizedUserCredentials.java

View workflow job for this annotation

GitHub Actions / bom-content-test

no tag name after @
* href="https://cloud.google.com/docs/authentication/external/externally-sourced-credentials">documentation</a>}.
*
* @param credentialsStream the stream with the credential definition
Expand Down Expand Up @@ -231,38 +231,31 @@
.build();
}

@Nullable
public String getAudience() {
public @Nullable String getAudience() {
return audience;
}

@Nullable
public String getClientId() {
public @Nullable String getClientId() {
return clientId;
}

@Nullable
public String getClientSecret() {
public @Nullable String getClientSecret() {
return clientSecret;
}

@Nullable
public String getRevokeUrl() {
public @Nullable String getRevokeUrl() {
return revokeUrl;
}

@Nullable
public String getTokenUrl() {
public @Nullable String getTokenUrl() {
return tokenUrl;
}

@Nullable
public String getTokenInfoUrl() {
public @Nullable String getTokenInfoUrl() {
return tokenInfoUrl;
}

@Nullable
public String getRefreshToken() {
public @Nullable String getRefreshToken() {
return refreshToken;
}

Expand Down Expand Up @@ -363,7 +356,6 @@
.setRevokeUrl(revokeUrl)
.setClientId(clientId)
.setClientSecret(clientSecret)
.setRefreshToken(refreshToken)
.setHttpTransportFactory(transportFactory)
.setQuotaProjectId(quotaProjectId)
.setUniverseDomain(universeDomain)
Expand Down Expand Up @@ -417,14 +409,14 @@
/** Builder for {@link ExternalAccountAuthorizedUserCredentials}. */
public static class Builder extends GoogleCredentials.Builder {

private HttpTransportFactory transportFactory;
private String audience;
private String refreshToken;
private String tokenUrl;
private String tokenInfoUrl;
private String revokeUrl;
private String clientId;
private String clientSecret;
private @Nullable HttpTransportFactory transportFactory;
private @Nullable String audience;
private @Nullable String refreshToken;
private @Nullable String tokenUrl;
private @Nullable String tokenInfoUrl;
private @Nullable String revokeUrl;
private @Nullable String clientId;
private @Nullable String clientSecret;

protected Builder() {}

Expand All @@ -447,7 +439,7 @@
* @return this {@code Builder} object
*/
@CanIgnoreReturnValue
public Builder setHttpTransportFactory(HttpTransportFactory transportFactory) {
public Builder setHttpTransportFactory(@Nullable HttpTransportFactory transportFactory) {
this.transportFactory = transportFactory;
return this;
}
Expand All @@ -460,7 +452,7 @@
* @return this {@code Builder} object
*/
@CanIgnoreReturnValue
public Builder setAudience(String audience) {
public Builder setAudience(@Nullable String audience) {
this.audience = audience;
return this;
}
Expand All @@ -472,7 +464,7 @@
* @return this {@code Builder} object
*/
@CanIgnoreReturnValue
public Builder setTokenUrl(String tokenUrl) {
public Builder setTokenUrl(@Nullable String tokenUrl) {
this.tokenUrl = tokenUrl;
return this;
}
Expand All @@ -484,7 +476,7 @@
* @return this {@code Builder} object
*/
@CanIgnoreReturnValue
public Builder setTokenInfoUrl(String tokenInfoUrl) {
public Builder setTokenInfoUrl(@Nullable String tokenInfoUrl) {
this.tokenInfoUrl = tokenInfoUrl;
return this;
}
Expand All @@ -496,7 +488,7 @@
* @return this {@code Builder} object
*/
@CanIgnoreReturnValue
public Builder setRevokeUrl(String revokeUrl) {
public Builder setRevokeUrl(@Nullable String revokeUrl) {
this.revokeUrl = revokeUrl;
return this;
}
Expand All @@ -508,7 +500,7 @@
* @return this {@code Builder} object
*/
@CanIgnoreReturnValue
public Builder setRefreshToken(String refreshToken) {
public Builder setRefreshToken(@Nullable String refreshToken) {
this.refreshToken = refreshToken;
return this;
}
Expand All @@ -520,7 +512,7 @@
* @return this {@code Builder} object
*/
@CanIgnoreReturnValue
public Builder setClientId(String clientId) {
public Builder setClientId(@Nullable String clientId) {
this.clientId = clientId;
return this;
}
Expand All @@ -532,7 +524,7 @@
* @return this {@code Builder} object
*/
@CanIgnoreReturnValue
public Builder setClientSecret(String clientSecret) {
public Builder setClientSecret(@Nullable String clientSecret) {
this.clientSecret = clientSecret;
return this;
}
Expand All @@ -545,7 +537,7 @@
*/
@Override
@CanIgnoreReturnValue
public Builder setQuotaProjectId(String quotaProjectId) {
public Builder setQuotaProjectId(@Nullable String quotaProjectId) {
super.setQuotaProjectId(quotaProjectId);
return this;
}
Expand All @@ -558,7 +550,7 @@
*/
@Override
@CanIgnoreReturnValue
public Builder setAccessToken(AccessToken accessToken) {
public Builder setAccessToken(@Nullable AccessToken accessToken) {
super.setAccessToken(accessToken);
return this;
}
Expand All @@ -571,7 +563,7 @@
*/
@CanIgnoreReturnValue
@Override
public Builder setUniverseDomain(String universeDomain) {
public Builder setUniverseDomain(@Nullable String universeDomain) {
super.setUniverseDomain(universeDomain);
return this;
}
Expand Down
Loading
Loading