Commit Graph

25 Commits

Author SHA1 Message Date
msksbr 8f6d8eddc9 feat(admin-books): implement book CRUD management endpoints
- Add book with name, author, and stock validation
- Update existing book information
- Delete book by ID
- Adjust book inventory stock
- Rename AdminDashBoardService to DashBoardService
- Remove hardcoded user seed data from SQL schema
2026-05-23 00:16:03 +08:00
msksbr 383c17512a @add(/api/books/getone)
- add new api get a book's info by id
2026-05-22 20:46:47 +08:00
msksbr e1121e9cd7 style(auth): reorganize imports and reformat controller comments 2026-05-22 18:32:20 +08:00
msksbr bfaa5a0dd9 feat(books): add book search service and improve error responses
- Add BookService interface and MyBatis-based implementation with fuzzy search
  by title or author
- Add forbidden (403) response helper to Result template
- Upgrade auth failure log from info to warn level
- Reorganize BookController imports and restructure class
2026-05-22 17:44:31 +08:00
msksbr 3e7145c091 refactor(auth): replace JwtAuthInterceptor with non-blocking filter
Remove the interceptor-based JWT auth and its WebConfig registration.
Introduce JwtPopulateFilter that silently extracts JWT claims into
request attributes without blocking unauthenticated requests. Update
DashBoardController to accept nullable username and RequireRoleAspect
to handle missing credentials with proper error messages.
2026-05-22 13:31:48 +08:00
msksbr 0ccc21288b feat(auth): implement role hierarchy and allow guest book browsing
- Add role inheritance where admin automatically has user permissions
- Update RequireRoleAspect to validate role hierarchy instead of exact match
- Expose /api/dashboard/get-all-books to unauthenticated guests
- Rename AdminDashBoardController to DashBoardController
- Enhance KDoc with role hierarchy rules and access control behavior

Closes: #126
2026-05-22 12:50:53 +08:00
msksbr 79510b3267 feat(admin): add admin dashboard service and role-based access control
- rename DashBoardController to AdminDashBoardController
- add AdminDashBoardService interface with getAllBooks and getAllBorrowRecords
- add GlobalExceptionHandler for unified Result error responses
- add RequireRole annotation and RequireRoleAspect for role-based auth
- fix BorrowRecord entity table name from book_record to borrow_record
- add Result.forbidden() factory method returning 403 responses
2026-05-22 11:48:56 +08:00
msksbr d809cf00ab refactor(auth): remove unused ObjectMapper from JwtAuthInterceptor
- Drop ObjectMapper dependency that was no longer needed
- Simplify KDoc to remove redundant format details
- Reorder imports alphabetically
2026-05-21 19:08:52 +08:00
msksbr ca7788899a docs(core): enhance KDoc documentation across controllers, services, and entities
Add comprehensive API documentation to controller classes with planned
endpoint lists and path prefixes. Document security measures in auth
service implementation. Add field-level comments to Book entity.
2026-05-21 19:03:54 +08:00
msksbr 20660b91dc docs(core): add KDoc documentation to controllers, services, and entities
Add descriptive KDoc comments to all REST controllers, service interfaces,
entity classes, and mappers to improve code readability and maintainability.
Include annotations for controller-level API documentation.
2026-05-21 18:47:23 +08:00
msksbr 5bb836eafc feat(auth): implement JWT authentication interceptor
- Add JwtAuthInterceptor to validate JWT tokens on protected endpoints
- Register interceptor paths via WebConfig for /api/** routes
- Fix Result return type to support nullable values across auth flows
2026-05-21 18:33:11 +08:00
msksbr aaca30d3c5 fix(auth): harden login against timing-based user enumeration
- Use constant-time comparison when user is not found to prevent
  user enumeration via response timing
- Remove debug logging that could expose sensitive data
- Add AspectJ weaver dependency for AOP support
2026-05-21 17:53:48 +08:00
msksbr 00e2ea0700 fix(auth): harden login against timing-based user enumeration
- Use constant-time comparison when user is not found to prevent
  user enumeration via response timing
- Remove debug logging that could expose sensitive data
- Add AspectJ weaver dependency for AOP support
2026-05-21 17:53:26 +08:00
msksbr 93fc46c6fe fix(mapper): correct BorrowRecordMapper entity type and add unauthorized helper
- Fix import and generic type from Book to BorrowRecord in mapper
- Add unauthorized helper returning 401 status to Result template
2026-05-21 17:37:05 +08:00
msksbr 193fed29b2 fix(build): use bootJar task for production packaging
- Use bootJar instead of processResources for excluding dev configuration
- Set default time-zone to GMT for JSON serialization
2026-05-21 14:30:52 +08:00
msksbr 44b8326e96 feat(auth): implement JWT authentication
- Add JwtUtils for token generation and validation using jjwt
- Refactor AuthService.login to return User instead of Boolean
- Add jjwt dependencies and integrate JWT into login flow
- Externalize JWT secret, expiration, and log level as configurable env vars with defaults
2026-05-21 14:04:00 +08:00
msksbr 3937224341 fix(auth): harden password verification against timing attacks
- Run dummy hash when user is not found to prevent timing-based enumeration
- Extract and log real client IP on login requests
- Remove unused test files
- Reorder application config for clarity
2026-05-21 02:39:06 +08:00
msksbr 2cf3806298 feat(auth): implement login logic with database and password verification
- Replace stub with MyBatis-Plus user query and password matching
- Integrate kotlin-logging for structured logging across services
- Add custom Log utility replacing direct SLF4J usage
- Add kotlin-logging dependency to build configuration
2026-05-20 22:30:58 +08:00
msksbr 402e9e04cd refactor(api): restructure auth endpoints with DTO validation and unified response
- Add Result<T> generic response template for standardized API output
- Introduce UserLoginDTO with validation annotations for login requests
- Migrate AuthController to use DTO binding and return Result responses
- Update AuthService interface to accept UserLoginDTO and return Boolean
- Add Jackson configuration (snake_case, non-null, date format)
- Include jackson-module-kotlin and spring-boot-starter-validation deps
2026-05-20 17:29:04 +08:00
msksbr 1be634aeb1 feat(runner): add user02 initialization and rename init methods
- Add initialization flow for the user02 common account
- Rename insertAdminUser to insertAdmin for consistency
- Rename insertCommonUser to insertUser01 to align with naming
2026-05-20 16:37:21 +08:00
msksbr 47ce7596ea feat(runner): add user02 initialization and rename init methods
- Add initialization flow for the user02 common account
- Rename insertAdminUser to insertAdmin for consistency
- Rename insertCommonUser to insertUser01 to align with naming
2026-05-20 16:36:47 +08:00
msksbr 9511b8daad refactor(auth): make admin user initialization idempotent
- Check if admin user already exists before inserting
- Improve log messages with descriptive output
- Move @Transactional annotation to run method
- Fix minor formatting inconsistency
2026-05-20 13:25:04 +08:00
msksbr 52298e7fff feat(auth): add password encoding and default user initialization
- Register Argon2PasswordEncoder as a Spring bean
- Implement InitUserRunner to seed default users on startup
- Add spring-security-crypto and bouncycastle dependencies
- Include database schema initialization script
2026-05-20 12:43:05 +08:00
msksbr a041103a92 feat(api): add controller layer and auth service stubs
- Add AdminBookController, AdminBorrowController, BookController,
  BorrowController, and DashBoardController stubs
- Implement AuthController with login endpoint
- Add AuthService interface and AuthServiceImpl stub
2026-05-13 17:22:51 +08:00
msksbr 3a86d29e5c 实现了数据层的功能 2026-05-13 03:11:56 +08:00