-
Notifications
You must be signed in to change notification settings - Fork 1.1k
oidc: Google JWKS/services scaffolding #13569
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1f4f07a
oidc: Google JWKS/services scaffolding
woodruffw ee0112b
Merge remote-tracking branch 'upstream/main' into tob-google-oidc-ser…
woodruffw 88a8abf
oidc/utils: refactor, handle Google publishers
woodruffw 5e1aac6
Merge remote-tracking branch 'upstream/main' into tob-google-oidc-ser…
woodruffw eed76f3
oidc/utils: remove unused import
woodruffw 918d889
tests: coverage
woodruffw 059b1e6
warehouse: abstract away publisher lookups
woodruffw 889b6ad
Merge remote-tracking branch 'upstream/main' into tob-google-oidc-ser…
woodruffw 50a7ca4
models/github: normalize environment
woodruffw 49a2786
Merge branch 'main' into tob-google-oidc-services
woodruffw 15748c8
Merge branch 'main' into tob-google-oidc-services
woodruffw a8d58b6
Merge branch 'main' into tob-google-oidc-services
woodruffw 66133f4
Merge branch 'main' into tob-google-oidc-services
woodruffw 93f33d8
Merge remote-tracking branch 'upstream/main' into tob-google-oidc-ser…
woodruffw 8fd8018
Merge branch 'main' into tob-google-oidc-services
di File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,14 @@ | |
from warehouse.oidc.models import _core, google | ||
|
||
|
||
def test_lookup_strategies(): | ||
assert ( | ||
len(google.GooglePublisher.__lookup_strategies__) | ||
== len(google.PendingGooglePublisher.__lookup_strategies__) | ||
== 2 | ||
) | ||
|
||
|
||
class TestGooglePublisher: | ||
def test_stringifies_as_email(self): | ||
publisher = google.GooglePublisher(email="[email protected]") | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
|
||
from pyramid.authorization import Authenticated | ||
|
||
from tests.common.db.oidc import GitHubPublisherFactory | ||
from tests.common.db.oidc import GitHubPublisherFactory, GooglePublisherFactory | ||
from warehouse.oidc import utils | ||
from warehouse.utils.security_policy import principals_for | ||
|
||
|
@@ -69,7 +69,41 @@ def test_find_publisher_by_issuer_github(db_request, environment, expected_id): | |
assert ( | ||
utils.find_publisher_by_issuer( | ||
db_request.db, | ||
"https://token.actions.githubusercontent.com", | ||
utils.GITHUB_OIDC_ISSUER_URL, | ||
signed_claims, | ||
).id | ||
== expected_id | ||
) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"sub, expected_id", | ||
[ | ||
("some-other-subject", uuid.UUID("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa")), | ||
("some-subject", uuid.UUID("bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb")), | ||
], | ||
) | ||
def test_find_publisher_by_issuer_google(db_request, sub, expected_id): | ||
GooglePublisherFactory( | ||
id="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", | ||
email="[email protected]", | ||
sub=None, # No subject | ||
) | ||
GooglePublisherFactory( | ||
id="bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb", | ||
email="[email protected]", | ||
sub="some-subject", # Subject set | ||
) | ||
|
||
signed_claims = { | ||
"email": "[email protected]", | ||
"sub": sub, | ||
} | ||
|
||
assert ( | ||
utils.find_publisher_by_issuer( | ||
db_request.db, | ||
utils.GOOGLE_OIDC_ISSUER_URL, | ||
signed_claims, | ||
).id | ||
== expected_id | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
woodruffw marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.