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

Use service as hostname fallback to enable keyring usage on redirects #29

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
1.1.2
---
* Use service as hostname fallback to enable http redirect use cases.
https://github.com/GoogleCloudPlatform/artifact-registry-python-tools/pull/29

1.1.1
---
* Remove unused keyring import to prevent keyring dependency issues.
Expand All @@ -8,7 +13,7 @@

1.0.0
---
* Upgrading tool to version 1.0.0 since Artifact Registry Python Repositories is now in GA.
* Upgrading tool to version 1.0.0 since Artifact Registry Python Repositories is now in GA.

0.0.3
---
Expand Down
4 changes: 3 additions & 1 deletion keyrings/gauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ class GooglePythonAuth(backend.KeyringBackend):

def get_password(self,service,username):
url = urlparse(service)
if url.hostname is None or not url.hostname.endswith(".pkg.dev"):
hostname = service if url.hostname is None else url.hostname

if hostname is None or not hostname.endswith(".pkg.dev"):
return

#trying application default credentials otherwise fall back to gcloud credentials command
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[metadata]
license_file = LICENSE
name = keyrings.google-artifactregistry-auth
version = 1.1.1
version = 1.1.2
author = Megan Kuo
author_email = megankuo@google.com
description = Keyring backend for Google Auth tokens
Expand Down