Repository navigation
feat(api): accept Bearer API tokens on GET /api/identities - #228
Merged
Merged
Conversation
A service that mentions people, such as a notifier tagging the authors of a change, needs the GitHub and Discord handles the registry holds, and only a dashboard session could read them. A token reads what its user's session would: a non-admin token gets the redacted view, which keeps those handles. Bearer and session auth now share one Caller extractor, and AdminCaller builds on it.
Code review
Adds a shared Walkthrough (4)
Reviewed Tip Comment |
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.

Lets a service read the user registry with an API token, so it can mention people by their Discord or Slack handle. For example, a notifier can tag the authors of the code an alert points at. Until now,
GET /api/identitiesonly accepted a dashboard session.Changes
Callerextractor: authenticates byAuthorization: Bearer <token>or, when that header is absent, by session. It is the Bearer half ofAdminCaller, moved out unchanged: a present header never falls back to the cookie, and failed attempts spend the per-address bearer limit.AdminCalleris nowCallerplus the admin check, soPUT /api/directorybehaves exactly as before.GET /api/identitiestakes aCaller. A token sees what its user's session would see: a non-admin token gets other people redacted (no email, phone numbers, push keys or chat ids), while GitHub, Discord and Slack handles stay visible.A service should use a token from a viewer account, with an expiry, not an admin token.
Tests
cargo clippy -p claudear-engine --all-targets --all-features -- -D warningsis clean.cargo test -p claudear-engine --features sqlite --libpasses for identities (36), directory (57),api::auth(76) andapi::security(29).Related: appwrite-labs/cloud#6671