Skip to content

Commit

Permalink
fix(provider/docker): update bearer_token to access_token (#2274) (#2275
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mike10010100 authored and lwander committed Jan 5, 2018
1 parent 59eee15 commit cf63e99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import groovy.transform.ToString

@ToString(includeNames = true)
class DockerBearerToken {
// One of token or bearer_token will be filled by the request.
// One of token, access_token, or bearer_token will be filled by the request.
String token
String access_token
String bearer_token
int expires_in
String issued_at
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ class DockerRegistryClient {
DockerBearerToken dockerToken = tokenService.getToken(target)
String token
if (dockerToken) {
token = "Bearer ${dockerToken.bearer_token ?: dockerToken.token}"
token = "Bearer ${(dockerToken.bearer_token ?: dockerToken.token) ?: dockerToken.access_token}"
}

Response response
Expand Down Expand Up @@ -423,7 +423,7 @@ class DockerRegistryClient {
if (bearerPrefix.equalsIgnoreCase(authenticateHeader.substring(0, bearerPrefix.length()))) {
// If we got a 401 and the request requires bearer auth, get a new token and try again
dockerToken = tokenService.getToken(target, authenticateHeader.substring(bearerPrefix.length()))
token = "Bearer ${dockerToken.bearer_token ?: dockerToken.token}"
token = "Bearer ${(dockerToken.bearer_token ?: dockerToken.token) ?: dockerToken.access_token}"
response = withToken(token)
} else if (basicPrefix.equalsIgnoreCase(authenticateHeader.substring(0, basicPrefix.length()))) {
// If we got a 401 and the request requires basic auth, there's no point in trying again
Expand Down

0 comments on commit cf63e99

Please sign in to comment.