Skip to content

Commit

Permalink
Update registry rest client to support bearer authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
gtato committed Mar 9, 2024
1 parent 5a87879 commit bb96178
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ def __init__(self, conf):
raise ValueError("basic.auth.user.info must be in the form"
" of {username}:{password}")

self.session.auth = userinfo if userinfo != ('', '') else None
self.session.auth = userinfo
elif 'token' in conf_copy:
token = conf_copy.pop('token')
self.session.headers['Authorization'] = f'Bearer {token}'

# Any leftover keys are unknown to _RestClient
if len(conf_copy) > 0:
Expand Down

0 comments on commit bb96178

Please sign in to comment.