feat(admin): pass organization deletion through to the auth API - #157
Merged
Conversation
The auth API gained DELETE /admin/organizations/:organizationId, and neither adapter forwarded it, so a caller going through the adapter got a 404 from the adapter's own router rather than reaching the API at all. Both adapters now proxy it with the access identity, the same way the neighbouring organization routes are proxied. GET /admin/organizations needed no change. Both adapters already forward the query string, so the limit, offset and search parameters the API added alongside the delete route reach it without one. A test now pins that, since nothing else in the suite covered query forwarding on this route and it would have broken silently. The route requirement in ensureCookies is prefix matched, so /admin/organizations already covers the id-scoped path and the delete requires an access cookie like its neighbours. A test covers the sessionless case, because forwarding a destructive call upstream with no identity attached is the failure that matters. The parity cases were checked by removing the Fastify route and confirming both fail, so they hold the two adapters together rather than passing regardless.
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.
Follow-up to fells-code/seamless-auth-api#288, which added
DELETE /admin/organizations/{organizationId}andlimit/offset/searchonGET /admin/organizations. Unblocks fells-code/seamless-auth-admin-dashboard#219.What changed
Neither adapter forwarded the new delete route, so a dashboard or backend calling through the adapter got a 404 from the adapter's own router rather than reaching the API at all. Both now proxy it with the access identity, the same way the neighbouring organization routes are proxied. It is one route entry per adapter:
packages/express/src/createServer.ts, anr.deletematching thePATCHabove itpackages/fastify/src/routes/proxyRoutes.ts, onePROXY_ROUTESentryWhat did not need changing
Query forwarding. Both adapters already pass
req.querytoproxyRequest, solimit,offsetandsearchreach the API with no code change. Nothing in the suite covered that on this route, though, so it would have broken silently. There is now a test pinning it.Cookie requirements. The requirement map in
ensureCookiesis prefix matched, so the existing/admin/organizationsentry already covers the id-scoped path and the delete requires an access cookie like its neighbours. A test covers the sessionless case, since forwarding a destructive call upstream with no identity attached is the failure that would matter.Release ordering
No lockstep requirement, unlike the passkey enrollment change. These adapters can ship before or after the API: called against an API that does not serve the route, the delete returns that API's 404, which is what the caller would have got anyway.
Verification
pnpm buildclean across all three packagespnpm test: core 246, express 159 (up from 156), fastify 54 (up from 52), all passingRemaining work for the dashboard issue
seamless-auth-docs: the new route in the reference table, and the list's query parametersseamless-auth-admin-dashboard: the delete hook, the Remove action, and server-side paging