docs: deprecate the id_token response_type default - #63
Merged
Conversation
getAuthorizationUrl() defaults to response_type=id_token with response_mode=query — the OIDC implicit flow, with the ID token delivered in the query string. Callers should pass response_type=code and exchange via getIdToken(), which is what openid-connect-bundle already does. Two accurate reasons, since the obvious citation does not apply. OIDC Core §3.2.2.5 returns implicit-flow parameters in the fragment, which never reaches the server — so the query response mode exists to make the token readable server-side, relying on a provider extension rather than anything the spec describes. And it puts a credential in the query string, where web server access logs and browser history keep it. RFC 9700 §2.1.2 recommends code over response types that return tokens in the authorization response, but its normative sentence names access tokens and offers `code id_token` as acceptable, so it does not literally cover a bare id_token response. The README says so rather than overstating it. Documentation only. The default becomes code in 6.0; no runtime deprecation notice is emitted, because it would fire on this library's own default path and consumers could only silence it by making the change the notice asks for — which the changelog and README ask for directly instead.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #63 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 88 88
===========================================
Files 1 1
Lines 224 224
===========================================
Hits 224 224
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
getAuthorizationUrl()defaults toresponse_type => 'id_token'withresponse_mode => 'query'— the OIDC implicit flow, with the ID token delivered in the query string. Callers should passresponse_type => 'code'and exchange the code withgetIdToken(), which is what openid-connect-bundle already does.The default becomes
codein 6.0. This PR announces that and documents why; it changes no behaviour.Why, accurately
Two reasons, and deliberately not the one that looks obvious:
response_mode => 'query'default exists to make the ID token readable server-side — a provider extension (Azure AD B2C supports it) rather than something the spec describes. The README's own verification example reads$request->query->get('id_token'), which only works because of it.RFC 9700 §2.1.2 does not forbid this, and the docs say so rather than overstating the case. Its normative sentence covers response types that issue access tokens in the authorization response, and it names
code id_tokenas an acceptable alternative — so a bareid_tokenresponse falls outside the prohibition. It does point atcodeas the flow to prefer.Why no runtime notice
An
E_USER_DEPRECATEDwould fire on this library's own default path, so every consumer that has never touchedresponse_typewould see it, and the only way to silence it is to make the change the notice is asking for. The changelog and README ask for it directly instead. Happy to add the notice if you would rather have it enforced noisily.Changes
README.mdgains aResponse type: pass code explicitlysubsection replacing the bare note that previously just stated the defaults without comment.getAuthorizationUrl(), so the next reader of that array finds the reasoning at the point of the decision.### Deprecatedchangelog entry.Verification
136 tests green, coverage 100%, mutation 100% (unchanged — no logic touched). markdownlint, prettier, php-cs-fixer and PHPStan max clean at the ceiling and at the dependency floor.