Conversation
Chapter 7 claimed it needed docker-compose. Only half of it does. Sections 7.4 to 7.5.1 just read, and the deployed proxy already runs the same filter against seeded `private-alice-demo` and `private-bob-demo` collections. Two things were in the way. A notebook could not sign in to Cognito without a browser. Confirmed against the live pool: InvalidParameterException: USER_PASSWORD_AUTH flow not enabled for this client Enable that flow on the app client. It does not weaken the write protection: Cognito issues USER_PASSWORD_AUTH tokens scoped `aws.cognito.signin.user.admin` and never the custom `stac/*` scopes, so such a token still fails PRIVATE_ENDPOINTS. It does carry `username`, which is all the row-level filter reads. `user_srp` is named alongside it because specifying any flow replaces Cognito's implicit defaults, and silently dropping SRP would be an unintended narrowing. Second, the narrowed warning would have been a half-truth without a way to act on it -- the notebook calls require_local_auth_stack(), which hard-fails without MOCK_OIDC_ENDPOINT. Add `deployed_auth()` and `get_cognito_token()` to docs/stac_auth.py, and a 7.3.3 snippet showing the swap. Verified `deployed_auth()` against the live config endpoint: it returns the proxy endpoint, client id, region parsed from the discovery URL, and the shared password. `get_cognito_token()` currently fails with exactly the error above, which is the redeploy and nothing else. Section 7.6 stays local, and not only because writes are disabled: these tokens carry no `stac/write` scope, so the write rejection there would fail at route-level auth rather than demonstrating row-level auth -- the right answer for the wrong reason. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P1CCcrx5fDKuAGsNh8DUFG
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
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.
Targets
feat/stac-auth-proxy-lambda(#49), notmain.Chapter 7 says it needs docker-compose. Only half of it does — sections 7.4 to 7.5.1 just read, and the deployed proxy already runs the same filter against the seeded
private-alice-demoandprivate-bob-democollections. This makes that half actually runnable, and narrows the warning to match.Two things were in the way
A notebook could not sign in to Cognito without a browser. Confirmed against the live pool:
Now enabled on the app client. It does not weaken the write protection: Cognito issues
USER_PASSWORD_AUTHtokens scopedaws.cognito.signin.user.adminand never the customstac/*scopes, so such a token still fails the scope check inPRIVATE_ENDPOINTS. It carriesusername, which is all the row-level filter reads.user_srpis named alongside it deliberately — specifying any flow replaces Cognito's implicit defaults, and silently dropping SRP would be an unintended narrowing of the client.The narrowed warning would have been a half-truth without a way to act on it. The notebook calls
require_local_auth_stack(), which hard-fails withoutMOCK_OIDC_ENDPOINT. Sodocs/stac_auth.pygainsdeployed_auth()andget_cognito_token(), and §7.3.3 gains a short snippet showing the swap — the setup cell, the seeded collection ids, and where to stop.Verification
deployed_auth()exercised against the live config endpoint: returns the proxy endpoint, client id, the region parsed out of the discovery URL, and the shared password.get_cognito_token()currently fails with exactly theUSER_PASSWORD_AUTH flow not enablederror above — which is the redeploy and nothing else. Worth confirming after deploy that a token really does come back carryingusername; the scope claim is documented Cognito behaviour rather than something I could test pre-deploy.Also ran:
cdk synth(OK,ExplicitAuthFlowsnow['ALLOW_USER_PASSWORD_AUTH', 'ALLOW_USER_SRP_AUTH', 'ALLOW_REFRESH_TOKEN_AUTH']), the filter self-check, notebook JSON validity, ruff.Why 7.6 stays local
Not only because writes are disabled. These tokens carry no
stac/writescope, so the write-rejection demo would fail at route-level auth rather than demonstrating row-level auth — the right answer for the wrong reason, which is worse than not showing it.On the related question of getting custom scopes at all:
stac/readandstac/writeare only issuable from the OAuth token endpoint (/oauth2/token), viaauthorization_code(needs a browser redirect) orclient_credentials(needs a client secret and has no user identity, so nousernameclaim). TheInitiateAuthflows don't take ascopeparameter at all. So a headless token carrying both a user identity and a custom scope isn't reachable through Cognito's supported APIs — which is the constraint that shapes this split.🤖 Generated with Claude Code
https://claude.ai/code/session_01P1CCcrx5fDKuAGsNh8DUFG