Phase 1 Step 3: Authentication Services & Security Infrastructure #92
Labels
No labels
Epic 5
MCP
P1
PR-0
PR-1
api
api-layer
architecture
area:backend
area:frontend
arrow
authentication
backend
bug
chat
client
clipboard
common-module
compose
cross-cutting
cross-cutting-requirement
data-layer
data-models
database
desktop-client
documentation
duplicate
enhancement
epic
epic-1
epic-2
epic-3
epic-4
epic-5
epic-6
epic-7
epic-llm-config
error-handling
feature
frontend
good first issue
help wanted
implementation
infrastructure
installer
invalid
kotlin
ktor
llm
medium-priority
message
multiplatform
needs-review
needs-triage
packaging
performance
phase-1
phase-2
phase-3
phase-4
phase-5
phase3
phase:3
priority: high
question
refactor
refactoring
resource-sharing
security
server
server-module
services
session
session-management
settings
setup
shutdown
state
storage
streaming
sub-issue
tests
tooling
type:task
ui
ui/ux
user-accounts
user-management
ux
viewmodel
websocket
windows
windows-integration
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Torvian.eu/chatbot#92
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
This issue covers implementing the authentication services and security infrastructure for user accounts in the chatbot application. This builds on the database foundation from Steps 1-2 and creates the business logic layer for user authentication, session management, and access control.
Phase 1 - Foundation: Authentication & Private User Space
Goal: Establish the core user system, allowing users to register, log in, and see only their own private chat sessions and groups.
Step 3: Authentication Services & Security
Tasks
AuthenticationServicefor user registration and loginSessionServicefor session lifecycle managementPasswordServicefor secure password handlingOwnershipServicefor resource ownership verificationService Requirements
AuthenticationService
registerUser(username, password, email): Either<AuthError, User>authenticateUser(username, password): Either<AuthError, UserSession>validateSession(sessionId): Either<AuthError, User>refreshSession(sessionId): Either<AuthError, UserSession>logout(sessionId): Either<AuthError, Unit>getUserProfile(userId): Either<AuthError, User>SessionService
createSession(userId, duration): Either<SessionError, UserSession>getActiveSession(sessionId): Either<SessionError, UserSession>extendSession(sessionId, duration): Either<SessionError, UserSession>terminateSession(sessionId): Either<SessionError, Unit>terminateAllUserSessions(userId): Either<SessionError, Unit>cleanupExpiredSessions(): Either<SessionError, Int>PasswordService
hashPassword(password): StringverifyPassword(password, hash): BooleangenerateSecurePassword(): StringvalidatePasswordStrength(password): Either<ValidationError, Unit>OwnershipService
verifyChatSessionOwnership(sessionId, userId): Either<OwnershipError, Unit>verifyChatGroupOwnership(groupId, userId): Either<OwnershipError, Unit>getUserChatSessions(userId): Either<OwnershipError, List<ChatSession>>getUserChatGroups(userId): Either<OwnershipError, List<ChatGroup>>assignOwnership(resourceType, resourceId, userId): Either<OwnershipError, Unit>Security Infrastructure
Error Types (Using Arrow)
Security Utilities
SessionToken- Type-safe session token wrapperPasswordHash- Type-safe password hash wrapperSecurityConfig- Configuration for session duration, password requirementsTimestampUtils- Utilities for session expiration handlingAuthentication Middleware
Technical Requirements
Password Security
Session Management
Error Handling
Eithertype for all service methodsIntegration Points
File Locations
server/src/main/kotlin/eu/torvian/chatbot/server/services/server/src/main/kotlin/eu/torvian/chatbot/server/services/impl/server/src/main/kotlin/eu/torvian/chatbot/server/security/server/src/main/kotlin/eu/torvian/chatbot/server/errors/server/src/main/kotlin/eu/torvian/chatbot/server/di/Implementation Details
Dependencies to Add
Session Storage Strategy
UserSessionDaoUser Registration Flow
Authentication Flow
Integration with Existing Code
Acceptance Criteria
Dependencies
Security Considerations
Notes
Related
docs/plans/user accounts/User Accounts feature.md