Skip to content

feat(core): add UserStorage with argon2 password hashing and username migration#1067

Merged
geoffjay merged 17 commits into
issue-214from
issue-213
Apr 16, 2026
Merged

feat(core): add UserStorage with argon2 password hashing and username migration#1067
geoffjay merged 17 commits into
issue-214from
issue-213

Conversation

@geoffjay
Copy link
Copy Markdown
Owner

@geoffjay geoffjay commented Apr 9, 2026

Adds UserStorage with full CRUD operations, argon2id password hashing, lookup by username/email, set_active_organization, and paginated listing. Adds a second migration (m20260408_000002_add_username_to_users) to extend the users table with nullable username (unique-indexed) and active_organization_id columns. Updates all entity constructors and integration tests to include the new fields.

Closes #213

@geoffjay geoffjay added the review-agent Used to invoke a review by an agent tracking this label label Apr 9, 2026
geoffjay added 12 commits April 15, 2026 14:10
… migration

Adds UserStorage with full CRUD, argon2id password hashing, get_by_username/email,
set_active_organization, and paginated listing. Adds migration to extend the users
table with nullable username (unique) and active_organization_id columns. Updates
all entity helpers and integration tests to include the new fields.
…oint

Adds TenantContext extractor (session + active org required, 403 if no
active org) and PUT /users/me/active-organization endpoint with membership
validation. Also adds api/users.rs module with 4 endpoint tests.
Implements POST /auth/register, POST /auth/login, POST /auth/logout, and
GET /auth/me. Adds SessionStorage with 256-bit random token generation,
expiry cleanup, and AuthUser extractor middleware. Registration creates a
default personal organization and sets it as the active organization.
Adds `agent auth register/login/logout/status` and `agent org list/create/switch`
commands communicating with the agentd-core service (port 17007). Session token
stored at ~/.config/agentd/session with 0600 permissions. Adds `dirs` dependency
for cross-platform config path resolution. Registers core service in status check.
Adds GET/PUT /api/v1/users/me, PUT /api/v1/users/me/password,
GET /api/v1/users/me/organizations, and full CRUD for organizations
with member management (add, remove, list). Enforces owner-only mutations,
last-owner protection, and clears active_organization_id on org deletion.
Adds update_email, update_password, and clear_active_organization_for_org
to UserStorage. 21 new endpoint tests covering auth and authorization checks.
Implements HTTP reverse proxy in crates/core that forwards /api/v1/{service}/*
requests to downstream agentd services with X-Tenant-ID and X-Request-ID header
injection. Includes concurrent health aggregation at /api/v1/health.
feat(core): add API gateway proxy for downstream service routing
feat(cli): add auth and org commands for core service
feat(core): add user and organization management API endpoints
feat(core): add TenantContext middleware and active organization endpoint
feat(core): add authentication endpoints with SQLite-backed sessions
@geoffjay geoffjay merged commit eff8865 into issue-214 Apr 16, 2026
@geoffjay geoffjay deleted the issue-213 branch April 16, 2026 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-agent Used to invoke a review by an agent tracking this label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add user model and SQLite storage to core service

1 participant