Skip to content

feat: JWT authentication with file-based user store and RBAC - #13

Merged
razkevich merged 2 commits into
mainfrom
007-authentication
Apr 9, 2026
Merged

razkevich merged 2 commits into
mainfrom
007-authentication

Conversation

@razkevich

Copy link
Copy Markdown
Owner

Summary

  • JWT auth system with UserStore interface + FileBasedUserStore (data/users.json)
  • JwtService: HMAC-SHA256 tokens (1hr access, 7-day refresh)
  • AuthController: register, login, refresh, me, list/delete users
  • JwtAuthFilter: enforces auth on /services/* and /api/* with SF-compatible 401 errors
  • First-run mode: auth bypassed until first user registered
  • OAuth2 token endpoint upgraded to accept real credentials via grant_type=password
  • RBAC: ADMIN (all) / USER (data/metadata only)
  • New deps: jjwt 0.12.6, spring-security-crypto

Test plan

  • 114 tests pass (101 existing + 13 new auth tests)
  • Existing tests unaffected (InMemoryUserStore + first-run bypass)
  • Register → login → access protected endpoint flow tested
  • 401 on missing/invalid token tested
  • 403 on USER role accessing admin endpoints tested
  • Manual: sf org login against running instance

🤖 Generated with Claude Code

arazkevichprodly and others added 2 commits April 9, 2026 14:01
JWT-based auth with file-based user store, RBAC, sf CLI compatibility.
New deps: JJWT (JWT tokens), spring-security-crypto (BCrypt).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Auth domain (auth/):
- UserStore interface + FileBasedUserStore (data/users.json) + InMemoryUserStore (tests)
- JwtService: HMAC-SHA256, 1hr access tokens, 7-day refresh tokens
- AuthController: register, login, refresh, me, list users, delete user
- JwtAuthFilter: enforces JWT on /services/* and /api/*, SF-compatible 401 errors
- First-run mode: auth bypassed until first user registered

OAuth2 compatibility:
- POST /services/oauth2/token accepts grant_type=password with real credentials
- Returns real JWT as access_token in SF-compatible response

RBAC: ADMIN (all ops) / USER (data/metadata only, no reset/user management)

New deps: jjwt 0.12.6 (JWT), spring-security-crypto (BCrypt)
114 tests pass (101 existing + 13 new auth tests)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@razkevich
razkevich merged commit d9bd9af into main Apr 9, 2026
1 check passed
@razkevich
razkevich deleted the 007-authentication branch April 9, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants