Skip to content

refactor: tidy auth token validation and scope handling#764

Merged
DaleSeo merged 5 commits into
mainfrom
refactor/lift-jwt-claims
Jun 22, 2026
Merged

refactor: tidy auth token validation and scope handling#764
DaleSeo merged 5 commits into
mainfrom
refactor/lift-jwt-claims

Conversation

@DaleSeo

@DaleSeo DaleSeo commented Jun 12, 2026

Copy link
Copy Markdown
Member

On the validation side, we're moving the Claims type and the algorithm mapping out of the long validate method. Now, the function reads more clearly as a "try each server, resolve key, decode, check claims" loop, and we can unit-test the claim logic directly. We’re also replacing the VerificationKey struct with a simple (Jwk, String) tuple returned from KeyResolver::resolve_key.

On the scope side, we're pulling the scope-sufficiency check into a new ScopeMode::is_satisfied_by method. This way, the scope tests will use the actual logic instead of a copied version. We’re also rendering the scope_mode header through ScopeMode::as_str instead of going through a JSON round-trip.

@DaleSeo DaleSeo self-assigned this Jun 12, 2026
@apollo-librarian

apollo-librarian Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: 4c25b167fe8a540f1aee5c93
Build Logs: View logs


✅ AI Style Review — No Changes Detected

No MDX files were changed in this pull request.

Review Log: View detailed log

This review is AI-generated. Please use common sense when accepting these suggestions, as they may not always be accurate or appropriate for your specific context.

@DaleSeo DaleSeo changed the title refactor: tidy JWT validation internals refactor: tidy auth token validation and scope handling Jun 12, 2026
@DaleSeo DaleSeo marked this pull request as ready for review June 12, 2026 19:35
@DaleSeo DaleSeo requested a review from a team as a code owner June 12, 2026 19:35
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

⏭️ Changeset check skipped via label

@DaleSeo DaleSeo added the skip-changeset Used when the changeset verification can be skipped label Jun 12, 2026
/// back to alternate discovery URLs on failure; real providers advertise
/// the same `jwks_uri` from every well-known path.
async fn resolve_key(&self, server: &Url, key_id: &str) -> Option<VerificationKey> {
async fn resolve_key(&self, server: &Url, key_id: &str) -> Option<(Jwk, String)> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Naive question, but what does the tuple approach provide thats superior to the VerificationKey struct approach? Is it just easier destructuring?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I went with a tuple because VerificationKey felt like an incomplete name for a struct containing both the JWK and the issuer. I couldn't come up with a better name that wasn't overly wordy, so I thought I'd just opt for the tuple instead. :)

@DaleSeo DaleSeo merged commit 2bf1cf8 into main Jun 22, 2026
20 of 21 checks passed
@DaleSeo DaleSeo deleted the refactor/lift-jwt-claims branch June 22, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changeset Used when the changeset verification can be skipped

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants