feat(auth): implement JWT-based authentication with admin access controls

This commit is contained in:
Juergen Kunz
2025-06-08 07:19:31 +00:00
parent 61778bdba8
commit 5faca8c1b6
10 changed files with 617 additions and 92 deletions

View File

@ -229,11 +229,13 @@ Create modular components in `ts_web/elements/components/`:
### Phase 6: Optional Enhancements
#### 6.1 Authentication (if required)
- [ ] Simple token-based authentication
- [ ] Login component
- [ ] Protected route handling
- [ ] Session management
#### 6.1 Authentication ✓ (Implemented)
- [x] JWT-based authentication using `@push.rocks/smartjwt`
- [x] Guards for identity validation and admin access
- [x] Login/logout endpoints following cloudly pattern
- [ ] Login component (frontend)
- [ ] Protected route handling (frontend)
- [ ] Session persistence (frontend)
#### 6.2 Real-time Updates (future)
- [ ] WebSocket integration for live stats
@ -304,6 +306,13 @@ Create modular components in `ts_web/elements/components/`:
- Implemented mock data responses for all endpoints
- Fixed all TypeScript compilation errors
- VirtualStream used for log streaming with Uint8Array encoding
- **JWT Authentication** - Following cloudly pattern:
- Added `@push.rocks/smartjwt` and `@push.rocks/smartguard` dependencies
- Updated IIdentity interface to match cloudly structure
- Implemented JWT-based authentication with RSA keypairs
- Created validIdentityGuard and adminIdentityGuard
- Added guard helpers for protecting endpoints
- Full test coverage for JWT authentication flows
### Next Steps
- Phase 3: Frontend State Management - Set up Smartstate