Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token Auth Backend: Token request function didn`t set Authorization Header #153

Merged
merged 6 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
mariusbertram marked this conversation as resolved.
Show resolved Hide resolved
- 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
Loading