@@ -77,7 +77,16 @@ func ResolveAuthConfig(cfg *configfile.ConfigFile, index *registrytypes.IndexInf
7777 }
7878
7979 a , _ := cfg .GetAuthConfig (configKey )
80- return registrytypes .AuthConfig (a )
80+ return registrytypes.AuthConfig {
81+ Username : a .Username ,
82+ Password : a .Password ,
83+ ServerAddress : a .ServerAddress ,
84+
85+ // TODO(thaJeztah): Are these expected to be included?
86+ Auth : a .Auth ,
87+ IdentityToken : a .IdentityToken ,
88+ RegistryToken : a .RegistryToken ,
89+ }
8190}
8291
8392// GetDefaultAuthConfig gets the default auth config given a serverAddress
@@ -86,19 +95,27 @@ func GetDefaultAuthConfig(cfg *configfile.ConfigFile, checkCredStore bool, serve
8695 if ! isDefaultRegistry {
8796 serverAddress = credentials .ConvertToHostname (serverAddress )
8897 }
89- authconfig := configtypes.AuthConfig {}
98+ authCfg := configtypes.AuthConfig {}
9099 var err error
91100 if checkCredStore {
92- authconfig , err = cfg .GetAuthConfig (serverAddress )
101+ authCfg , err = cfg .GetAuthConfig (serverAddress )
93102 if err != nil {
94103 return registrytypes.AuthConfig {
95104 ServerAddress : serverAddress ,
96105 }, err
97106 }
98107 }
99- authconfig .ServerAddress = serverAddress
100- authconfig .IdentityToken = ""
101- return registrytypes .AuthConfig (authconfig ), nil
108+
109+ return registrytypes.AuthConfig {
110+ Username : authCfg .Username ,
111+ Password : authCfg .Password ,
112+ ServerAddress : serverAddress ,
113+
114+ // TODO(thaJeztah): Are these expected to be included?
115+ Auth : authCfg .Auth ,
116+ IdentityToken : "" ,
117+ RegistryToken : authCfg .RegistryToken ,
118+ }, nil
102119}
103120
104121// PromptUserForCredentials handles the CLI prompt for the user to input
@@ -213,7 +230,16 @@ func RetrieveAuthTokenFromImage(cfg *configfile.ConfigFile, image string) (strin
213230 return "" , err
214231 }
215232
216- encodedAuth , err := registrytypes .EncodeAuthConfig (registrytypes .AuthConfig (authConfig ))
233+ encodedAuth , err := registrytypes .EncodeAuthConfig (registrytypes.AuthConfig {
234+ Username : authConfig .Username ,
235+ Password : authConfig .Password ,
236+ ServerAddress : authConfig .ServerAddress ,
237+
238+ // TODO(thaJeztah): Are these expected to be included?
239+ Auth : authConfig .Auth ,
240+ IdentityToken : authConfig .IdentityToken ,
241+ RegistryToken : authConfig .RegistryToken ,
242+ })
217243 if err != nil {
218244 return "" , err
219245 }
0 commit comments