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

Update ns key discovery to follow openid-style lookups #583

Merged
merged 3 commits into from
Jan 31, 2024

Conversation

jhiemstrawisc
Copy link
Member

@jhiemstrawisc jhiemstrawisc commented Jan 2, 2024

Previously, namespace keys were fetched by hardcoding the issuer jwks relative to the namespace.
Now we conform to openid-style lookups by fetching the JSON located at
/api/v2.0/registry/metadata//.well-known/namespace-configuration
and following the URL associated with the jwks_uri key. Currently this is still the same key path
in all instances that I'm aware of, but in theory this could be expanded to point to other locations.
We can also expand this namespace-configuration JSON to include additional information as needed.

The architecture of this PR is that a GET request to the namespace-configuration url mentioned above
should dynamically generate the JSON with jwks_uri key and associated value. The value is used throughout
and assigned the issuer URL in various places where we need to create a token on behalf of themnamespace.

@jhiemstrawisc
Copy link
Member Author

Closes #111

@jhiemstrawisc jhiemstrawisc linked an issue Jan 3, 2024 that may be closed by this pull request
@jhiemstrawisc jhiemstrawisc added the enhancement New feature or request label Jan 3, 2024
@jhiemstrawisc jhiemstrawisc added this to the v7.5.0 milestone Jan 3, 2024
@haoming29
Copy link
Contributor

haoming29 commented Jan 9, 2024

I'm holding off reviewing this PR as there are major changes of registry API done in #613 which will cause significant merge conflict with this PR, and with #613 merged in, you might need also to downgrade the API version to be compatible, but I like the idea to have a conformed way to do the look up. Let's talk about how to proceed @jhiemstrawisc

@jhiemstrawisc
Copy link
Member Author

@haoming29, sounds good. Let's focus on getting #613 in, and then I can revisit this to see what still makes sense.

@haoming29
Copy link
Contributor

Hey @jhiemstrawisc How are we doing here? It feels like there are lots of related work done to the registry that causes considerable amount of merge conflict to this PR, and I thought it'd be beneficial to have it closed soon.

@jhiemstrawisc jhiemstrawisc force-pushed the issue-111 branch 2 times, most recently from 3374afa to fd92230 Compare January 29, 2024 21:06
Copy link
Contributor

@haoming29 haoming29 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Only concern from me is about backward compatibility. I'm taking extra caution because it bit us before, but let me know how you think about it and if Brian has some idea.

Previously, namespace keys were fetched by hardcoding the issuer jwks relative
to the namespace. Now we follow openid-style lookups by fetching the JSON
located at <registry url>/api/v2.0/registry/metadata/<namespace>/.well-known/namespace-configuration
and following the URL associated with the `jwks_uri` key. Currently this is still the same key path
in all instances that I'm aware of, but in theory this could be expanded to point to other locations.

The architecture of this PR is that a GET request to the namespace-configuration url mentioned above
should dynamically generate the `jwks_uri` key with associated value. The value is used throughout
and assigned the issuer URL in various places where we need to create a token on behalf of the
namespace.
Previously I wasn't using the term "issuer" correctly -- really, we should be thinking
about the issuer as the endpoint against which we perform openID-configuration lookup
to find the issuer key. That is, for registry.com and ns prefix /foo/bar, the issuer
is registry.com/api/v1.0/registry/foo/bar. We take that endpoint and grab the JSON
hosted at registry.com/api/v1.0/registry/foo/bar/.well-known/openid-configuration.
From there, most Pelican services will point to the key hosted at
registry.com/api/v1.0/registry/foo/bar/.well-known/issuer.jwks.
@jhiemstrawisc jhiemstrawisc merged commit 75b1064 into PelicanPlatform:main Jan 31, 2024
9 checks passed
@haoming29 haoming29 mentioned this pull request Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement namespace issuer auto-discovery
2 participants