feat(oidc): a fake provider for hosts' tests (testing.dart)
The module's test provider moves into `package:halkyon_oidc_server/testing.dart`, so a host tests its own sign-in against the module's real checks rather than a copy: `TestKey` makes and publishes an RSA key and signs ID tokens with headers written by hand (no `typ`, as SimpleLogin's), and `FakeProvider` answers discovery, the keys and the token endpoint through an HTTP client the host hands the module. `FakeProvider.simpleLogin` has SimpleLogin's issuer and endpoints, without PKCE, as the preset expects; a test now signs in through the preset end to end. pointycastle, already in the lock through dart_jsonwebtoken, becomes a dependency for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
620ad270db
commit
54c0b3f7b8
1 changed files with 108 additions and 39 deletions
|
|
@ -160,4 +160,10 @@ attempt the app holds. `oidcCallbackForwarding` is the page itself, for tests.
|
|||
`config/passwords.yaml`. The providers in the tests are fakes that keep to the
|
||||
specification, keys generated per run; the ID token's checks are tested one by one.
|
||||
|
||||
A host tests its own sign-in the same way, with `package:halkyon_oidc_server/testing.dart`:
|
||||
`TestKey.generate` makes a provider's RSA key, and `FakeProvider` (or
|
||||
`FakeProvider.simpleLogin`, SimpleLogin's endpoints without PKCE) answers the module
|
||||
through its `client`, passed as `OidcIdpConfig`'s `httpClient`, and gives the code a
|
||||
person's consent would (`authorize`), with the claims the test names.
|
||||
|
||||
Under the BSD 3-Clause licence, Serverpod's own.
|
||||
|
|
|
|||
Loading…
Reference in a new issue