The previous commit refuses at registration a method the server assigns
that magpie can't send. The owner asked on #1490 that an assignment
magpie can do be shown still to work; no test did. One now does, for
the code exchange and a renewal after the access token is refused:
- asked none, assigned client_secret_basic with a secret;
- asked none, assigned client_secret_post with a secret;
- asked client_secret_post, assigned none with no secret (a public
client), which sends no secret;
- asked client_secret_basic (the only one listed), assigned post.
The fake's registration took an assigned method only when its metadata
listed it, so "none" assigned to a server listing only post was turned
away as invalid_client_metadata; a method the server assigns is one it
supports, so with Assign set it is taken.
Run (sandbox HOME, private GOCACHE): the new test and
TestSignInRefusesAssignedSecretJWT, TestSignInBySecretBasic; go test
-race ./internal/mcpauth/... and ./internal/library (which signs in
through the fake) pass. Broken by hand: with register ignoring the
response's token_endpoint_auth_method the new test fails at the first
case ("the token endpoint answered 400: invalid_grant"); without the
previous commit's check TestSignInRefusesAssignedSecretJWT fails ("the
sign-in page was opened for a client magpie can't authenticate as").
Co-authored-by: ggbdpq <ggbdpq@gmail.com>