Ver código fonte

Do not require refresh token to obtain ACR token. Especially this will make the ACR auto-login feature work with Service Principal login, that does not have a refresh token

Signed-off-by: Guillaume Tardif <[email protected]>
Guillaume Tardif 5 anos atrás
pai
commit
04c678b099
1 arquivos alterados com 2 adições e 3 exclusões
  1. 2 3
      aci/convert/registry_credentials.go

+ 2 - 3
aci/convert/registry_credentials.go

@@ -150,10 +150,9 @@ func (c cliRegistryHelper) autoLoginAcr(registry string) error {
 	}
 
 	data := url.Values{
-		"grant_type":    {"access_token_refresh_token"},
+		"grant_type":    {"access_token"},
 		"service":       {registry},
 		"tenant":        {tenantID},
-		"refresh_token": {token.RefreshToken},
 		"access_token":  {token.AccessToken},
 	}
 	repoAuthURL := fmt.Sprintf("https://%s/oauth2/exchange", registry)
@@ -162,7 +161,7 @@ func (c cliRegistryHelper) autoLoginAcr(registry string) error {
 		return err
 	}
 	if res.StatusCode != 200 {
-		return errors.Errorf("error while renewing access token, status : %s", res.Status)
+		return errors.Errorf("error while accessing ACR token from Azure login, status : %s", res.Status)
 	}
 	bits, err := ioutil.ReadAll(res.Body)
 	if err != nil {