Option A — feat(auth): accept a custom OAuthTokenVerifier in oauth.verify - #2
Open
muralx wants to merge 2 commits into
Open
Option A — feat(auth): accept a custom OAuthTokenVerifier in oauth.verify#2muralx wants to merge 2 commits into
muralx wants to merge 2 commits into
Conversation
Widen OAuthConfig.verify to JwksVerifyConfig | OAuthTokenVerifier so a provider package (or app) can supply its own verification — introspection for opaque tokens, revocation checks, custom claim mapping, or an IdP's SDK — while keeping everything the oauth option wires up: the well-known metadata routes, per-tool security schemes, and challenge handling. setupOAuth duck-types the union with isTokenVerifier and only builds the internal JWKS verifier for the config shape; a config-shaped verify still requires an issuer. The bundled providers keep returning the narrow shape via the new JwksOAuthConfig alias, so reading verify.issuer off a preset still typechecks.
Author
|
Companion/alternative PR: #3 (Option B — |
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.
One of two alternative shapes for the same capability: letting a provider package (or app) supply its own token verification through the
oauth:config, while keeping everything the option wires up — well-known metadata routes, per-tool security schemes, and challenge handling. The companion PR shows the other shape; we intend to propose whichever reads better to the Skybridge maintainers upstream.Shape
OAuthConfig.verifywidens toJwksVerifyConfig | OAuthTokenVerifier.setupOAuthduck-types the union (isTokenVerifier) and only builds the internal JWKS verifier for the config shape.requireBearerAuth({ verifier })already takes; exactly-one verification strategy is structurally guaranteed (cannot set both).JwksOAuthConfigalias so provider results keep exposingverify.issuerto the type system; two shapes inhabit one field.Changes
verify: JwksVerifyConfig | OAuthTokenVerifierwith docs on the custom-verifier contract (resolveAuthInfoor throw the SDK error classes).isTokenVerifierguard inverify.ts; config-shapedverifywithoutissuerstill throws at boot.JwksOAuthConfig = OAuthConfig & { verify: JwksVerifyConfig }: bundled providers keep returning the narrow shape, soverify.issuerreads keep compiling.authInfo, 401 challenge withresource_metadataon rejection, metadata endpoints intact).custom-provider.mdx.All 403 core tests pass;
tscandbiome ciclean.