phase 1 core platform
Milestone 1.1.4: Token Creation and Management API — complete.
Milestone 1.1.4: Token Creation and Management API
Status: Complete
Goal: 1.1 Persistence and auth data plane
Phase: 1 — Core Platform
Summary
Expose gRPC CreateToken, RevokeToken, and ListTokens on the auth service with ADR-0007 PAT wire format, Argon2id storage, caller bearer authz via metadata, and integration tests over the real creation path.
Branch
feature/m1-1-4-token-creation
PR title
feat(auth): token creation and management (m1.1.4)
Estimated effort
5–6 days
Prerequisites
Tasks
- Extend
ibex.auth.v1proto withCreateToken,RevokeToken,ListTokens+ messages -
GeneratePAT()inservices/auth/internal/token(ADR-0007:ibex_pat_<uuid>_<secret>, 32-bytecrypto/randsecret) - Reuse
HashBearer/VerifyBearer; repository never accepts plaintext -
TokenService+ repository create/revoke/list - gRPC handlers with
authorization: Bearermetadata interceptor (TokenCreate/TokenRevoke) - Audit logs
token_created/token_revoked(prefix only; never plaintext/hash) - Metrics:
ibex_auth_token_created_total,ibex_auth_token_revoked_total,ibex_auth_list_tokens_total - Integration: bootstrap admin → create → validate → revoke → unauthenticated
- Cross-tenant revoke returns
NotFound -
testutil.SeedBootstrapAdminTokenfor bootstrap; management tests use real gRPC - Amend ADR-0006; update SECURITY, API docs, auth README
- Bloom filter invalidation deferred to Phase 2 optional 2.2.1-auth-cache-bloom
- REST deferred (gRPC-only v1)
Files affected
| Path | Action |
|---|---|
packages/proto/proto/ibex/auth/v1/auth.proto | Extend |
packages/proto/auth_contract_test.go | Update |
services/auth/internal/token/generator.go | Add |
services/auth/internal/repository/tokens.go | Extend |
services/auth/internal/service/token_service.go | Add |
services/auth/internal/grpc/authz.go, server.go | Add / extend |
services/auth/cmd/auth/main.go | Wire interceptor + service |
infra/testing/testutil/bootstrap.go | Add |
services/auth/token_management_integration_test.go | Add |
docs/adr/ADR-0006-auth-proto-contract.md | Amend |
Testing requirements
- Unit: PAT generation, parse round-trip, proto contract
- Integration: create → validate → revoke; cross-tenant revoke
- CI: existing
auth-validate-smokeruns all//go:build integrationauth tests
Definition of done
-
CreateTokenreturns plaintext once; not retrievable afterward -
RevokeTokencausesValidateTokento fail closed - No plaintext in structured audit logs
- Caller without
TokenCreatecannot create/list for another org -
go test ./services/auth/...and integration tag pass in CI
Risks
| Risk | Mitigation |
|---|---|
| Bootstrap token in tests | SQL-only SeedBootstrapAdminToken; documented |
| Proto breaking change | Contract tests + buf breaking in CI |
Edit on GitHub
Last updated on