MBA-715: Implement session management and NIST 800-53 IA-11 compliant re-authentication #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
MBA-715: Implement session management with NIST 800-53 IA-11 compliance
Summary
This PR implements standalone session management classes for the USPTO Patent Public Data project, creating the foundation for session lifecycle management that can integrate with future web frameworks (Part 1.1) and authentication systems (Part 1.2).
The implementation adds 20+ Java classes organized into four packages under
gov.uspto.session.*:Session Model & Management: Core
Sessionentity with NIST IA-11 compliance fields,SessionManagerorchestrator,SessionStoreinterface withInMemorySessionStoreimplementation,SessionFactory, andSessionValidator.Re-authentication:
ReauthenticationPolicyfor configurable policies,ReauthenticationTriggerfor event handling,PrivilegeChangeDetector(placeholder for Part 1.2), andSessionTimeoutManagerfor timeout-based re-auth.Security:
SessionIdGeneratorusing SecureRandom for cryptographically secure IDs,SessionEncryptionwith AES/GCM for sensitive data,SessionHijackingPreventionwith IP/User-Agent binding, andSessionTokenfor token representation.Lifecycle:
SessionCreationService,SessionTerminationService,SessionRenewalService, andConcurrentSessionManagerfor managing concurrent sessions per user.Added BouncyCastle 1.70 dependency for cryptographic operations.
Review & Testing Checklist for Human
SessionEncryption.javaAES/GCM implementation - check IV generation (12 bytes), tag length (128 bits), key handling, and that the encrypt/decrypt cycle is secureSessionIdGenerator.java- verify SecureRandom usage and that theisValidSessionIdFormatmethod correctly handles prefixed IDs with Base64 URL encoding (which uses_characters)SessionHijackingPrevention.java- the default uses /24 subnet comparison which may be too permissive or restrictive depending on use caseInMemorySessionStoreandConcurrentSessionManagerhandle concurrent access correctlyRecommended test plan: Run
mvn test -pl Common -Dtest="gov.uspto.session.**"to execute all 73 session management tests. Review test coverage for edge cases in encryption and session validation.Notes
PrivilegeChangeDetectorcontains placeholder methods that will need implementation when Part 1.2 is availableList.of()withCollections.singletonList()andOptional.isEmpty()with!Optional.isPresent()Link to Devin run: https://app.devin.ai/sessions/956471a358924eb59362bd288558e7fb
Requested by: Jake Cosme (jake@cognition.ai) / @jakexcosme