gtristan commented on code in PR #59:
URL:
https://github.com/apache/buildstream-plugins/pull/59#discussion_r1372565006
##########
src/buildstream_plugins/sources/docker.py:
##########
@@ -121,6 +121,26 @@ def urljoin(url, *args):
return url
+# Handles authentication with a bearer token
+class BearerAuth(requests.auth.AuthBase):
+ def __init__(self, api_timeout=3):
+ self.token = None
+ self.api_timeout = api_timeout
+
+ def __call__(self, r):
+ if self.token:
+ r.headers["Authorization"] = "Bearer {}".format(self.token)
+ return r
+
+ def _auth(self, realm, service, scope):
Review Comment:
There is no reason to mark this `_auth` function as private, and if we were
concerned with not having any public symbols in this file then we would rather
have `_BearerAuth` be private (however, it looks like there are other methods
and such in this file which are not concerned with that).
Previously, the `_auth()` private function which is removed by this patch,
is arguably relevant because it is on the `Source` object introduced into
BuildStream's data model.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]