Skip to content

Stop raising exceptions for optional discovery fields - #983

Open
w-goog wants to merge 7 commits into
masterfrom
codegen/rfc8414-optional-metadata-a
Open

w-goog wants to merge 7 commits into
masterfrom
codegen/rfc8414-optional-metadata-a

Conversation

@w-goog

@w-goog w-goog commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

This PR is the first half of fixing #380.

  • OIDServiceDiscovery now checks that every URL-valued field that's present is a string. Only the nonnull ones (issuer, authorization_endpoint, token_endpoint, jwks_uri) have to parse - a sloppy optional URL just reads as nil.
  • A JSON null or a non-string value fails with OIDErrorCodeInvalidDiscoveryDocument instead of raising an exception.
  • Yay for re-enabling the two pendingTest... cases!! plus one for the non-string case and one for the sloppy-optional case.

RFC 8414 documents that omit jwks_uri & co. still fail validation. The right fix is to mark those properties nullable, but that'd be source-breaking, so we'll do that in the 4.0 release.

Note for reviewers: I narrowed the URL check, since a provider's sloppy op_tos_uri shouldn't block a sign-in. The present URL fields must be strings (or the getters get sad), but only the nonnull ones have to parse. The nullable getters already return nil for a bad URL.

@w-goog
w-goog force-pushed the codegen/rfc8414-optional-metadata-a branch from 64bc32c to c1f51bd Compare October 21, 2026 22:03
@w-goog w-goog changed the title [Draft] Stop raising exceptions for optional discovery fields Stop raising exceptions for optional discovery fields Oct 22, 2026
@w-goog
w-goog requested a review from brnnmrls October 24, 2026 01:19

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant