Skip to content

Commit

Permalink
Token Auth Backend: Token request function didn`t set Authorization H…
Browse files Browse the repository at this point in the history
…eader (#153)

* Set Basic auth for token request

Signed-off-by: Marius Bertram <[email protected]>
  • Loading branch information
mariusbertram authored Sep 6, 2024
1 parent 5763015 commit 5d7b80d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are:
The versions coincide with releases on pip. Only major versions will be released as tags on Github.

## [0.0.x](https://github.com/oras-project/oras-py/tree/main) (0.0.x)
- add missing basic auth data for request token function in token auth backend (0.2.2)
- re-enable chunked upload (0.2.1)
- refactor of auth to be provided by backend modules (0.2.0)
- bugfix maintain requests's verify valorization for all invocations, augment basic auth header to existing headers
Expand Down
5 changes: 4 additions & 1 deletion oras/auth/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def authenticate_request(
"""
if refresh:
self.token = None

authHeaderRaw = original.headers.get("Www-Authenticate")
if not authHeaderRaw:
logger.debug(
Expand Down Expand Up @@ -122,7 +121,11 @@ def request_token(self, h: auth_utils.authHeader) -> bool:
logger.debug(f"Scope: {h.scope}")
params["scope"] = h.scope

# Set Basic Auth to receive token
headers["Authorization"] = "Basic %s" % self._basic_auth

authResponse = self.session.get(h.realm, headers=headers, params=params) # type: ignore

if authResponse.status_code != 200:
logger.debug(f"Auth response was not successful: {authResponse.text}")
return
Expand Down
2 changes: 1 addition & 1 deletion oras/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__copyright__ = "Copyright The ORAS Authors."
__license__ = "Apache-2.0"

__version__ = "0.2.1"
__version__ = "0.2.2"
AUTHOR = "Vanessa Sochat"
EMAIL = "[email protected]"
NAME = "oras"
Expand Down

0 comments on commit 5d7b80d

Please sign in to comment.