Merge pull request #517 from docker/acr_fix

Acr : do not require refresh token, and work fine with Service Principal Login
This commit is contained in:
Guillaume Tardif 2020-08-21 12:52:25 +02:00 committed by GitHub
commit 92025607c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -150,11 +150,10 @@ func (c cliRegistryHelper) autoLoginAcr(registry string) error {
}
data := url.Values{
"grant_type": {"access_token_refresh_token"},
"service": {registry},
"tenant": {tenantID},
"refresh_token": {token.RefreshToken},
"access_token": {token.AccessToken},
"grant_type": {"access_token"},
"service": {registry},
"tenant": {tenantID},
"access_token": {token.AccessToken},
}
repoAuthURL := fmt.Sprintf("https://%s/oauth2/exchange", registry)
res, err := http.Post(repoAuthURL, "application/x-www-form-urlencoded", strings.NewReader(data.Encode()))
@ -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 {