Skip to content

Commit b4ed5ed

Browse files
authored
Merge pull request #18 from jdolitsky/check-username-password
Do not set basic auth if no username/password provided
2 parents 75d8f57 + ec032fb commit b4ed5ed

4 files changed

Lines changed: 7 additions & 3 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
run: |
2121
export PATH="/usr/share/miniconda/bin:$PATH"
2222
source activate black
23-
pip install black==21.6b0
23+
pip install black
2424
black --check opencontainers
2525
2626
testing:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Critical items to know are:
1616
Versions here coincide with releases on pypi.
1717

1818
## [master](https://github.com/vsoch/oci-python)
19+
- do not set basic auth if no username/password provided (0.0.14)
1920
- allow for update of a structure attribute, if applicable (0.0.13)
2021
- fix to bug with parsing www-Authenticate (0.0.12)
2122
- adding distribution spec (0.0.11)

opencontainers/distribution/reggie/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,12 @@ def retryRequestWithAuth(self, originalRequest, originalResponse):
222222
.SetQueryParam("service", h.Service)
223223
.SetHeader("Accept", "application/json")
224224
.SetHeader("User-Agent", self.Config.UserAgent)
225-
.SetBasicAuth(self.Config.Username, self.Config.Password)
226225
)
227226

227+
# Do not set basic auth if no username/password provided
228+
if self.Config.Username and self.Config.Password:
229+
req = req.SetBasicAuth(self.Config.Username, self.Config.Password)
230+
228231
# Set the scope, first priority to config, then header
229232
if self.Config.AuthScope:
230233
req.SetQueryParam("scope", self.Config.AuthScope)

opencontainers/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
55
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
66

7-
__version__ = "0.0.13"
7+
__version__ = "0.0.14"
88
AUTHOR = "Vanessa Sochat"
99
AUTHOR_EMAIL = "vsoch@users.noreply.github.com"
1010
NAME = "opencontainers"

0 commit comments

Comments
 (0)