feat: add positive tests for the Authorization Code Grant (supersedes #267)#364
Merged
Conversation
…cret_basic; add 'none' branch
…op fabricated code_challenge assertion
commit: |
87d81d3 to
c58073e
Compare
Member
Author
|
See additional discussion in #267 |
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.
Supersedes #267 by @Michito-Okai. Original commit cherry-picked with authorship preserved (
5c8b78e), rebased onto currentmain(post-#227, post-#360), and followed by review fixes as separate commits.What this adds
An
authorization-code-grantscenario for theauthorizationsubcommand: the tool acts as an OAuth client, runs the full code-grant flow (PKCE S256) against the AS under test via a loopback callback server, and validates the authorization and token responses against OAuth 2.1 §4.1.New CLI options:
--client-id,--client-secret(optional — public/PKCE-only clients supported),--port(default 3000). All composable with--filefrom #360.Review fixes applied on top (each a separate commit)
import typeforAuthorizationServerOptionsintypes.ts(breaks a module cycle)--client-id/--client-secretmade optional;--secret→--client-secret;portdefaults to 3000 — restores metadata-only runs and enables public clientsURLSearchParams; hardcodedresource=https://api.example.com/app/dropped; redirect URI uses127.0.0.1per RFC 8252 §8.3token_endpoint_auth_methods_supporteddefaults to['client_secret_basic']per RFC 8414 §2 when omitted;noneauth method supported; Basic credentials form-urlencoded per RFC 6749 §2.3.1?error=checked beforecode;statemismatch is fatal (no token request fires); thecode_challenge-in-response assertion dropped (no spec basis — OAuth 2.1 §4.1.2 says clients ignore unrecognized params)access_token/refresh_token/id_tokenmasked incheck.details(abcd…wxyz (len=N); fully redacted under 16 chars)GET /callback, exposesclose(),errorhandler forEADDRINUSE, timeout cleared on resolve; URL built from the bind address rather than theHostheaderLeft for follow-up (discussed on #267)
detailsstate bag with a typed run-context or a shared metadata-fetch helperauthorizationsubcommandCloses #267. Closes #208.