You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c19bba1
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(common): auth and both SDKs share the token and pushed authorization responses (#578)
Part of #544. Stacked on #577: it branches from
`refactor/544-boundary-sdk-constants` and targets it.
The token and pushed authorization endpoints' answers were defined three
times:
- auth serialized private structs (`oidc/token.rs`,
`oidc/authorize/pushed.rs`);
- the Rust SDK deserialized its own private copies (`client.rs`);
- the TypeScript SDK decoded untyped shapes (`client.ts`).
Nothing tied them together. Auth's `expires_in` was an `i64` and the
SDK's a `u32`.
Both are now `TokenResponse` and `PushedAuthorization` in
`sourceorigin_common::protocol::oauth`. Auth and the Rust SDK use them,
`protocol.ts` declares them, and the TypeScript decoders are typed
`json.Decoder<TokenResponse>` and `json.Decoder<PushedAuthorization>`.
- **`expires_in` is a `u32`.** That is what both SDKs accept, so their
behaviour stays the same. Auth's `ACCESS_TOKEN_SECONDS` and
`PUSHED_REQUEST_SECONDS` become `u32` too, widened where they meet `i64`
durations. Auth still sends 300 and 60.
- **`token_type` is a `String`.** The SDKs compare it without regard to
case, so the shared field stays open. Auth writes `AuthScheme::Bearer`'s
spelling.
- **The pushed answer's `expires_in` is never read.** Auth always sends
it; the Rust SDK skips it when deserializing (`skip_deserializing`), as
its old private struct did, and the TS decoder ignores it, so neither
SDK refuses a response over it.
- **Token counting moved.** It was a method on auth's old struct and is
now `OidcApplication::count_issued`.
- Tests merged or removed: none.
- Files edited outside the SDK area:
`apps/auth-service/src/oidc/{mod.rs,token.rs,authorize/pushed.rs,authorize/parameters.rs}`
and `apps/auth-service/src/keys/mod.rs`, which needs the one `as i64`
widening in its `const` key-retirement window.
**Proof the rest is unchanged:**
- `cargo semver-checks` for `sourceorigin-common` and
`sourceorigin-auth`: no semver update required.
- `just db test`: 497/497 pass, including the token endpoint and PAR
tests that assert the JSON bodies.
- `.d.ts` comparison: `protocol.d.ts` gains only the two types; the
entry points match `main`.
- Checks: clippy (with and without `--all-features`) for `auth-service`,
`sourceorigin-common` and `sourceorigin-auth`; rustdoc, doc tests and
`just test -p`; `just rust unused`; `just web
check`/`lint`/`unused`/`test` (172/172); `just docs`.
> [!NOTE]
> Written by Claude Opus 5.5 in Claude Code and reviewed by Claude Opus
5.5 (via T3 Code)
0 commit comments