Skip to content

Commit

Permalink
Merge pull request #797 from shibbas/addoauth2compatibilityforregistry
Browse files Browse the repository at this point in the history
enable registry to use oauth 2.0 as well.
  • Loading branch information
captainsafia authored Feb 23, 2019
2 parents 67d7d68 + 810f9c0 commit 64bb3c7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions binderhub/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,13 @@ def get_image_manifest(self, image, tag):
auth_password=self.password,
)
auth_resp = yield client.fetch(auth_req)
token = json.loads(auth_resp.body.decode("utf-8", "replace"))["token"]

response_body = json.loads(auth_resp.body.decode("utf-8", "replace"))

if "token" in response_body.keys():
token = response_body["token"]
elif "access_token" in response_body.keys():
token = response_body["access_token"]

req = httpclient.HTTPRequest(
"{}/v2/{}/manifests/{}".format(self.url, image, tag),
headers={"Authorization": "Bearer {}".format(token)},
Expand Down

0 comments on commit 64bb3c7

Please sign in to comment.