Commit Graph
131 Commits
Author SHA1 Message Date
andrey 64a9fc3dae more gtests and fix piauth 2026-09-24 11:49:36 +03:00
andrey 9e663a7501 test: add HTTPS/TLS coverage for HTTP server with PIHTTPClient 2026-09-23 13:40:55 +03:00
andrey 6bf50344fd fix: harden PIHTTPServerSessionAuth session table
- cleanupExpired() drops sessions expired by tokenTtl or sessionIdleTimeout and is
  called opportunistically on issuing a token, bounding the session table; it is
  protected and self-locking so subclasses can run it periodically
- issueToken() refuses a token already used by an active session instead of
  silently merging two sessions (login replies 500 on a generator collision)
- document that the token generator must be collision-resistant
- tests: SessionCleanupOnLogin, ManualCleanup, TokenCollisionRejected
2026-09-23 08:49:10 +03:00
andrey e1a24a98f7 fix: accept case-insensitive Basic scheme and guard HTTP test target
- parse the Basic auth-scheme case-insensitively (RFC 7235), matching Bearer
- register the http_server test only when pip_http_server and pip_http_client
  targets exist, so TESTS=ON without the HTTP modules does not fail to link
- add a Basic_LowercaseScheme test
2026-09-23 08:49:04 +03:00
andrey 994cf64838 feat: add optional sliding idle timeout to PIHTTPServerSessionAuth
The idle timeout is opt-in: when set with setSessionIdleTimeout(), a session
expires after that period without a successful request and every successful
request extends it. When unset (the default), sessions are not touched and keep
the previous behavior: the absolute tokenTtl applied to created, or living until
logout. Both deadlines can be combined and the earlier one wins.

- SessionRec: add last_used, drop the unused refresh_token field
- checkToken(): update last_used only while the idle timeout is enabled
- tests: IdleTimeout, IdleActivityExtendsSession, IdleDisabledKeepsSession,
  HasSessionIdleTimeout
2026-09-23 00:10:07 +03:00
andrey 2f63a49c69 refactor: make PIHTTPServerSessionAuth own sessions only, delegate credentials
The server no longer stores user accounts. PIHTTPServerMultiUser is renamed to
PIHTTPServerSessionAuth and keeps only the in-memory session table: credential
verification is delegated to the pure virtual checkCredentials(), implemented by
a client subclass that owns the user storage.

- remove UserRec, addUser/removeUser/userExists/userCount and the password
  check callback; add protected revokeToken()/revokeUserTokens() helpers
- add configurable login/logout route paths (default /api/login, /api/logout)
- call checkCredentials() without holding the internal lock and report 500 when
  the token generator yields no data
