Deprecate constructing the pre-provisioned OAuth clients without an issuer (#3435)
This commit is contained in:
parent
d060b36e1d
commit
979208c115
2 changed files with 103 additions and 11 deletions
|
|
@ -33,8 +33,8 @@ the client and server side.
|
|||
- `client.py` `main` — opens with `async with Client(target, mode=mode) as
|
||||
client:` and that's the whole program. `target` is a transport that already
|
||||
carries the OAuth `httpx2.Auth`; the body never touches a token.
|
||||
- `client.py` `build_auth` — five lines of `ClientCredentialsOAuthProvider`
|
||||
config is all the caller writes; the SDK does RFC 9728 PRM →
|
||||
- `client.py` `build_auth` — a few lines of `ClientCredentialsOAuthProvider`
|
||||
config (credentials plus `issuer=`) is all the caller writes; the SDK does RFC 9728 PRM →
|
||||
RFC 8414 AS-metadata discovery and token exchange on the first 401.
|
||||
- `server.py` `token_endpoint` — the *entire* AS for this grant: validate
|
||||
HTTP-Basic `client_id:client_secret`, mint a token, return RFC 6749 JSON.
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ from stories._harness import Target, run_client
|
|||
|
||||
# MCP_URL pins the resource to :8000, and the server side builds its PRM/AS metadata from
|
||||
# the same constant — run the server on 8000 or the discovery chain points at the wrong origin.
|
||||
from stories._shared.auth import MCP_URL, InMemoryTokenStorage
|
||||
from stories._shared.auth import BASE_URL, MCP_URL, InMemoryTokenStorage
|
||||
|
||||
from .server import DEMO_CLIENT_ID, DEMO_CLIENT_SECRET, DEMO_SCOPE
|
||||
|
||||
|
||||
def build_auth(_http: httpx2.AsyncClient) -> httpx2.Auth:
|
||||
"""The ``httpx2.Auth`` for the ``client_credentials`` grant — five lines of provider config.
|
||||
"""The ``httpx2.Auth`` for the ``client_credentials`` grant — a few lines of provider config.
|
||||
|
||||
The SDK then handles 401 → RFC 9728 PRM → RFC 8414 AS-metadata discovery → token POST →
|
||||
Bearer attachment automatically. ``Client(url)`` has no ``auth=`` passthrough yet, so the
|
||||
|
|
@ -27,6 +27,7 @@ def build_auth(_http: httpx2.AsyncClient) -> httpx2.Auth:
|
|||
client_id=DEMO_CLIENT_ID,
|
||||
client_secret=DEMO_CLIENT_SECRET,
|
||||
scope=DEMO_SCOPE,
|
||||
issuer=BASE_URL,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue