mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
* feat(cognito): route /oauth2 requests on a custom domain by Host CognitoCustomDomainFilter (PreMatching, priority 12) resolves the request Host against the domain store and rewrites /oauth2/token and /oauth2/userInfo onto the /cognito-idp/oauth2 handlers. The pool the domain belongs to travels in a request property, so the controllers pin exactly the pool the filter matched and a caller cannot supply it. The token endpoint refuses a client of another pool with invalid_client and userInfo refuses a token of another pool with invalid_token, as AWS does. The lookups scan every account because an OAuth call carries no SigV4 account. The discovery document advertises https://<domain>/oauth2/... for a pool with a custom domain. S3VirtualHostFilter skips a request the Cognito filter routed, the way it already skips CloudFront ones, since a custom domain under a Floci suffix looks like a bucket host. * docs(cognito): custom domain routing * fix(cognito): run custom domain requests in the domain's account and keep domain names unique A request on a custom domain carries no AWS credential, so AccountContextFilter put it in the default account and the client, pool and user lookups missed a domain created under another account. The Cognito filter now pins the domain's account in a request property that AccountContextFilter honours before header resolution. Domain creation checks the name across every account, as AWS's single domain namespace does, and a name two accounts already hold from older data is not routed. Also adds the OAuth contract tests for the routed endpoints (client_secret_post, error codes, token claims, userInfo refusals, unserved paths, prefix domains, interleaved requests on several threads) in a second integration class. * fix(cognito): make the domain uniqueness check and write one step Two accounts creating the same custom domain at once both passed the cross-account scan and wrote under their own account-prefixed keys, leaving a name that routing then refused as ambiguous. The check and the write now run under one lock, the way identity-provider mutations already do. A 16-thread unit race and a two-account integration race pin exactly one owner.