aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/authandtls/GoogleAuthUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/authandtls/GoogleAuthUtils.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/authandtls/GoogleAuthUtils.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/authandtls/GoogleAuthUtils.java b/src/main/java/com/google/devtools/build/lib/authandtls/GoogleAuthUtils.java
index 28682aef5d..21b6588b1d 100644
--- a/src/main/java/com/google/devtools/build/lib/authandtls/GoogleAuthUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/authandtls/GoogleAuthUtils.java
@@ -113,12 +113,15 @@ public final class GoogleAuthUtils {
}
/**
- * Create a new {@link Credentials} object.
+ * Create a new {@link Credentials} object, or {@code null} if no options are provided.
*
* @throws IOException in case the credentials can't be constructed.
*/
- public static Credentials newCredentials(AuthAndTLSOptions options) throws IOException {
- if (options.googleCredentials != null) {
+ @Nullable
+ public static Credentials newCredentials(@Nullable AuthAndTLSOptions options) throws IOException {
+ if (options == null) {
+ return null;
+ } else if (options.googleCredentials != null) {
// Credentials from file
try (InputStream authFile = new FileInputStream(options.googleCredentials)) {
return newCredentials(authFile, options.googleAuthScopes);