diff --git a/jib-core/src/main/java/com/google/cloud/tools/jib/registry/RegistryAuthenticator.java b/jib-core/src/main/java/com/google/cloud/tools/jib/registry/RegistryAuthenticator.java index f64935de91..bb057fcb64 100644 --- a/jib-core/src/main/java/com/google/cloud/tools/jib/registry/RegistryAuthenticator.java +++ b/jib-core/src/main/java/com/google/cloud/tools/jib/registry/RegistryAuthenticator.java @@ -55,8 +55,9 @@ public class RegistryAuthenticator { @Nullable static RegistryAuthenticator fromAuthenticationMethod( String authenticationMethod, String repository) throws RegistryAuthenticationFailedException { - // If the authentication method starts with 'Basic ', no registry authentication is needed. - if (authenticationMethod.matches("^Basic .*")) { + // If the authentication method starts with 'basic ' (case insensitive), no registry + // authentication is needed. + if (authenticationMethod.matches("^(?i)(basic) .*")) { return null; } diff --git a/jib-core/src/test/java/com/google/cloud/tools/jib/registry/RegistryAuthenticatorTest.java b/jib-core/src/test/java/com/google/cloud/tools/jib/registry/RegistryAuthenticatorTest.java index 0d661afc3b..9fda0ddfb1 100644 --- a/jib-core/src/test/java/com/google/cloud/tools/jib/registry/RegistryAuthenticatorTest.java +++ b/jib-core/src/test/java/com/google/cloud/tools/jib/registry/RegistryAuthenticatorTest.java @@ -42,6 +42,16 @@ public void testFromAuthenticationMethod_basic() throws RegistryAuthenticationFa RegistryAuthenticator.fromAuthenticationMethod( "Basic realm=\"https://somerealm\",service=\"someservice\",scope=\"somescope\"", "someimage")); + + Assert.assertNull( + RegistryAuthenticator.fromAuthenticationMethod( + "BASIC realm=\"https://somerealm\",service=\"someservice\",scope=\"somescope\"", + "someimage")); + + Assert.assertNull( + RegistryAuthenticator.fromAuthenticationMethod( + "bASIC realm=\"https://somerealm\",service=\"someservice\",scope=\"somescope\"", + "someimage")); } @Test