22
33import java .util .List ;
44
5+ import org .slf4j .Logger ;
6+ import org .slf4j .LoggerFactory ;
7+
58import com .github .dockerjava .api .model .AuthConfig ;
69import com .github .dockerjava .core .DockerClientConfig ;
710import com .github .dockerjava .core .DockerClientConfigDelegate ;
1114
1215class AuthDelegatingDockerClientConfig extends DockerClientConfigDelegate {
1316
17+ private static final Logger log = LoggerFactory .getLogger (AuthDelegatingDockerClientConfig .class );
18+
1419 private List <RegistryAuthConfig > registryAuthInfo ;
1520
1621 public AuthDelegatingDockerClientConfig (DockerClientConfig delegate ) {
@@ -23,20 +28,26 @@ public void setRegistryAuthConfigs(List<RegistryAuthConfig> registryAuthInfo) {
2328
2429 @ Override
2530 public AuthConfig effectiveAuthConfig (String imageName ) {
31+ log .debug ("Resolving authentication configuration for image " +imageName );
2632 AuthConfig fallbackAuthConfig ;
2733 try {
2834 fallbackAuthConfig = super .effectiveAuthConfig (imageName );
35+ log .debug ("fallback config retrieved" );
2936 } catch (Exception e ) {
3037 fallbackAuthConfig = new AuthConfig ();
38+ log .debug ("no fallback config available" );
3139 }
3240
3341 // try and obtain more accurate auth config using our resolution
3442 final ImageReference parsed = new ImageReference (imageName );
3543 String address = parsed .getPort ()!=null ? parsed .getHost ()+":" +parsed .getPort () : parsed .getHost ();
44+
45+ log .debug ("Checking configuration for auth config for address " +address );
3646
3747 if (registryAuthInfo !=null ) {
3848 for (RegistryAuthConfig rac : registryAuthInfo ){
3949 if (address .equals (rac .getRegistryAddress ())){
50+ log .debug ("found match, configuring" );
4051 return new AuthConfig ()
4152 .withAuth (rac .getAuth ())
4253 .withEmail (rac .getEmail ())
@@ -49,6 +60,7 @@ public AuthConfig effectiveAuthConfig(String imageName) {
4960 }
5061 }
5162
63+ log .debug ("no match, using fallback if available" );
5264 return fallbackAuthConfig ;
5365 }
5466}
0 commit comments