- rewrite tests around a client subclass with its own user table
2026-09-22 23:33:25 +03:00
andrey 1adb8b528e Merge branch 'master' into http_auth 2026-09-06 13:54:25 +03:00
andrey 9b459330df fixes 2026-09-06 13:52:47 +03:00
andrey 1025b978aa Add HTTP Bearer auth server class with token validator 2026-09-05 23:01:14 +03:00
andrey 6327720e73 Add multi-user Basic auth support via AuthInfo 2026-09-05 22:51:50 +03:00
andrey 4e1ab26124 Add HTTP Basic Auth and protected server modules
- PIHTTPServerBasicAuth: parse Authorization: Basic header, validate credentials via callback
- PIHTTPServerProtected: wrap any handler with auth check (basic or custom token)
- Integration tests for both modules (12 test cases)
2026-09-05 21:59:42 +03:00
andrey 5bde1603cd test: add PIStateMachine test suite (states, transitions, guards, final/parallel states, timeouts, nested posts) 2026-08-31 21:47:29 +03:00
andrey 331ef49991 refactor: simplify redundant PIP_HAS_* preprocessor guards
- drop INTROSPECTION conjunctions (CMake dep table already forces THREADS+SOCKET)
- remove whole-file guards in client_server/process tests (CMake only compiles them when flags are ON)
- normalize single-flag '#if defined(PIP_HAS_X)' to '#ifdef PIP_HAS_X'
2026-08-25 16:57:20 +03:00
andrey 69b22bf95a feat: complete PIP_HAS_* feature guards in code and auto-generate flag summary
Guard PIConnection, thread primitives, PICodeParser and other feature
code behind PIP_HAS_THREADS/PIP_HAS_FILESYSTEM. In CMake generate the
feature flags summary from the single PIP_HAS_FLAGS list (used by the
add_definitions loop as well), default ICU to OFF and make introspection
also require PIP_HAS_SOCKET. Build system/thread test suites only when
the corresponding feature flags are enabled.
2026-08-25 11:14:25 +03:00
andrey f6075307b6 style: run clang-format over all files 2026-08-22 15:52:58 +03:00
andrey 5fe03eaf96 fix ctest 2026-08-11 14:41:25 +03:00
andrey 449b210d4e add test for pisharedmemory 2026-08-06 17:01:30 +03:00
andrey edb7189013 disable gmock build and remove obsolete tests 2026-03-21 13:31:29 +03:00
andrey a1be5be5a1 increase timeout and remove sleep 2026-03-18 15:01:17 +03:00
andrey 99c99c39c2 separate cmake opts for tests 2026-03-18 13:39:01 +03:00
peri4 79fa549201 fix matrix test 2026-03-18 11:46:08 +03:00
peri4 35140ee002 Merge pull request 'some fixes' (#198) from some_fixes into master
Reviewed-on: #198
2026-03-18 11:08:48 +03:00
andrey c02b627d47 some fixes
PIEthernet::listen
PIClientServer::Server::~Server
PISystemTime const sleep
ClientServer tests fast and stable
2026-03-17 20:14:22 +03:00
andrey 9dc1af921c more simplify Pointer 2026-03-17 19:18:44 +03:00
andrey 449978bda0 revert main and more tests 2026-03-17 19:07:01 +03:00
andrey fe01c353e6 simplify tests 2026-03-17 18:56:20 +03:00
andrey ac877f1024 fixes 2026-03-17 18:13:23 +03:00
andrey 8ccc05ee78 simplify piprotectedvariable 2026-03-17 17:33:27 +03:00
andrey 9588b48105 PIVector2D - add funcs, optimize, tests, fixes, doxygen (#194)
Reviewed-on: #194
Co-authored-by: andrey.bychkov <andrey@signalmodelling.ru>
Co-committed-by: andrey.bychkov <andrey@signalmodelling.ru>
2026-02-27 23:58:44 +03:00
andrey 7195734765 add more tests 2026-02-17 21:53:18 +03:00
andrey 8ecec6b914 add more funcs 2026-02-17 21:40:36 +03:00
andrey 9029bcf099 Vibecoding PIVector2D - add funcs and doc
Добавь в файл pivector2d.h комментарии для Doxygen ко всем классам и
всем функциям.
Комментарии должны быть в таком же стиле как в файле pivector.h.

Проанализируй функциональность классов pivector2d в файле pivector2d.h и
класс pivector в файле pivector.h и добавь недостающую функциональность
в pivector2d по аналогии с pivector.
2026-02-17 21:04:40 +03:00
andrey 0ac7ea3096 fix linux exit finished 2025-08-13 22:12:14 +03:00
peri4 d6a0ae6106 PIProcess windows works 2025-08-13 21:36:13 +03:00
andrey 3625afa783 fix tests 2025-08-13 19:50:47 +03:00
andrey 154cbd0160 read and write pipes 2025-08-13 19:18:02 +03:00
andrey da30ae558f add process tests 2025-08-13 14:09:18 +03:00
andrey bf63365370 fix some tests 2025-08-13 11:22:56 +03:00
andrey 64e142b8c6 fix warning tmpnam 2025-08-13 11:17:31 +03:00
peri4 d3d7235338 enable complex type for PIMathVectorT and PIMathMatrixT
TODO: add precision to invert and test vector
2024-10-16 22:10:28 +03:00
peri4 3641e636d2 new PIClientServer::ClientBase::stopAndWait() method for blocking stop read.
PIClientServer::ClientBase::close() now non-blocking
2024-09-21 19:56:39 +03:00
andrey.bychkov b99c51181d fix test 2024-09-17 12:31:03 +03:00
andrey.bychkov bc6b584480 fix waitLoop 2024-09-17 11:28:34 +03:00
peri4 eb97de1413 close 2024-09-17 11:21:23 +03:00
peri4 97f1c25ff8 close 2024-09-17 11:15:50 +03:00
andrey.bychkov 3255199b3f Unit tests for PIClientServer 2024-09-16 19:54:44 +03:00
andrey.bychkov 96625bd93d minor clean 2024-09-16 10:11:31 +03:00
andrey 299a009d61 fix tests 2023-07-12 19:37:59 +03:00
andrey 8ad2503c5a pichar and pistring explicit test 2023-07-06 18:37:42 +03:00
peri4 0f19719a98 fix CMake policy check 2023-04-23 23:15:55 +03:00