From 8419c77263af65c92b8b2ad5caf20dbb2ba18e4c Mon Sep 17 00:00:00 2001 From: Dennis Nemec Date: Thu, 5 Feb 2026 10:46:30 +0100 Subject: [PATCH] daily commit --- .env | 4 + .idea/.gitignore | 10 + .idea/editor.xml | 345 ++ .idea/gas-delivery-backend.iml | 11 + .idea/misc.xml | 46 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + Cargo.lock | 2954 +++++++++++++++++ Cargo.toml | 21 + Dockerfile | 48 + README.md | 4 +- config.toml | 20 + config.toml.example | 20 + ...ackend_2026-02-03T12-43-33.919547+0100.log | 17 + ...ackend_2026-02-03T12-45-54.710930+0100.log | 14 + ...ackend_2026-02-03T12-46-53.579098+0100.log | 15 + ...ackend_2026-02-03T12-47-20.226433+0100.log | 14 + ...ackend_2026-02-03T12-47-53.258106+0100.log | 23 + ...ackend_2026-02-03T13-08-35.401063+0100.log | 13 + ...ackend_2026-02-03T13-10-33.652283+0100.log | 25 + ...ackend_2026-02-04T13-17-23.075534+0100.log | 17 + ...ackend_2026-02-04T13-40-32.031715+0100.log | 20 + ...ackend_2026-02-04T13-44-41.844934+0100.log | 42 + ...ackend_2026-02-04T14-08-37.947867+0100.log | 102 + ...ackend_2026-02-04T15-41-23.960899+0100.log | 48 + ...ackend_2026-02-04T16-40-54.682126+0100.log | 89 + docker-compose.yaml | 77 + requests/get_cars_by_supplier.http | 2 + requests/get_tour_by_car.http | 2 + requests/http-client.private.env.json | 5 + requests/userinfo.http | 4 + src/api.rs | 16 + src/api/supplier.rs | 27 + src/api/tour.rs | 29 + src/auth.rs | 425 +++ src/config.rs | 97 + src/dto.rs | 331 ++ src/gsd.rs | 2 + src/gsd/dto.rs | 27 + src/gsd/service.rs | 134 + src/main.rs | 84 + src/middleware.rs | 168 + src/model.rs | 13 + src/repository.rs | 51 + src/response.rs | 20 + src/util.rs | 47 + 46 files changed, 5494 insertions(+), 3 deletions(-) create mode 100644 .env create mode 100644 .idea/.gitignore create mode 100644 .idea/editor.xml create mode 100644 .idea/gas-delivery-backend.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 Dockerfile create mode 100644 config.toml create mode 100644 config.toml.example create mode 100644 delivery_backend_2026-02-03T12-43-33.919547+0100.log create mode 100644 delivery_backend_2026-02-03T12-45-54.710930+0100.log create mode 100644 delivery_backend_2026-02-03T12-46-53.579098+0100.log create mode 100644 delivery_backend_2026-02-03T12-47-20.226433+0100.log create mode 100644 delivery_backend_2026-02-03T12-47-53.258106+0100.log create mode 100644 delivery_backend_2026-02-03T13-08-35.401063+0100.log create mode 100644 delivery_backend_2026-02-03T13-10-33.652283+0100.log create mode 100644 delivery_backend_2026-02-04T13-17-23.075534+0100.log create mode 100644 delivery_backend_2026-02-04T13-40-32.031715+0100.log create mode 100644 delivery_backend_2026-02-04T13-44-41.844934+0100.log create mode 100644 delivery_backend_2026-02-04T14-08-37.947867+0100.log create mode 100644 delivery_backend_2026-02-04T15-41-23.960899+0100.log create mode 100644 delivery_backend_2026-02-04T16-40-54.682126+0100.log create mode 100644 docker-compose.yaml create mode 100644 requests/get_cars_by_supplier.http create mode 100644 requests/get_tour_by_car.http create mode 100644 requests/http-client.private.env.json create mode 100644 requests/userinfo.http create mode 100644 src/api.rs create mode 100644 src/api/supplier.rs create mode 100644 src/api/tour.rs create mode 100644 src/auth.rs create mode 100644 src/config.rs create mode 100644 src/dto.rs create mode 100644 src/gsd.rs create mode 100644 src/gsd/dto.rs create mode 100644 src/gsd/service.rs create mode 100644 src/main.rs create mode 100644 src/middleware.rs create mode 100644 src/model.rs create mode 100644 src/repository.rs create mode 100644 src/response.rs create mode 100644 src/util.rs diff --git a/.env b/.env new file mode 100644 index 0000000..67fec7e --- /dev/null +++ b/.env @@ -0,0 +1,4 @@ +POSTGRES_USER="admin" +POSTGRES_PASSWORD="admin" +KEYCLOAK_ADMIN_PASSWORD="admin" +KC_HOSTNAME="localhost" \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..ab1f416 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Ignored default folder with query files +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/editor.xml b/.idea/editor.xml new file mode 100644 index 0000000..8d0e15e --- /dev/null +++ b/.idea/editor.xml @@ -0,0 +1,345 @@ + + + + + \ No newline at end of file diff --git a/.idea/gas-delivery-backend.iml b/.idea/gas-delivery-backend.iml new file mode 100644 index 0000000..c254557 --- /dev/null +++ b/.idea/gas-delivery-backend.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..172855e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,46 @@ + + + + + + + + Async code and promisesJavaScript and TypeScript + + + C/C++ + + + JavaScript and TypeScript + + + Pandas + + + Potential Code Quality IssuesC/C++ + + + Python + + + ReactJavaScript and TypeScript + + + RegExp + + + TypeScriptJavaScript and TypeScript + + + XPath + + + + + User defined + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..d32a8c5 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..d9debd4 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2954 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "arc-swap" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" + +[[package]] +name = "atomic-time" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9622f5c6fb50377516c70f65159e70b25465409760c6bd6d4e581318bf704e83" +dependencies = [ + "once_cell", + "portable-atomic", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "axum" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18ed336352031311f4e0b4dd2ff392d4fbb370777c9d18d7fc9d7359f73871" +dependencies = [ + "axum-core", + "bytes", + "form_urlencoded", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "serde_core", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59446ce19cd142f8833f856eb31f3eb097812d1479ab224f54d72428ca21ea22" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "sync_wrapper", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-extra" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9963ff19f40c6102c76756ef0a46004c0d58957d87259fc9208ff8441c12ab96" +dependencies = [ + "axum", + "axum-core", + "bytes", + "cookie", + "futures-util", + "headers", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "serde_core", + "serde_json", + "serde_path_to_error", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-keycloak-auth" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e418f474ee6cd0ba9c4ab6158f8369e29311f92ecc79cb88194b7b47de4c4ad" +dependencies = [ + "atomic-time", + "axum", + "educe", + "futures", + "http", + "jsonwebtoken", + "nonempty", + "reqwest", + "serde", + "serde-querystring", + "serde_json", + "serde_with", + "snafu", + "time", + "tokio", + "tower", + "tracing", + "try-again", + "typed-builder", + "url", + "uuid", +] + +[[package]] +name = "backon" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "592277618714fbcecda9a02ba7a8781f319d26532a88553bbacc77ba5d2b3a8d" +dependencies = [ + "fastrand", +] + +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.0", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "2.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" + +[[package]] +name = "bytes" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" + +[[package]] +name = "cc" +version = "1.2.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1354349954c6fc9cb0deab020f27f783cf0b604e8bb754dc4658ecf0d29c35f" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chrono" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link 0.2.0", +] + +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "futures-core", + "memchr", + "pin-project-lite", + "tokio", + "tokio-util", +] + +[[package]] +name = "cookie" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" +dependencies = [ + "percent-encoding", + "time", + "version_check", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "darling" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" +dependencies = [ + "darling_core", + "quote", + "syn", +] + +[[package]] +name = "delivery-backend" +version = "0.1.0" +dependencies = [ + "axum", + "axum-extra", + "axum-keycloak-auth", + "base64", + "chrono", + "log", + "oauth2", + "redis", + "reqwest", + "serde", + "serde_json", + "simplelog", + "tokio", + "toml", + "uuid", +] + +[[package]] +name = "deranged" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a41953f86f8a05768a6cda24def994fd2f424b04ec5c719cf89989779f199071" +dependencies = [ + "powerfmt", + "serde_core", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "educe" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7bc049e1bd8cdeb31b68bbd586a9464ecf9f3944af3958a7a9d0f8b9799417" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "enum-ordinalize" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea0dcfa4e54eeb516fe454635a95753ddd39acda650ce703031c6973e315dd5" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] +name = "enum-ordinalize-derive" +version = "4.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.1", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "find-msvc-tools" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ced73b1dacfc750a6db6c0a0c3a3853c8b41997e2e2c563dc90804ae6867959" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasi 0.14.7+wasi-0.2.4", + "wasm-bindgen", +] + +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + +[[package]] +name = "h2" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap 2.11.4", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" + +[[package]] +name = "headers" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3314d5adb5d94bcdf56771f2e50dbbc80bb4bdf88967526706205ac9eff24eb" +dependencies = [ + "base64", + "bytes", + "headers-core", + "http", + "httpdate", + "mime", + "sha1", +] + +[[package]] +name = "headers-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54b4a22553d4242c49fddb9ba998a99962b5cc6f22cb5a3482bec22522403ce4" +dependencies = [ + "http", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "http" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb3aa54a13a0dfe7fbe3a59e0c76093041720fdc77b110cc0fc260fafb4dc51e" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "pin-utils", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c6995591a8f1380fcb4ba966a252a4b29188d51d2b89e3a252f5305be65aea8" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "system-configuration", + "tokio", + "tower-service", + "tracing", + "windows-registry", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" + +[[package]] +name = "icu_properties" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "potential_utf", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" + +[[package]] +name = "icu_provider" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" +dependencies = [ + "displaydoc", + "icu_locale_core", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" +dependencies = [ + "equivalent", + "hashbrown 0.16.0", + "serde", + "serde_core", +] + +[[package]] +name = "io-uring" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b" +dependencies = [ + "bitflags", + "cfg-if", + "libc", +] + +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + +[[package]] +name = "iri-string" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc5ebe9c3a1a7a5127f920a418f7585e9e758e911d0466ed004f393b0e380b2" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "js-sys" +version = "0.3.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "jsonwebtoken" +version = "9.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a87cc7a48537badeae96744432de36f4be2b4a34a05a5ef32e9dd8a1c169dde" +dependencies = [ + "base64", + "js-sys", + "pem", + "ring", + "serde", + "serde_json", + "simple_asn1", +] + +[[package]] +name = "lexical" +version = "7.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc8a009b2ff1f419ccc62706f04fe0ca6e67b37460513964a3dfdb919bb37d6" +dependencies = [ + "lexical-core", +] + +[[package]] +name = "lexical-core" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d8d125a277f807e55a77304455eb7b1cb52f2b18c143b60e766c120bd64a594" +dependencies = [ + "lexical-parse-float", + "lexical-parse-integer", + "lexical-util", + "lexical-write-float", + "lexical-write-integer", +] + +[[package]] +name = "lexical-parse-float" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52a9f232fbd6f550bc0137dcb5f99ab674071ac2d690ac69704593cb4abbea56" +dependencies = [ + "lexical-parse-integer", + "lexical-util", +] + +[[package]] +name = "lexical-parse-integer" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a7a039f8fb9c19c996cd7b2fcce303c1b2874fe1aca544edc85c4a5f8489b34" +dependencies = [ + "lexical-util", +] + +[[package]] +name = "lexical-util" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2604dd126bb14f13fb5d1bd6a66155079cb9fa655b37f875b3a742c705dbed17" + +[[package]] +name = "lexical-write-float" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50c438c87c013188d415fbabbb1dceb44249ab81664efbd31b14ae55dabb6361" +dependencies = [ + "lexical-util", + "lexical-write-integer", +] + +[[package]] +name = "lexical-write-integer" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "409851a618475d2d5796377cad353802345cba92c867d9fbcde9cf4eac4e14df" +dependencies = [ + "lexical-util", +] + +[[package]] +name = "libc" +version = "0.2.176" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" + +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[package]] +name = "litemap" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +dependencies = [ + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "windows-sys 0.59.0", +] + +[[package]] +name = "native-tls" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "nonempty" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "549e471b99ccaf2f89101bec68f4d244457d5a95a9c3d0672e9564124397741d" + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_threads" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +dependencies = [ + "libc", +] + +[[package]] +name = "oauth2" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51e219e79014df21a225b1860a479e2dcd7cbd9130f4defd4bd0e191ea31d67d" +dependencies = [ + "base64", + "chrono", + "getrandom 0.2.16", + "http", + "rand 0.8.5", + "reqwest", + "serde", + "serde_json", + "serde_path_to_error", + "sha2", + "thiserror 1.0.69", + "url", +] + +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "openssl" +version = "0.10.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "openssl-sys" +version = "0.9.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "pem" +version = "3.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38af38e8470ac9dee3ce1bae1af9c1671fffc44ddfd8bd1d0a3445bf349a8ef3" +dependencies = [ + "base64", + "serde", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "portable-atomic" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" + +[[package]] +name = "potential_utf" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.17", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" +dependencies = [ + "bytes", + "getrandom 0.3.3", + "lru-slab", + "rand 0.9.2", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.17", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.59.0", +] + +[[package]] +name = "quote" +version = "1.0.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] + +[[package]] +name = "redis" +version = "0.32.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15965fbccb975c38a08a68beca6bdb57da9081cd0859417c5975a160d968c3cb" +dependencies = [ + "arc-swap", + "backon", + "bytes", + "cfg-if", + "combine", + "futures-channel", + "futures-util", + "itoa", + "num-bigint", + "percent-encoding", + "pin-project-lite", + "ryu", + "sha1_smol", + "socket2", + "tokio", + "tokio-util", + "url", +] + +[[package]] +name = "redox_syscall" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" +dependencies = [ + "bitflags", +] + +[[package]] +name = "ref-cast" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "reqwest" +version = "0.12.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d429f34c8092b2d42c7c93cec323bb4adeb7c67698f70839adec842ec10c7ceb" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-tls", + "hyper-util", + "js-sys", + "log", + "mime", + "native-tls", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-native-tls", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.16", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustix" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.1", +] + +[[package]] +name = "rustls" +version = "0.23.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd3c25631629d034ce7cd9940adc9d45762d46de2b0f57193c4443b92c6d4d40" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e10b3f4191e8a80e6b43eebabfac91e5dcecebb27a71f04e820c47ec41d314bf" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "schannel" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" +dependencies = [ + "windows-sys 0.61.1", +] + +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde-querystring" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae1940bc2612f641456fc715125e4002cbd235d040188a1994e64b734054c2e" +dependencies = [ + "lexical", + "serde", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.145" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", + "serde_core", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" +dependencies = [ + "itoa", + "serde", + "serde_core", +] + +[[package]] +name = "serde_spanned" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5417783452c2be558477e104686f7de5dae53dba813c28435e0e70f82d9b04ee" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c522100790450cf78eeac1507263d0a350d4d5b30df0c8e1fe051a10c22b376e" +dependencies = [ + "base64", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.11.4", + "schemars 0.9.0", + "schemars 1.0.4", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327ada00f7d64abaac1e55a6911e90cf665aa051b9a561c7006c157f4633135e" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha1_smol" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d" + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +dependencies = [ + "libc", +] + +[[package]] +name = "simple_asn1" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "297f631f50729c8c99b84667867963997ec0b50f32b2a7dbcab828ef0541e8bb" +dependencies = [ + "num-bigint", + "num-traits", + "thiserror 2.0.17", + "time", +] + +[[package]] +name = "simplelog" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16257adbfaef1ee58b1363bdc0664c9b8e1e30aed86049635fb5f147d065a9c0" +dependencies = [ + "log", + "termcolor", + "time", +] + +[[package]] +name = "slab" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "snafu" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e84b3f4eacbf3a1ce05eac6763b4d629d60cbc94d632e4092c54ade71f1e1a2" +dependencies = [ + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1c97747dbf44bb1ca44a561ece23508e99cb592e862f22222dcf42f51d1e451" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "socket2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "system-configuration" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +dependencies = [ + "bitflags", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tempfile" +version = "3.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" +dependencies = [ + "fastrand", + "getrandom 0.3.3", + "once_cell", + "rustix", + "windows-sys 0.61.1", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +dependencies = [ + "thiserror-impl 2.0.17", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "time" +version = "0.3.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" +dependencies = [ + "deranged", + "itoa", + "libc", + "num-conv", + "num_threads", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" + +[[package]] +name = "time-macros" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.47.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" +dependencies = [ + "backtrace", + "bytes", + "io-uring", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "slab", + "socket2", + "tokio-macros", + "windows-sys 0.59.0", +] + +[[package]] +name = "tokio-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b9590b93e6fcc1739458317cccd391ad3955e2bde8913edf6f95f9e65a8f034" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00e5e5d9bf2475ac9d4f0d9edab68cc573dc2fd644b0dba36b0c30a92dd9eaa0" +dependencies = [ + "indexmap 2.11.4", + "serde_core", + "serde_spanned", + "toml_datetime", + "toml_parser", + "toml_writer", + "winnow", +] + +[[package]] +name = "toml_datetime" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f1085dec27c2b6632b04c80b3bb1b4300d6495d1e129693bdda7d91e72eec1" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_parser" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cf893c33be71572e0e9aa6dd15e6677937abd686b066eac3f8cd3531688a627" +dependencies = [ + "winnow", +] + +[[package]] +name = "toml_writer" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d163a63c116ce562a22cda521fcc4d79152e7aba014456fb5eb442f6d6a10109" + +[[package]] +name = "tower" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-again" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7840f01e68d609b64f3d6954d52846fa42b5dad9403eaecd00d2658d85f0cbff" +dependencies = [ + "tokio", + "tracing", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typed-builder" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fef81aec2ca29576f9f6ae8755108640d0a86dd3161b2e8bca6cfa554e98f77d" +dependencies = [ + "typed-builder-macro", +] + +[[package]] +name = "typed-builder-macro" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ecb9ecf7799210407c14a8cfdfe0173365780968dc57973ed082211958e0b18" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "unicode-ident" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "uuid" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" +dependencies = [ + "getrandom 0.3.3", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasi" +version = "0.14.7+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c" +dependencies = [ + "wasip2", +] + +[[package]] +name = "wasip2" +version = "1.0.1+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e038d41e478cc73bae0ff9b36c60cff1c98b8f38f8d7e8061e79ee63608ac5c" +dependencies = [ + "cfg-if", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9367c417a924a74cae129e6a2ae3b47fabb1f8995595ab474029da749a8be120" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8983c3ab33d6fb807cfcdad2491c4ea8cbc8ed839181c7dfd9c67c83e261b2" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.1", +] + +[[package]] +name = "windows-core" +version = "0.62.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6844ee5416b285084d3d3fffd743b925a6c9385455f64f6d4fa3031c4c2749a9" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.2.0", + "windows-result 0.4.0", + "windows-strings 0.5.0", +] + +[[package]] +name = "windows-implement" +version = "0.60.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edb307e42a74fb6de9bf3a02d9712678b22399c87e6fa869d6dfcd8c1b7754e0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0abd1ddbc6964ac14db11c7213d6532ef34bd9aa042c2e5935f59d7908b46a5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-link" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" + +[[package]] +name = "windows-registry" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b8a9ed28765efc97bbc954883f4e6796c33a06546ebafacbabee9696967499e" +dependencies = [ + "windows-link 0.1.3", + "windows-result 0.3.4", + "windows-strings 0.4.2", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-result" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7084dcc306f89883455a206237404d3eaf961e5bd7e0f312f7c91f57eb44167f" +dependencies = [ + "windows-link 0.2.0", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-strings" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7218c655a553b0bed4426cf54b20d7ba363ef543b52d515b3e48d7fd55318dda" +dependencies = [ + "windows-link 0.2.0", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f109e41dd4a3c848907eb83d5a42ea98b3769495597450cf6d153507b166f0f" +dependencies = [ + "windows-link 0.2.0", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" + +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" + +[[package]] +name = "writeable" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" + +[[package]] +name = "yoke" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zerotrie" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..e5f5b01 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "delivery-backend" +version = "0.1.0" +edition = "2024" + +[dependencies] +axum = "0.8.6" +axum-keycloak-auth = "0.8.3" +chrono = "0.4.42" +log = "0.4.28" +redis = { version = "0.32.6", features = ["connection-manager", "tokio-comp"] } +reqwest = { version = "0.12.23", features = ["json"] } +serde = { version = "1.0.228", features = ["derive"] } +serde_json = "1.0.145" +simplelog = "0.12.2" +tokio = { version = "1.47.1", features = ["full"] } +toml = "0.9.7" +oauth2 = "5.0.0" +uuid = "1.18.1" +axum-extra = { version = "0.10.3", features = ["cookie", "typed-header", "json-deserializer"] } +base64 = "0.22.1" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2e9eb25 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,48 @@ +# Build stage +FROM rust:1.90.0-slim-trixie as builder + +# Create app directory +WORKDIR /app + +# Copy manifests +COPY Cargo.toml Cargo.lock ./ + +# Copy source code +COPY src ./src + +# Install runtime dependencies (if needed, e.g., for SSL) +RUN apt-get update && \ + apt-get install -y --no-install-recommends ca-certificates libssl-dev pkg-config && \ + rm -rf /var/lib/apt/lists/* + +# Build for release +RUN cargo build --release + +# Runtime stage +FROM debian:bookworm-slim + +# Install runtime dependencies (if needed, e.g., for SSL) +RUN apt-get update && \ + apt-get install -y --no-install-recommends ca-certificates libssl-dev && \ + rm -rf /var/lib/apt/lists/* + +# Create non-root user +RUN useradd -m -u 1000 appuser + +# Set working directory +WORKDIR /app + +# Copy only the binary from builder +COPY --from=builder /app/target/release/delivery-backend /app/service + +# Change ownership to non-root user +RUN chown -R appuser:appuser /app + +# Switch to non-root user +USER appuser + +# Expose port (adjust as needed) +EXPOSE 8080 + +# Run the binary +CMD ["/app/service"] \ No newline at end of file diff --git a/README.md b/README.md index 3fe3b39..9054749 100644 --- a/README.md +++ b/README.md @@ -1,3 +1 @@ -# gas-delivery-backend - -Das Projekt dient als Testumgebung, ohne auf GSD-Software angewiesen zu sein. \ No newline at end of file +# Lieferservice Rust Backend \ No newline at end of file diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..625e0b6 --- /dev/null +++ b/config.toml @@ -0,0 +1,20 @@ +log_file_prefix = "delivery_backend" +host_ip = "127.0.0.1" +host_port = 3000 +redis_url = "redis://127.0.0.1:6379" +frontend_url = "myapp://callback" +gsd_app_key = "GSD-RestApi" +gsd_rest_url = "http://127.0.0.1:8334" +gsd_user = "" +gsd_password = "" +gsd_app_names = ["GSD-RestApi"] + +[keycloak] +realm_url = "http://127.0.0.1:8080/realms/master" +client_id = "delivery-app" +client_secret = "Re9pifaHT78PY5CjE3UaCiAxyq5oawTU" +auth_url = "http://127.0.0.1:8080/realms/master/protocol/openid-connect/auth" +token_url = "http://127.0.0.1:8080/realms/master/protocol/openid-connect/token" +redirect_url = "http://127.0.0.1:3000/callback" +realm = "master" +base_url = "http://127.0.0.1:8080" diff --git a/config.toml.example b/config.toml.example new file mode 100644 index 0000000..189ee1f --- /dev/null +++ b/config.toml.example @@ -0,0 +1,20 @@ +log_file_prefix = "delivery_backend" +host_ip = "127.0.0.1" +host_port = 3000 +redis_url = "redis://127.0.0.1:6379" +gsd_app_key = "GSD-RestApi" +frontend_url = "http://127.0.0.1:3000" +gsd_rest_url = "http://127.0.0.1:8334" +gsd_user = "GSDWebServiceTmp" +gsd_password = "admin" +gsd_app_names = ["GSD-RestApi"] + +[keycloak] +realm_url = "http://localhost:8080/realms/master" +client_id = "delivery-app" +client_secret = "" +realm = ">" +base_url = "" +auth_url = "http://localhost:8080/realms/master/protocol/openid-connect/auth" +token_url = "http://localhost:8080/realms/master/protocol/openid-connect/token" +redirect_url = "http://127.0.0.1:3000/callback" \ No newline at end of file diff --git a/delivery_backend_2026-02-03T12-43-33.919547+0100.log b/delivery_backend_2026-02-03T12-43-33.919547+0100.log new file mode 100644 index 0000000..e8cffab --- /dev/null +++ b/delivery_backend_2026-02-03T12-43-33.919547+0100.log @@ -0,0 +1,17 @@ +11:43:33 [INFO] Redirect URI: http://127.0.0.1:3000/callback +11:43:33 [INFO] Logging initialized +11:43:33 [INFO] Starting Gas Delivery Backend +11:43:33 [INFO] Initializing redis server +11:43:33 [INFO] Starting axum server +11:43:33 [INFO] perform_oidc_discovery; kc_instance_id=019c2350-a621-7891-b1e7-8cd16bb3ea5d kc_server="http://127.0.0.1:8080/" kc_realm="master" oidc_discovery_endpoint="http://127.0.0.1:8080/realms/master/.well-known/openid-configuration" +11:43:33 [INFO] layer; id=019c2350-a621-7891-b1e7-8cefbc7c05e3 +11:43:33 [INFO] Starting OIDC discovery. +11:43:33 [INFO] layer; id=019c2350-a621-7891-b1e7-8cefbc7c05e3 +11:43:33 [INFO] layer; id=019c2350-a621-7891-b1e7-8cefbc7c05e3 +11:43:33 [INFO] layer; id=019c2350-a621-7891-b1e7-8cefbc7c05e3 +11:43:33 [INFO] Listening on 127.0.0.1:3000 +11:43:33 [INFO] Received new jwk_set containing 2 keys. +11:43:36 [INFO] Access token expired for session 019c233e-192e-7e01-9f6f-2420edb77530, attempting refresh +11:43:36 [INFO] Successfully refreshed access token for session 019c233e-192e-7e01-9f6f-2420edb77530 +11:45:48 [INFO] Access token expired for session 019c233e-192e-7e01-9f6f-2420edb77530, attempting refresh +11:45:48 [INFO] Successfully refreshed access token for session 019c233e-192e-7e01-9f6f-2420edb77530 diff --git a/delivery_backend_2026-02-03T12-45-54.710930+0100.log b/delivery_backend_2026-02-03T12-45-54.710930+0100.log new file mode 100644 index 0000000..4db192a --- /dev/null +++ b/delivery_backend_2026-02-03T12-45-54.710930+0100.log @@ -0,0 +1,14 @@ +11:45:54 [INFO] Redirect URI: http://127.0.0.1:3000/callback +11:45:54 [INFO] Logging initialized +11:45:54 [INFO] Starting Gas Delivery Backend +11:45:54 [INFO] Initializing redis server +11:45:54 [INFO] Starting axum server +11:45:54 [INFO] perform_oidc_discovery; kc_instance_id=019c2352-cc18-7591-9646-c102294a1e16 kc_server="http://127.0.0.1:8080/" kc_realm="master" oidc_discovery_endpoint="http://127.0.0.1:8080/realms/master/.well-known/openid-configuration" +11:45:54 [INFO] layer; id=019c2352-cc19-7c60-9105-7ff0e0c191d3 +11:45:54 [INFO] Starting OIDC discovery. +11:45:54 [INFO] layer; id=019c2352-cc19-7c60-9105-7ff0e0c191d3 +11:45:54 [INFO] layer; id=019c2352-cc19-7c60-9105-7ff0e0c191d3 +11:45:54 [INFO] layer; id=019c2352-cc19-7c60-9105-7ff0e0c191d3 +11:45:54 [INFO] Listening on 127.0.0.1:3000 +11:45:54 [INFO] Received new jwk_set containing 2 keys. +11:46:02 [INFO] Access token still valid for session 019c233e-192e-7e01-9f6f-2420edb77530 (expires in 46 seconds) diff --git a/delivery_backend_2026-02-03T12-46-53.579098+0100.log b/delivery_backend_2026-02-03T12-46-53.579098+0100.log new file mode 100644 index 0000000..72d7874 --- /dev/null +++ b/delivery_backend_2026-02-03T12-46-53.579098+0100.log @@ -0,0 +1,15 @@ +11:46:53 [INFO] Redirect URI: http://127.0.0.1:3000/callback +11:46:53 [INFO] Logging initialized +11:46:53 [INFO] Starting Gas Delivery Backend +11:46:53 [INFO] Initializing redis server +11:46:53 [INFO] Starting axum server +11:46:53 [INFO] perform_oidc_discovery; kc_instance_id=019c2353-b20d-7311-ac2a-05e277a1e841 kc_server="http://127.0.0.1:8080/" kc_realm="master" oidc_discovery_endpoint="http://127.0.0.1:8080/realms/master/.well-known/openid-configuration" +11:46:53 [INFO] layer; id=019c2353-b20e-73b2-92d0-194d33673bd9 +11:46:53 [INFO] Starting OIDC discovery. +11:46:53 [INFO] layer; id=019c2353-b20e-73b2-92d0-194d33673bd9 +11:46:53 [INFO] layer; id=019c2353-b20e-73b2-92d0-194d33673bd9 +11:46:53 [INFO] layer; id=019c2353-b20e-73b2-92d0-194d33673bd9 +11:46:53 [INFO] Listening on 127.0.0.1:3000 +11:46:53 [INFO] Received new jwk_set containing 2 keys. +11:46:59 [INFO] Access token expired for session 019c233e-192e-7e01-9f6f-2420edb77530, attempting refresh +11:46:59 [INFO] Successfully refreshed access token for session 019c233e-192e-7e01-9f6f-2420edb77530 diff --git a/delivery_backend_2026-02-03T12-47-20.226433+0100.log b/delivery_backend_2026-02-03T12-47-20.226433+0100.log new file mode 100644 index 0000000..91269fc --- /dev/null +++ b/delivery_backend_2026-02-03T12-47-20.226433+0100.log @@ -0,0 +1,14 @@ +11:47:20 [INFO] Redirect URI: http://127.0.0.1:3000/callback +11:47:20 [INFO] Logging initialized +11:47:20 [INFO] Starting Gas Delivery Backend +11:47:20 [INFO] Initializing redis server +11:47:20 [INFO] Starting axum server +11:47:20 [INFO] perform_oidc_discovery; kc_instance_id=019c2354-1a24-77f1-9e59-1653ab679598 kc_server="http://127.0.0.1:8080/" kc_realm="master" oidc_discovery_endpoint="http://127.0.0.1:8080/realms/master/.well-known/openid-configuration" +11:47:20 [INFO] layer; id=019c2354-1a24-77f1-9e59-166e393ee02f +11:47:20 [INFO] Starting OIDC discovery. +11:47:20 [INFO] layer; id=019c2354-1a24-77f1-9e59-166e393ee02f +11:47:20 [INFO] layer; id=019c2354-1a24-77f1-9e59-166e393ee02f +11:47:20 [INFO] layer; id=019c2354-1a24-77f1-9e59-166e393ee02f +11:47:20 [INFO] Listening on 127.0.0.1:3000 +11:47:20 [INFO] Received new jwk_set containing 2 keys. +11:47:29 [INFO] Access token still valid for session 019c233e-192e-7e01-9f6f-2420edb77530 (expires in 30 seconds) diff --git a/delivery_backend_2026-02-03T12-47-53.258106+0100.log b/delivery_backend_2026-02-03T12-47-53.258106+0100.log new file mode 100644 index 0000000..c956346 --- /dev/null +++ b/delivery_backend_2026-02-03T12-47-53.258106+0100.log @@ -0,0 +1,23 @@ +11:47:53 [INFO] Redirect URI: http://127.0.0.1:3000/callback +11:47:53 [INFO] Logging initialized +11:47:53 [INFO] Starting Gas Delivery Backend +11:47:53 [INFO] Initializing redis server +11:47:53 [INFO] Starting axum server +11:47:53 [INFO] perform_oidc_discovery; kc_instance_id=019c2354-9b2b-77f0-958c-55e31e57410c kc_server="http://127.0.0.1:8080/" kc_realm="master" oidc_discovery_endpoint="http://127.0.0.1:8080/realms/master/.well-known/openid-configuration" +11:47:53 [INFO] layer; id=019c2354-9b2b-77f0-958c-55f0558b380d +11:47:53 [INFO] Starting OIDC discovery. +11:47:53 [INFO] layer; id=019c2354-9b2b-77f0-958c-55f0558b380d +11:47:53 [INFO] layer; id=019c2354-9b2b-77f0-958c-55f0558b380d +11:47:53 [INFO] layer; id=019c2354-9b2b-77f0-958c-55f0558b380d +11:47:53 [INFO] Listening on 127.0.0.1:3000 +11:47:53 [INFO] Received new jwk_set containing 2 keys. +12:03:31 [INFO] Callback called +12:03:31 [INFO] Successfully created session 019c2362-edbd-77b1-a0bd-8c29f4bdf257 for user +12:03:31 [INFO] Token scopes: EmptyExtraTokenFields +12:03:32 [INFO] Access token still valid for session 019c2362-edbd-77b1-a0bd-8c29f4bdf257 (expires in 59 seconds) +12:03:56 [INFO] Callback called +12:03:56 [INFO] Successfully created session 019c2363-4d78-74c2-96db-9e1faced3c74 for user +12:03:56 [INFO] Token scopes: EmptyExtraTokenFields +12:03:56 [INFO] Access token still valid for session 019c2363-4d78-74c2-96db-9e1faced3c74 (expires in 60 seconds) +12:05:45 [INFO] Access token expired for session 019c233e-192e-7e01-9f6f-2420edb77530, attempting refresh +12:05:45 [INFO] Successfully refreshed access token for session 019c233e-192e-7e01-9f6f-2420edb77530 diff --git a/delivery_backend_2026-02-03T13-08-35.401063+0100.log b/delivery_backend_2026-02-03T13-08-35.401063+0100.log new file mode 100644 index 0000000..9f57e55 --- /dev/null +++ b/delivery_backend_2026-02-03T13-08-35.401063+0100.log @@ -0,0 +1,13 @@ +12:08:35 [INFO] Redirect URI: http://127.0.0.1:3000/callback +12:08:35 [INFO] Logging initialized +12:08:35 [INFO] Starting Gas Delivery Backend +12:08:35 [INFO] Initializing redis server +12:08:35 [INFO] Starting axum server +12:08:35 [INFO] perform_oidc_discovery; kc_instance_id=019c2367-8f4e-7ec1-809b-abded76bf656 kc_server="http://127.0.0.1:8080/" kc_realm="master" oidc_discovery_endpoint="http://127.0.0.1:8080/realms/master/.well-known/openid-configuration" +12:08:35 [INFO] layer; id=019c2367-8f4e-7ec1-809b-abeed90ad1b9 +12:08:35 [INFO] Starting OIDC discovery. +12:08:35 [INFO] layer; id=019c2367-8f4e-7ec1-809b-abeed90ad1b9 +12:08:35 [INFO] layer; id=019c2367-8f4e-7ec1-809b-abeed90ad1b9 +12:08:35 [INFO] layer; id=019c2367-8f4e-7ec1-809b-abeed90ad1b9 +12:08:35 [INFO] Listening on 127.0.0.1:3000 +12:08:35 [INFO] Received new jwk_set containing 2 keys. diff --git a/delivery_backend_2026-02-03T13-10-33.652283+0100.log b/delivery_backend_2026-02-03T13-10-33.652283+0100.log new file mode 100644 index 0000000..1f76ca1 --- /dev/null +++ b/delivery_backend_2026-02-03T13-10-33.652283+0100.log @@ -0,0 +1,25 @@ +12:10:33 [INFO] Redirect URI: http://127.0.0.1:3000/callback +12:10:33 [INFO] Logging initialized +12:10:33 [INFO] Starting Gas Delivery Backend +12:10:33 [INFO] Initializing redis server +12:10:33 [INFO] Starting axum server +12:10:33 [INFO] perform_oidc_discovery; kc_instance_id=019c2369-5d36-74f2-a278-d98f6f997d4c kc_server="http://127.0.0.1:8080/" kc_realm="master" oidc_discovery_endpoint="http://127.0.0.1:8080/realms/master/.well-known/openid-configuration" +12:10:33 [INFO] Starting OIDC discovery. +12:10:33 [INFO] layer; id=019c2369-5d36-74f2-a278-d993e2a77fb3 +12:10:33 [INFO] layer; id=019c2369-5d36-74f2-a278-d993e2a77fb3 +12:10:33 [INFO] layer; id=019c2369-5d36-74f2-a278-d993e2a77fb3 +12:10:33 [INFO] layer; id=019c2369-5d36-74f2-a278-d993e2a77fb3 +12:10:33 [INFO] Listening on 127.0.0.1:3000 +12:10:33 [INFO] Received new jwk_set containing 2 keys. +12:10:52 [INFO] Callback called +12:10:52 [INFO] Successfully created session 019c2369-a8af-74c3-b516-6ab502c10865 for user +12:10:52 [INFO] Token scopes: EmptyExtraTokenFields +12:10:53 [INFO] Access token still valid for session 019c2369-a8af-74c3-b516-6ab502c10865 (expires in 59 seconds) +13:57:06 [INFO] Callback called +13:57:06 [INFO] Successfully created session 019c23ca-e7f5-7702-87b3-d30e6b39caea for user +13:57:06 [INFO] Token scopes: EmptyExtraTokenFields +13:57:06 [INFO] Access token still valid for session 019c23ca-e7f5-7702-87b3-d30e6b39caea (expires in 60 seconds) +14:47:54 [INFO] Callback called +14:47:54 [INFO] Successfully created session 019c23f9-6cdd-7bc1-9221-6fd100ba718b for user +14:47:54 [INFO] Token scopes: EmptyExtraTokenFields +14:47:55 [INFO] Access token still valid for session 019c23f9-6cdd-7bc1-9221-6fd100ba718b (expires in 59 seconds) diff --git a/delivery_backend_2026-02-04T13-17-23.075534+0100.log b/delivery_backend_2026-02-04T13-17-23.075534+0100.log new file mode 100644 index 0000000..7f47e51 --- /dev/null +++ b/delivery_backend_2026-02-04T13-17-23.075534+0100.log @@ -0,0 +1,17 @@ +12:17:23 [INFO] Redirect URI: http://127.0.0.1:3000/callback +12:17:23 [INFO] Logging initialized +12:17:23 [INFO] Starting Gas Delivery Backend +12:17:23 [INFO] Initializing redis server +12:17:23 [INFO] Starting axum server +12:17:23 [INFO] perform_oidc_discovery; kc_instance_id=019c2895-f887-7350-b9f6-6c8f37d12eb6 kc_server="http://127.0.0.1:8080/" kc_realm="master" oidc_discovery_endpoint="http://127.0.0.1:8080/realms/master/.well-known/openid-configuration" +12:17:23 [INFO] layer; id=019c2895-f888-7bc3-a601-00e1535f7d9d +12:17:23 [INFO] Starting OIDC discovery. +12:17:23 [INFO] layer; id=019c2895-f888-7bc3-a601-00e1535f7d9d +12:17:23 [INFO] layer; id=019c2895-f888-7bc3-a601-00e1535f7d9d +12:17:23 [INFO] layer; id=019c2895-f888-7bc3-a601-00e1535f7d9d +12:17:23 [INFO] Listening on 127.0.0.1:3000 +12:17:23 [INFO] Received new jwk_set containing 2 keys. +12:17:38 [INFO] Callback called +12:17:38 [INFO] Successfully created session 019c2896-34eb-7ed0-9b1a-59f54c9a44c9 for user +12:17:38 [INFO] Token scopes: EmptyExtraTokenFields +12:17:38 [INFO] Access token still valid for session 019c2896-34eb-7ed0-9b1a-59f54c9a44c9 (expires in 60 seconds) diff --git a/delivery_backend_2026-02-04T13-40-32.031715+0100.log b/delivery_backend_2026-02-04T13-40-32.031715+0100.log new file mode 100644 index 0000000..d9c73ee --- /dev/null +++ b/delivery_backend_2026-02-04T13-40-32.031715+0100.log @@ -0,0 +1,20 @@ +12:40:32 [INFO] Redirect URI: http://127.0.0.1:3000/callback +12:40:32 [INFO] Logging initialized +12:40:32 [INFO] Starting Gas Delivery Backend +12:40:32 [INFO] Initializing redis server +12:40:32 [INFO] Starting axum server +12:40:32 [INFO] perform_oidc_discovery; kc_instance_id=019c28ab-2a25-7051-b0b2-83f13f1f783f kc_server="http://127.0.0.1:8080/" kc_realm="master" oidc_discovery_endpoint="http://127.0.0.1:8080/realms/master/.well-known/openid-configuration" +12:40:32 [INFO] Starting OIDC discovery. +12:40:32 [INFO] layer; id=019c28ab-2a25-7051-b0b2-84014d120574 +12:40:32 [INFO] layer; id=019c28ab-2a25-7051-b0b2-84014d120574 +12:40:32 [INFO] layer; id=019c28ab-2a25-7051-b0b2-84014d120574 +12:40:32 [INFO] layer; id=019c28ab-2a25-7051-b0b2-84014d120574 +12:40:32 [INFO] layer; id=019c28ab-2a25-7051-b0b2-84014d120574 +12:40:32 [INFO] layer; id=019c28ab-2a25-7051-b0b2-84014d120574 +12:40:32 [INFO] Listening on 127.0.0.1:3000 +12:40:32 [INFO] Received new jwk_set containing 2 keys. +12:41:38 [INFO] Callback called +12:41:38 [INFO] Successfully created session 019c28ac-2f5a-75e1-b909-f862e773a5c6 for user +12:41:38 [INFO] Token scopes: EmptyExtraTokenFields +12:41:39 [INFO] Access token still valid for session 019c28ac-2f5a-75e1-b909-f862e773a5c6 (expires in 59 seconds) +12:42:33 [INFO] Access token still valid for session 019c28ac-2f5a-75e1-b909-f862e773a5c6 (expires in 5 seconds) diff --git a/delivery_backend_2026-02-04T13-44-41.844934+0100.log b/delivery_backend_2026-02-04T13-44-41.844934+0100.log new file mode 100644 index 0000000..45a14db --- /dev/null +++ b/delivery_backend_2026-02-04T13-44-41.844934+0100.log @@ -0,0 +1,42 @@ +12:44:41 [INFO] Redirect URI: http://127.0.0.1:3000/callback +12:44:41 [INFO] Logging initialized +12:44:41 [INFO] Starting Gas Delivery Backend +12:44:41 [INFO] Initializing redis server +12:44:41 [INFO] Starting axum server +12:44:41 [INFO] perform_oidc_discovery; kc_instance_id=019c28ae-f9fa-7ad0-b4b8-4c583e97ed32 kc_server="http://127.0.0.1:8080/" kc_realm="master" oidc_discovery_endpoint="http://127.0.0.1:8080/realms/master/.well-known/openid-configuration" +12:44:41 [INFO] Starting OIDC discovery. +12:44:41 [INFO] layer; id=019c28ae-f9fa-7ad0-b4b8-4c60b26bdea9 +12:44:41 [INFO] layer; id=019c28ae-f9fa-7ad0-b4b8-4c60b26bdea9 +12:44:41 [INFO] layer; id=019c28ae-f9fa-7ad0-b4b8-4c60b26bdea9 +12:44:41 [INFO] layer; id=019c28ae-f9fa-7ad0-b4b8-4c60b26bdea9 +12:44:41 [INFO] layer; id=019c28ae-f9fa-7ad0-b4b8-4c60b26bdea9 +12:44:41 [INFO] layer; id=019c28ae-f9fa-7ad0-b4b8-4c60b26bdea9 +12:44:41 [INFO] Listening on 127.0.0.1:3000 +12:44:41 [INFO] Received new jwk_set containing 2 keys. +12:44:47 [INFO] Access token expired for session 019c28ac-2f5a-75e1-b909-f862e773a5c6, attempting refresh +12:44:47 [INFO] Successfully refreshed access token for session 019c28ac-2f5a-75e1-b909-f862e773a5c6 +13:05:19 [INFO] Callback called +13:05:19 [INFO] Successfully created session 019c28c1-db02-7261-aa2e-a2f0f7485080 for user +13:05:19 [INFO] Token scopes: EmptyExtraTokenFields +13:05:19 [INFO] Access token still valid for session 019c28c1-db02-7261-aa2e-a2f0f7485080 (expires in 60 seconds) +13:06:09 [INFO] Callback called +13:06:09 [INFO] Successfully created session 019c28c2-a14b-7e13-8593-7181dc374eca for user +13:06:09 [INFO] Token scopes: EmptyExtraTokenFields +13:06:11 [INFO] Callback called +13:06:11 [INFO] Successfully created session 019c28c2-a76f-7562-a2b5-197e2d42dbce for user +13:06:11 [INFO] Token scopes: EmptyExtraTokenFields +13:06:13 [INFO] Callback called +13:06:13 [INFO] Successfully created session 019c28c2-aed9-7932-b206-a19549ec754d for user +13:06:13 [INFO] Token scopes: EmptyExtraTokenFields +13:06:23 [INFO] Callback called +13:06:23 [INFO] Successfully created session 019c28c2-d540-7271-b0aa-dc302a522d1b for user +13:06:23 [INFO] Token scopes: EmptyExtraTokenFields +13:06:23 [INFO] Access token still valid for session 019c28c2-d540-7271-b0aa-dc302a522d1b (expires in 60 seconds) +13:07:25 [INFO] Callback called +13:07:25 [INFO] Successfully created session 019c28c3-ca65-7020-afe3-3adbaf4d57f9 for user +13:07:25 [INFO] Token scopes: EmptyExtraTokenFields +13:07:26 [INFO] Access token still valid for session 019c28c3-ca65-7020-afe3-3adbaf4d57f9 (expires in 59 seconds) +13:08:11 [INFO] Callback called +13:08:11 [INFO] Successfully created session 019c28c4-7db5-7ea3-be74-f77bf07e7f09 for user +13:08:11 [INFO] Token scopes: EmptyExtraTokenFields +13:08:12 [INFO] Access token still valid for session 019c28c4-7db5-7ea3-be74-f77bf07e7f09 (expires in 59 seconds) diff --git a/delivery_backend_2026-02-04T14-08-37.947867+0100.log b/delivery_backend_2026-02-04T14-08-37.947867+0100.log new file mode 100644 index 0000000..5728531 --- /dev/null +++ b/delivery_backend_2026-02-04T14-08-37.947867+0100.log @@ -0,0 +1,102 @@ +13:08:37 [INFO] Redirect URI: http://127.0.0.1:3000/callback +13:08:37 [INFO] Logging initialized +13:08:37 [INFO] Starting Gas Delivery Backend +13:08:37 [INFO] Initializing redis server +13:08:37 [INFO] Starting axum server +13:08:37 [INFO] perform_oidc_discovery; kc_instance_id=019c28c4-e3be-7b41-8e29-eeee14d213d3 kc_server="http://127.0.0.1:8080/" kc_realm="master" oidc_discovery_endpoint="http://127.0.0.1:8080/realms/master/.well-known/openid-configuration" +13:08:37 [INFO] Starting OIDC discovery. +13:08:37 [INFO] layer; id=019c28c4-e3be-7b41-8e29-eef7556770a3 +13:08:37 [INFO] layer; id=019c28c4-e3be-7b41-8e29-eef7556770a3 +13:08:37 [INFO] layer; id=019c28c4-e3be-7b41-8e29-eef7556770a3 +13:08:37 [INFO] layer; id=019c28c4-e3be-7b41-8e29-eef7556770a3 +13:08:37 [INFO] layer; id=019c28c4-e3be-7b41-8e29-eef7556770a3 +13:08:37 [INFO] layer; id=019c28c4-e3be-7b41-8e29-eef7556770a3 +13:08:37 [INFO] Listening on 127.0.0.1:3000 +13:08:38 [INFO] Received new jwk_set containing 2 keys. +13:09:19 [INFO] Callback called +13:09:19 [INFO] Successfully created session 019c28c5-8655-74d1-9e57-2a132b1213cb for user +13:09:19 [INFO] Token scopes: EmptyExtraTokenFields +13:09:19 [INFO] Access token still valid for session 019c28c5-8655-74d1-9e57-2a132b1213cb (expires in 60 seconds) +13:09:22 [INFO] Access token still valid for session 019c28c5-8655-74d1-9e57-2a132b1213cb (expires in 57 seconds) +13:09:29 [INFO] Access token still valid for session 019c28c5-8655-74d1-9e57-2a132b1213cb (expires in 50 seconds) +13:09:43 [INFO] Access token still valid for session 019c28c5-8655-74d1-9e57-2a132b1213cb (expires in 36 seconds) +13:10:09 [INFO] Callback called +13:10:09 [INFO] Successfully created session 019c28c6-4b21-7541-b1ed-2ccc25ebe959 for user +13:10:09 [INFO] Token scopes: EmptyExtraTokenFields +13:10:10 [INFO] Access token still valid for session 019c28c6-4b21-7541-b1ed-2ccc25ebe959 (expires in 59 seconds) +13:10:16 [INFO] Access token still valid for session 019c28c6-4b21-7541-b1ed-2ccc25ebe959 (expires in 53 seconds) +13:16:18 [INFO] Access token expired for session 019c28c6-4b21-7541-b1ed-2ccc25ebe959, attempting refresh +13:16:18 [INFO] Successfully refreshed access token for session 019c28c6-4b21-7541-b1ed-2ccc25ebe959 +13:16:21 [INFO] Access token still valid for session 019c28c6-4b21-7541-b1ed-2ccc25ebe959 (expires in 57 seconds) +13:16:24 [INFO] Access token still valid for session 019c28c6-4b21-7541-b1ed-2ccc25ebe959 (expires in 54 seconds) +13:16:31 [INFO] Access token still valid for session 019c28c6-4b21-7541-b1ed-2ccc25ebe959 (expires in 47 seconds) +13:16:34 [INFO] Access token still valid for session 019c28c6-4b21-7541-b1ed-2ccc25ebe959 (expires in 44 seconds) +13:16:38 [INFO] Access token still valid for session 019c28c6-4b21-7541-b1ed-2ccc25ebe959 (expires in 40 seconds) +13:16:59 [INFO] Access token still valid for session 019c28c6-4b21-7541-b1ed-2ccc25ebe959 (expires in 19 seconds) +13:17:01 [INFO] Access token still valid for session 019c28c6-4b21-7541-b1ed-2ccc25ebe959 (expires in 17 seconds) +13:17:04 [INFO] Access token still valid for session 019c28c6-4b21-7541-b1ed-2ccc25ebe959 (expires in 14 seconds) +14:02:29 [INFO] Access token expired for session 019c28c6-4b21-7541-b1ed-2ccc25ebe959, attempting refresh +14:02:29 [ERROR] Failed to refresh access token: Token refresh request failed: ServerResponse(StandardErrorResponse { error: invalid_grant, error_description: Some("Token is not active"), error_uri: None }) +14:02:33 [WARN] Session not found in Redis: 019c28c6-4b21-7541-b1ed-2ccc25ebe959 +14:02:39 [WARN] Session not found in Redis: 019c28c6-4b21-7541-b1ed-2ccc25ebe959 +14:03:01 [WARN] Session not found in Redis: 019c28c6-4b21-7541-b1ed-2ccc25ebe959 +14:03:05 [WARN] Session not found in Redis: 019c28c6-4b21-7541-b1ed-2ccc25ebe959 +14:03:38 [INFO] Callback called +14:03:38 [INFO] Successfully created session 019c28f7-400a-7d22-8f5f-321b46c36a96 for user +14:03:38 [INFO] Token scopes: EmptyExtraTokenFields +14:03:38 [INFO] Access token still valid for session 019c28f7-400a-7d22-8f5f-321b46c36a96 (expires in 60 seconds) +14:03:43 [INFO] Access token still valid for session 019c28f7-400a-7d22-8f5f-321b46c36a96 (expires in 55 seconds) +14:03:49 [INFO] Access token still valid for session 019c28f7-400a-7d22-8f5f-321b46c36a96 (expires in 49 seconds) +14:04:02 [INFO] Access token still valid for session 019c28f7-400a-7d22-8f5f-321b46c36a96 (expires in 36 seconds) +14:04:05 [INFO] Access token still valid for session 019c28f7-400a-7d22-8f5f-321b46c36a96 (expires in 33 seconds) +14:04:23 [INFO] Access token still valid for session 019c28f7-400a-7d22-8f5f-321b46c36a96 (expires in 15 seconds) +14:04:29 [INFO] Access token still valid for session 019c28f7-400a-7d22-8f5f-321b46c36a96 (expires in 9 seconds) +14:08:16 [INFO] Access token expired for session 019c28f7-400a-7d22-8f5f-321b46c36a96, attempting refresh +14:08:16 [INFO] Successfully refreshed access token for session 019c28f7-400a-7d22-8f5f-321b46c36a96 +14:08:31 [INFO] Access token still valid for session 019c28f7-400a-7d22-8f5f-321b46c36a96 (expires in 45 seconds) +14:08:35 [INFO] Access token still valid for session 019c28f7-400a-7d22-8f5f-321b46c36a96 (expires in 41 seconds) +14:09:35 [INFO] Access token expired for session 019c28f7-400a-7d22-8f5f-321b46c36a96, attempting refresh +14:09:35 [INFO] Successfully refreshed access token for session 019c28f7-400a-7d22-8f5f-321b46c36a96 +14:19:40 [INFO] Access token expired for session 019c28f7-400a-7d22-8f5f-321b46c36a96, attempting refresh +14:19:40 [INFO] Successfully refreshed access token for session 019c28f7-400a-7d22-8f5f-321b46c36a96 +14:19:43 [INFO] Access token still valid for session 019c28f7-400a-7d22-8f5f-321b46c36a96 (expires in 57 seconds) +14:19:46 [INFO] Access token still valid for session 019c28f7-400a-7d22-8f5f-321b46c36a96 (expires in 54 seconds) +14:21:54 [INFO] Access token expired for session 019c28f7-400a-7d22-8f5f-321b46c36a96, attempting refresh +14:21:54 [INFO] Successfully refreshed access token for session 019c28f7-400a-7d22-8f5f-321b46c36a96 +14:23:04 [INFO] Callback called +14:23:04 [INFO] Successfully created session 019c2909-0a23-7910-b47d-229cb87792e1 for user +14:23:04 [INFO] Token scopes: EmptyExtraTokenFields +14:23:04 [INFO] Access token still valid for session 019c2909-0a23-7910-b47d-229cb87792e1 (expires in 60 seconds) +14:23:07 [INFO] Access token still valid for session 019c2909-0a23-7910-b47d-229cb87792e1 (expires in 57 seconds) +14:23:50 [INFO] Access token still valid for session 019c2909-0a23-7910-b47d-229cb87792e1 (expires in 14 seconds) +14:26:00 [INFO] Access token expired for session 019c2909-0a23-7910-b47d-229cb87792e1, attempting refresh +14:26:00 [INFO] Successfully refreshed access token for session 019c2909-0a23-7910-b47d-229cb87792e1 +14:26:28 [INFO] Access token still valid for session 019c2909-0a23-7910-b47d-229cb87792e1 (expires in 32 seconds) +14:26:33 [INFO] Access token still valid for session 019c2909-0a23-7910-b47d-229cb87792e1 (expires in 27 seconds) +14:27:39 [INFO] Access token expired for session 019c2909-0a23-7910-b47d-229cb87792e1, attempting refresh +14:27:39 [INFO] Successfully refreshed access token for session 019c2909-0a23-7910-b47d-229cb87792e1 +14:30:55 [INFO] Access token expired for session 019c2909-0a23-7910-b47d-229cb87792e1, attempting refresh +14:30:55 [INFO] Successfully refreshed access token for session 019c2909-0a23-7910-b47d-229cb87792e1 +14:33:12 [INFO] Access token expired for session 019c2909-0a23-7910-b47d-229cb87792e1, attempting refresh +14:33:12 [INFO] Successfully refreshed access token for session 019c2909-0a23-7910-b47d-229cb87792e1 +14:34:59 [INFO] Access token expired for session 019c2909-0a23-7910-b47d-229cb87792e1, attempting refresh +14:34:59 [INFO] Successfully refreshed access token for session 019c2909-0a23-7910-b47d-229cb87792e1 +14:35:09 [INFO] Access token still valid for session 019c2909-0a23-7910-b47d-229cb87792e1 (expires in 50 seconds) +14:36:19 [INFO] Access token expired for session 019c2909-0a23-7910-b47d-229cb87792e1, attempting refresh +14:36:19 [INFO] Successfully refreshed access token for session 019c2909-0a23-7910-b47d-229cb87792e1 +14:36:25 [INFO] Callback called +14:36:25 [INFO] Successfully created session 019c2915-43ab-77f0-8422-09f282747e59 for user +14:36:25 [INFO] Token scopes: EmptyExtraTokenFields +14:36:25 [INFO] Access token still valid for session 019c2915-43ab-77f0-8422-09f282747e59 (expires in 60 seconds) +14:36:27 [INFO] Access token still valid for session 019c2915-43ab-77f0-8422-09f282747e59 (expires in 58 seconds) +14:38:28 [INFO] Callback called +14:38:28 [INFO] Successfully created session 019c2917-2370-7f31-8a28-cec2911cc86d for user +14:38:28 [INFO] Token scopes: EmptyExtraTokenFields +14:38:28 [INFO] Access token still valid for session 019c2917-2370-7f31-8a28-cec2911cc86d (expires in 60 seconds) +14:38:30 [INFO] Access token still valid for session 019c2917-2370-7f31-8a28-cec2911cc86d (expires in 58 seconds) +14:39:35 [INFO] Callback called +14:39:35 [INFO] Successfully created session 019c2918-2b55-7002-8e53-12a8a5a0fdff for user +14:39:35 [INFO] Token scopes: EmptyExtraTokenFields +14:39:35 [INFO] Access token still valid for session 019c2918-2b55-7002-8e53-12a8a5a0fdff (expires in 60 seconds) +14:39:38 [INFO] Access token still valid for session 019c2918-2b55-7002-8e53-12a8a5a0fdff (expires in 57 seconds) +14:40:30 [INFO] Access token still valid for session 019c2918-2b55-7002-8e53-12a8a5a0fdff (expires in 5 seconds) diff --git a/delivery_backend_2026-02-04T15-41-23.960899+0100.log b/delivery_backend_2026-02-04T15-41-23.960899+0100.log new file mode 100644 index 0000000..6ac84a0 --- /dev/null +++ b/delivery_backend_2026-02-04T15-41-23.960899+0100.log @@ -0,0 +1,48 @@ +14:41:23 [INFO] Redirect URI: http://127.0.0.1:3000/callback +14:41:23 [INFO] Logging initialized +14:41:23 [INFO] Starting Gas Delivery Backend +14:41:23 [INFO] Initializing redis server +14:41:23 [INFO] Starting axum server +14:41:23 [INFO] perform_oidc_discovery; kc_instance_id=019c2919-d1fa-7543-bd68-04be3e5bb6f5 kc_server="http://127.0.0.1:8080/" kc_realm="master" oidc_discovery_endpoint="http://127.0.0.1:8080/realms/master/.well-known/openid-configuration" +14:41:23 [INFO] Starting OIDC discovery. +14:41:23 [INFO] layer; id=019c2919-d1fb-7cd1-8431-b566c09b9235 +14:41:23 [INFO] layer; id=019c2919-d1fb-7cd1-8431-b566c09b9235 +14:41:23 [INFO] layer; id=019c2919-d1fb-7cd1-8431-b566c09b9235 +14:41:23 [INFO] layer; id=019c2919-d1fb-7cd1-8431-b566c09b9235 +14:41:23 [INFO] layer; id=019c2919-d1fb-7cd1-8431-b566c09b9235 +14:41:23 [INFO] layer; id=019c2919-d1fb-7cd1-8431-b566c09b9235 +14:41:23 [INFO] Listening on 127.0.0.1:3000 +14:41:24 [INFO] Received new jwk_set containing 2 keys. +14:41:30 [INFO] Access token expired for session 019c2918-2b55-7002-8e53-12a8a5a0fdff, attempting refresh +14:41:30 [INFO] Successfully refreshed access token for session 019c2918-2b55-7002-8e53-12a8a5a0fdff +14:50:01 [INFO] Access token expired for session 019c2918-2b55-7002-8e53-12a8a5a0fdff, attempting refresh +14:50:01 [INFO] Successfully refreshed access token for session 019c2918-2b55-7002-8e53-12a8a5a0fdff +15:03:17 [INFO] Access token expired for session 019c2918-2b55-7002-8e53-12a8a5a0fdff, attempting refresh +15:03:17 [INFO] Successfully refreshed access token for session 019c2918-2b55-7002-8e53-12a8a5a0fdff +15:32:24 [INFO] Access token expired for session 019c2918-2b55-7002-8e53-12a8a5a0fdff, attempting refresh +15:32:25 [INFO] Successfully refreshed access token for session 019c2918-2b55-7002-8e53-12a8a5a0fdff +15:34:19 [INFO] Callback called +15:34:19 [INFO] Successfully created session 019c294a-4604-7e01-bc3a-aee67bb365fb for user +15:34:19 [INFO] Token scopes: EmptyExtraTokenFields +15:34:19 [INFO] Access token still valid for session 019c294a-4604-7e01-bc3a-aee67bb365fb (expires in 60 seconds) +15:36:08 [INFO] Callback called +15:36:08 [INFO] Successfully created session 019c294b-eee5-72e1-a80e-b7e03b2e5877 for user +15:36:08 [INFO] Token scopes: EmptyExtraTokenFields +15:36:08 [INFO] Access token still valid for session 019c294b-eee5-72e1-a80e-b7e03b2e5877 (expires in 60 seconds) +15:36:53 [INFO] Callback called +15:36:53 [INFO] Successfully created session 019c294c-a034-7420-9a1e-8351aa3b457c for user +15:36:53 [INFO] Token scopes: EmptyExtraTokenFields +15:36:53 [INFO] Access token still valid for session 019c294c-a034-7420-9a1e-8351aa3b457c (expires in 60 seconds) +15:37:02 [INFO] Callback called +15:37:02 [INFO] Successfully created session 019c294c-c1a7-7402-9415-f0bd5b86b032 for user +15:37:02 [INFO] Token scopes: EmptyExtraTokenFields +15:37:02 [INFO] Access token still valid for session 019c294c-c1a7-7402-9415-f0bd5b86b032 (expires in 60 seconds) +15:37:43 [INFO] Callback called +15:37:43 [INFO] Successfully created session 019c294d-6384-7c03-af9f-000ce003bff6 for user +15:37:43 [INFO] Token scopes: EmptyExtraTokenFields +15:37:43 [INFO] Access token still valid for session 019c294d-6384-7c03-af9f-000ce003bff6 (expires in 60 seconds) +15:39:07 [INFO] Callback called +15:39:07 [INFO] Successfully created session 019c294e-aa9e-70e1-b059-38e2297ca892 for user +15:39:07 [INFO] Token scopes: EmptyExtraTokenFields +15:39:07 [INFO] Access token still valid for session 019c294e-aa9e-70e1-b059-38e2297ca892 (expires in 60 seconds) +15:39:09 [INFO] Access token still valid for session 019c294e-aa9e-70e1-b059-38e2297ca892 (expires in 58 seconds) diff --git a/delivery_backend_2026-02-04T16-40-54.682126+0100.log b/delivery_backend_2026-02-04T16-40-54.682126+0100.log new file mode 100644 index 0000000..c3dfc4e --- /dev/null +++ b/delivery_backend_2026-02-04T16-40-54.682126+0100.log @@ -0,0 +1,89 @@ +15:40:54 [INFO] Redirect URI: http://127.0.0.1:3000/callback +15:40:54 [INFO] Logging initialized +15:40:54 [INFO] Starting Gas Delivery Backend +15:40:54 [INFO] Initializing redis server +15:40:54 [INFO] Starting axum server +15:40:54 [INFO] perform_oidc_discovery; kc_instance_id=019c2950-4e1c-76f0-b16d-3eec0bc754be kc_server="http://127.0.0.1:8080/" kc_realm="master" oidc_discovery_endpoint="http://127.0.0.1:8080/realms/master/.well-known/openid-configuration" +15:40:54 [INFO] Starting OIDC discovery. +15:40:54 [INFO] layer; id=019c2950-4e1c-76f0-b16d-3ef3197d32e0 +15:40:54 [INFO] layer; id=019c2950-4e1c-76f0-b16d-3ef3197d32e0 +15:40:54 [INFO] layer; id=019c2950-4e1c-76f0-b16d-3ef3197d32e0 +15:40:54 [INFO] layer; id=019c2950-4e1c-76f0-b16d-3ef3197d32e0 +15:40:54 [INFO] layer; id=019c2950-4e1c-76f0-b16d-3ef3197d32e0 +15:40:54 [INFO] layer; id=019c2950-4e1c-76f0-b16d-3ef3197d32e0 +15:40:54 [INFO] Listening on 127.0.0.1:3000 +15:40:54 [INFO] Received new jwk_set containing 2 keys. +15:41:03 [INFO] Callback called +15:41:03 [INFO] Successfully created session 019c2950-70b1-7b10-8a55-3c9ada4d8864 for user +15:41:03 [INFO] Token scopes: EmptyExtraTokenFields +15:41:03 [INFO] Access token still valid for session 019c2950-70b1-7b10-8a55-3c9ada4d8864 (expires in 60 seconds) +15:41:05 [INFO] Access token still valid for session 019c2950-70b1-7b10-8a55-3c9ada4d8864 (expires in 58 seconds) +15:41:46 [INFO] Access token still valid for session 019c2950-70b1-7b10-8a55-3c9ada4d8864 (expires in 17 seconds) +15:46:12 [INFO] Access token expired for session 019c2950-70b1-7b10-8a55-3c9ada4d8864, attempting refresh +15:46:12 [INFO] Successfully refreshed access token for session 019c2950-70b1-7b10-8a55-3c9ada4d8864 +15:46:23 [INFO] Access token still valid for session 019c2950-70b1-7b10-8a55-3c9ada4d8864 (expires in 49 seconds) +15:46:39 [INFO] Access token still valid for session 019c2950-70b1-7b10-8a55-3c9ada4d8864 (expires in 33 seconds) +15:47:57 [INFO] Access token expired for session 019c2950-70b1-7b10-8a55-3c9ada4d8864, attempting refresh +15:47:57 [INFO] Successfully refreshed access token for session 019c2950-70b1-7b10-8a55-3c9ada4d8864 +15:58:54 [INFO] Callback called +15:58:54 [INFO] Successfully created session 019c2960-c909-7ad2-aa9a-e6286fb8a38d for user +15:58:54 [INFO] Token scopes: EmptyExtraTokenFields +15:58:54 [INFO] Access token still valid for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d (expires in 60 seconds) +15:58:57 [INFO] Access token still valid for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d (expires in 57 seconds) +16:03:13 [INFO] Access token expired for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d, attempting refresh +16:03:13 [INFO] Successfully refreshed access token for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d +16:03:19 [INFO] Access token still valid for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d (expires in 54 seconds) +16:04:56 [INFO] Access token expired for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d, attempting refresh +16:04:56 [INFO] Successfully refreshed access token for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d +16:14:40 [INFO] Access token expired for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d, attempting refresh +16:14:40 [INFO] Successfully refreshed access token for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d +16:32:07 [INFO] Access token expired for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d, attempting refresh +16:32:07 [INFO] Successfully refreshed access token for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d +16:34:48 [INFO] Access token expired for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d, attempting refresh +16:34:48 [INFO] Successfully refreshed access token for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d +16:46:07 [INFO] Access token expired for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d, attempting refresh +16:46:07 [INFO] Successfully refreshed access token for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d +16:46:28 [INFO] Access token still valid for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d (expires in 39 seconds) +16:46:34 [INFO] Access token still valid for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d (expires in 33 seconds) +16:46:54 [INFO] Access token still valid for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d (expires in 13 seconds) +16:47:46 [INFO] Access token expired for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d, attempting refresh +16:47:46 [INFO] Successfully refreshed access token for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d +16:48:50 [INFO] Access token expired for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d, attempting refresh +16:48:50 [INFO] Successfully refreshed access token for session 019c2960-c909-7ad2-aa9a-e6286fb8a38d +16:53:28 [INFO] Callback called +16:53:28 [INFO] Successfully created session 019c2992-bbbe-7a31-9c39-d24a9af89e59 for user +16:53:28 [INFO] Token scopes: EmptyExtraTokenFields +16:53:28 [INFO] Access token still valid for session 019c2992-bbbe-7a31-9c39-d24a9af89e59 (expires in 60 seconds) +16:53:31 [INFO] Access token still valid for session 019c2992-bbbe-7a31-9c39-d24a9af89e59 (expires in 57 seconds) +16:55:06 [INFO] Access token expired for session 019c2992-bbbe-7a31-9c39-d24a9af89e59, attempting refresh +16:55:06 [INFO] Successfully refreshed access token for session 019c2992-bbbe-7a31-9c39-d24a9af89e59 +16:55:41 [INFO] Access token still valid for session 019c2992-bbbe-7a31-9c39-d24a9af89e59 (expires in 25 seconds) +16:56:19 [INFO] Access token expired for session 019c2992-bbbe-7a31-9c39-d24a9af89e59, attempting refresh +16:56:19 [INFO] Successfully refreshed access token for session 019c2992-bbbe-7a31-9c39-d24a9af89e59 +16:56:27 [INFO] Access token still valid for session 019c2992-bbbe-7a31-9c39-d24a9af89e59 (expires in 52 seconds) +16:57:59 [INFO] Access token expired for session 019c2992-bbbe-7a31-9c39-d24a9af89e59, attempting refresh +16:57:59 [INFO] Successfully refreshed access token for session 019c2992-bbbe-7a31-9c39-d24a9af89e59 +17:00:14 [INFO] Access token expired for session 019c2992-bbbe-7a31-9c39-d24a9af89e59, attempting refresh +17:00:14 [INFO] Successfully refreshed access token for session 019c2992-bbbe-7a31-9c39-d24a9af89e59 +17:02:17 [INFO] Access token expired for session 019c2992-bbbe-7a31-9c39-d24a9af89e59, attempting refresh +17:02:17 [INFO] Successfully refreshed access token for session 019c2992-bbbe-7a31-9c39-d24a9af89e59 +17:04:48 [INFO] Access token expired for session 019c2992-bbbe-7a31-9c39-d24a9af89e59, attempting refresh +17:04:48 [INFO] Successfully refreshed access token for session 019c2992-bbbe-7a31-9c39-d24a9af89e59 +17:07:53 [INFO] Access token expired for session 019c2992-bbbe-7a31-9c39-d24a9af89e59, attempting refresh +17:07:53 [INFO] Successfully refreshed access token for session 019c2992-bbbe-7a31-9c39-d24a9af89e59 +17:08:18 [INFO] Callback called +17:08:18 [INFO] Successfully created session 019c29a0-50f3-7871-bf39-41d1657b14cc for user +17:08:18 [INFO] Token scopes: EmptyExtraTokenFields +17:08:18 [INFO] Access token still valid for session 019c29a0-50f3-7871-bf39-41d1657b14cc (expires in 60 seconds) +17:08:20 [INFO] Access token still valid for session 019c29a0-50f3-7871-bf39-41d1657b14cc (expires in 58 seconds) +17:08:22 [INFO] Access token still valid for session 019c29a0-50f3-7871-bf39-41d1657b14cc (expires in 56 seconds) +18:56:26 [INFO] Access token expired for session 019c29a0-50f3-7871-bf39-41d1657b14cc, attempting refresh +18:56:26 [ERROR] Failed to refresh access token: Token refresh request failed: ServerResponse(StandardErrorResponse { error: invalid_grant, error_description: Some("Token is not active"), error_uri: None }) +19:41:28 [WARN] Session not found in Redis: 019c29a0-50f3-7871-bf39-41d1657b14cc +19:41:45 [INFO] Callback called +19:41:45 [INFO] Successfully created session 019c2a2c-cfde-70a3-98ae-861a5a55cd64 for user +19:41:45 [INFO] Token scopes: EmptyExtraTokenFields +19:41:46 [INFO] Access token still valid for session 019c2a2c-cfde-70a3-98ae-861a5a55cd64 (expires in 59 seconds) +19:41:51 [INFO] Access token still valid for session 019c2a2c-cfde-70a3-98ae-861a5a55cd64 (expires in 54 seconds) +19:54:01 [INFO] Access token expired for session 019c2a2c-cfde-70a3-98ae-861a5a55cd64, attempting refresh +19:54:01 [INFO] Successfully refreshed access token for session 019c2a2c-cfde-70a3-98ae-861a5a55cd64 diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..aba6af3 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,77 @@ +services: + redis: + image: redis:7-alpine + container_name: redis-server + ports: + - "6379:6379" + volumes: + - redis-data:/data + networks: + - app-network + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + timeout: 3s + retries: 3 + restart: unless-stopped + +# microservice: +# build: +# context: . +# dockerfile: Dockerfile +# container_name: rust-microservice +# ports: +# - "3000:3000" +# environment: +# - REDIS_URL=redis://redis:6379 +# - RUST_LOG=info +# depends_on: +# redis: +# condition: service_healthy +# networks: +# - app-network +# restart: unless-stopped + + keycloak_web: + image: quay.io/keycloak/keycloak:23.0.7 + container_name: keycloak_web + environment: + KC_DB: postgres + KC_DB_URL: jdbc:postgresql://keycloakdb:5432/keycloak + KC_DB_USERNAME: ${POSTGRES_USER} + KC_DB_PASSWORD: ${POSTGRES_PASSWORD} + + KC_HOSTNAME: 127.0.0.1 + KC_HOSTNAME_PORT: 8080 + KC_HOSTNAME_STRICT: false + KC_HOSTNAME_STRICT_HTTPS: false + + KC_LOG_LEVEL: info + KC_METRICS_ENABLED: true + KC_HEALTH_ENABLED: true + KEYCLOAK_ADMIN: admin + KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD} + command: start-dev + depends_on: + - keycloakdb + ports: + - 8080:8080 + + keycloakdb: + image: postgres:15 + volumes: + - postgres_data:/var/lib/postgresql/data + environment: + POSTGRES_DB: keycloak + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + +networks: + app-network: + driver: bridge + +volumes: + redis-data: + driver: local + postgres_data: + driver: local \ No newline at end of file diff --git a/requests/get_cars_by_supplier.http b/requests/get_cars_by_supplier.http new file mode 100644 index 0000000..c20b25b --- /dev/null +++ b/requests/get_cars_by_supplier.http @@ -0,0 +1,2 @@ +GET http://127.0.0.1:3000/cars +Cookie: session_id=019c28ac-2f5a-75e1-b909-f862e773a5c6 \ No newline at end of file diff --git a/requests/get_tour_by_car.http b/requests/get_tour_by_car.http new file mode 100644 index 0000000..4402dd3 --- /dev/null +++ b/requests/get_tour_by_car.http @@ -0,0 +1,2 @@ +GET http://127.0.0.1:3000/tour/1234 +Cookie: session_id=019c28ac-2f5a-75e1-b909-f862e773a5c6 \ No newline at end of file diff --git a/requests/http-client.private.env.json b/requests/http-client.private.env.json new file mode 100644 index 0000000..621a006 --- /dev/null +++ b/requests/http-client.private.env.json @@ -0,0 +1,5 @@ +{ + "dev": { + "supplier_id": "12345" + } +} \ No newline at end of file diff --git a/requests/userinfo.http b/requests/userinfo.http new file mode 100644 index 0000000..39b4fbd --- /dev/null +++ b/requests/userinfo.http @@ -0,0 +1,4 @@ +### GET request to example server +GET http://127.0.0.1:3000/userinfo +Cookie: session_id=019c22f6-d203-7ff2-b80c-c13ce9b84b69 +### \ No newline at end of file diff --git a/src/api.rs b/src/api.rs new file mode 100644 index 0000000..e505bb8 --- /dev/null +++ b/src/api.rs @@ -0,0 +1,16 @@ +pub(crate) mod supplier; +pub(crate) mod tour; + +use crate::util::{decode_payload_unchecked}; +use axum::body::Body; +use axum::extract::Request; +use axum::response::IntoResponse; +use crate::model::{User}; + +pub async fn userinfo(request: Request) -> impl IntoResponse { + let access_token_string = &request.headers().get("authorization").unwrap().to_str().unwrap().to_string()[7..]; + println!("access_token_string is {}", access_token_string); + let user = decode_payload_unchecked::(access_token_string).unwrap(); + + serde_json::to_string(&user.employee).unwrap().into_response() +} diff --git a/src/api/supplier.rs b/src/api/supplier.rs new file mode 100644 index 0000000..c12c485 --- /dev/null +++ b/src/api/supplier.rs @@ -0,0 +1,27 @@ +use crate::dto::{GetCarInfosDTO, get_example_deliveries}; +use crate::model::User; +use crate::response::{FailResponse, ResponseFactory}; +use crate::util::decode_payload_unchecked; +use axum::Json; +use axum::http::StatusCode; +use axum_extra::TypedHeader; +use axum_extra::headers::Authorization; +use axum_extra::headers::authorization::Bearer; + +pub async fn load_supplier_cars( + TypedHeader(auth): TypedHeader>, +) -> Result, (StatusCode, Json)> { + let user_res = decode_payload_unchecked::(auth.token()); + + if let Err(e) = user_res { + return Err(( + StatusCode::UNAUTHORIZED, + Json(ResponseFactory::error( + format!("An error occured: {}", e.to_string()), + Some(StatusCode::UNAUTHORIZED.as_u16() as u32), + )), + )); + } + + Ok(Json(get_example_deliveries())) +} diff --git a/src/api/tour.rs b/src/api/tour.rs new file mode 100644 index 0000000..54f1b08 --- /dev/null +++ b/src/api/tour.rs @@ -0,0 +1,29 @@ +use axum::extract::Path; +use axum::http::StatusCode; +use axum::Json; +use axum_extra::headers::Authorization; +use axum_extra::headers::authorization::Bearer; +use axum_extra::TypedHeader; +use crate::dto::{get_example_deliveries, get_test_tour, GetCarInfosDTO, TourDTO}; +use crate::model::User; +use crate::response::{FailResponse, ResponseFactory}; +use crate::util::decode_payload_unchecked; + +pub async fn load_tour( + TypedHeader(auth): TypedHeader>, + Path(car_id): Path +) -> Result, (StatusCode, Json)> { + let user_res = decode_payload_unchecked::(auth.token()); + + if let Err(e) = user_res { + return Err(( + StatusCode::UNAUTHORIZED, + Json(ResponseFactory::error( + format!("An error occured: {}", e.to_string()), + Some(StatusCode::UNAUTHORIZED.as_u16() as u32), + )), + )); + } + + Ok(Json(get_test_tour(car_id))) +} diff --git a/src/auth.rs b/src/auth.rs new file mode 100644 index 0000000..79ea818 --- /dev/null +++ b/src/auth.rs @@ -0,0 +1,425 @@ +use std::collections::HashMap; +use crate::config::Config; +use crate::middleware::AppState; +use crate::repository::RedisRepository; +use axum::http::{StatusCode, header}; +use axum::response::{Html, Response}; +use axum::{ + Router, + extract::{Query, State}, + response::{IntoResponse, Redirect}, + routing::get, +}; +use axum_extra::extract::CookieJar; +use oauth2::basic::{ + BasicErrorResponse, BasicRevocationErrorResponse, BasicTokenIntrospectionResponse, + BasicTokenResponse, +}; +use oauth2::{ + AuthUrl, AuthorizationCode, Client, ClientId, ClientSecret, CsrfToken, EndpointNotSet, + EndpointSet, PkceCodeChallenge, PkceCodeVerifier, RedirectUrl, Scope, StandardRevocableToken, + TokenResponse, TokenUrl, basic::BasicClient, +}; +use serde::{Deserialize, Serialize}; +use std::sync::Arc; +use axum::routing::post; +use log::info; + +pub type OAuthClient = Client< + BasicErrorResponse, + BasicTokenResponse, + BasicTokenIntrospectionResponse, + StandardRevocableToken, + BasicRevocationErrorResponse, + EndpointSet, + EndpointNotSet, + EndpointNotSet, + EndpointNotSet, + EndpointSet, +>; + +pub fn router(state: Arc) -> Router { + Router::new() + .route("/login", get(login)) + .route("/callback", get(callback)) + .route("/logout", post(logout)) + .with_state(state) +} + +async fn login(State(client): State>) -> impl IntoResponse { + let cloned_client = client.clone(); + let (pkce_challenge, pkce_verifier) = PkceCodeChallenge::new_random_sha256(); + let csrf_token = CsrfToken::new_random(); + + // Store the PKCE verifier in Redis with CSRF token as key + let redis_key = format!("pkce_verifier:{}", csrf_token.secret()); + let verifier_secret = pkce_verifier.secret().to_string(); + + match cloned_client + .repository + .set_with_expiry(&redis_key, &verifier_secret, 600) // 10 minutes expiry + .await + { + Ok(_) => { + let (auth_url, _) = cloned_client + .oauth_client + .authorize_url(|| csrf_token) + .add_scope(Scope::new("openid".to_string())) + .add_scope(Scope::new("profile".to_string())) + .add_scope(Scope::new("email".to_string())) + .set_pkce_challenge(pkce_challenge) + .url(); + + Redirect::to(auth_url.as_str()).into_response() + } + Err(e) => { + log::error!("Failed to store PKCE verifier in Redis: {:?}", e); + ( + StatusCode::INTERNAL_SERVER_ERROR, + "Failed to initiate login", + ) + .into_response() + } + } +} + +#[derive(Deserialize)] +pub struct Callback { + code: String, + state: String, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct UserSession { + pub(crate) access_token: String, + pub(crate) refresh_token: String, + pub(crate) expires_at: i64, +} + +async fn callback( + State(client): State>, + Query(query): Query, +) -> impl IntoResponse { + let http_client = reqwest::ClientBuilder::new() + .redirect(reqwest::redirect::Policy::none()) + .build() + .expect("Client should build"); + + let cloned_state = client.clone(); + + log::info!("Callback called"); + + // Retrieve the PKCE verifier from Redis using CSRF token + let redis_key = format!("pkce_verifier:{}", query.state); + + let verifier_secret = match cloned_state.repository.get(&redis_key).await { + Ok(Some(secret)) => secret, + Ok(None) => { + log::error!("PKCE verifier not found for state: {}", query.state); + return ( + StatusCode::BAD_REQUEST, + "Invalid or expired login session. Please try again.", + ) + .into_response(); + } + Err(e) => { + log::error!("Failed to retrieve PKCE verifier from Redis: {:?}", e); + return (StatusCode::INTERNAL_SERVER_ERROR, "Login failed").into_response(); + } + }; + + // Delete the verifier from Redis (one-time use) + let _ = cloned_state.repository.delete(&redis_key).await; + let pkce_verifier = PkceCodeVerifier::new(verifier_secret); + + let token_result = cloned_state + .oauth_client + .exchange_code(AuthorizationCode::new(query.code)) + .set_pkce_verifier(pkce_verifier) + .request_async(&http_client) + .await; + + match token_result { + Ok(token) => { + let access_token = token.access_token().secret(); + let refresh_token = token + .refresh_token() + .map(|rt| rt.secret().to_string()) + .unwrap_or_else(|| "No refresh token".to_string()); + + let expires_at = chrono::Utc::now().timestamp() + + token + .expires_in() + .map(|d| d.as_secs() as i64) + .unwrap_or(3600); + + // ============================================ + // 1. GENERATE A UNIQUE SESSION ID + // ============================================ + let session_id = uuid::Uuid::now_v7().to_string(); + + // ============================================ + // 2. CREATE THE USER SESSION STRUCT + // ============================================ + let user_session = UserSession { + access_token: access_token.clone(), + refresh_token: refresh_token.clone(), + expires_at, + }; + + // ============================================ + // 3. SERIALIZE THE SESSION TO JSON + // ============================================ + let session_key = format!("user_session:{}", session_id); + let session_json = match serde_json::to_string(&user_session) { + Ok(json) => json, + Err(e) => { + log::error!("Failed to serialize user session: {:?}", e); + return (StatusCode::INTERNAL_SERVER_ERROR, "Login failed").into_response(); + } + }; + + // ============================================ + // 4. STORE IN REDIS WITH 24 HOUR EXPIRATION + // This is where the tokens are actually stored! + // ============================================ + if let Err(e) = cloned_state + .repository + .set_with_expiry(&session_key, &session_json, 86400) // 86400 = 24 hours + .await + { + log::error!("Failed to store user session in Redis: {:?}", e); + return (StatusCode::INTERNAL_SERVER_ERROR, "Login failed").into_response(); + } + + info!("Successfully created session {} for user", session_id); + info!("Token scopes: {:?}", token.extra_fields()); + + // 4. Redirect to frontend + let redirect_url = format!("{}/?session_id={}", cloned_state.frontend_url.clone(), session_id); + + Redirect::to(redirect_url.as_str()).into_response() + } + Err(e) => { + log::error!("Token exchange failed: {:?}", e); + (StatusCode::UNAUTHORIZED, format!("Login failed: {:?}", e)).into_response() + } + } +} + +pub fn create_oauth_client(config: &Config) -> OAuthClient { + BasicClient::new(ClientId::new(config.keycloak.client_id.clone())) + .set_client_secret(ClientSecret::new(config.keycloak.client_secret.clone())) + .set_redirect_uri(RedirectUrl::new(config.keycloak.redirect_url.clone()).unwrap()) + .set_token_uri(TokenUrl::new(config.keycloak.token_url.clone()).unwrap()) + .set_auth_uri(AuthUrl::new(config.keycloak.auth_url.clone()).unwrap()) +} + +/// Internal helper to refresh access token +pub async fn refresh_access_token_internal( + client: &OAuthClient, + repository: &RedisRepository, + session_id: &str, + user_session: &mut UserSession, +) -> Result { + use oauth2::{RefreshToken, TokenResponse}; + + let http_client = reqwest::ClientBuilder::new() + .redirect(reqwest::redirect::Policy::none()) + .build() + .expect("Client should build"); + + let refresh_token = &user_session.refresh_token; + + // Exchange refresh token for new access token + let token_result = client + .exchange_refresh_token(&RefreshToken::new(refresh_token.clone())) + .request_async(&http_client) + .await + .map_err(|e| format!("Token refresh request failed: {:?}", e))?; + + // Update session with new tokens + let new_access_token = token_result.access_token().secret().to_string(); + user_session.access_token = new_access_token.clone(); + + // Update refresh token if a new one was provided + if let Some(new_refresh_token) = token_result.refresh_token() { + user_session.refresh_token = new_refresh_token.secret().to_string(); + } + + // Update expiration time + user_session.expires_at = chrono::Utc::now().timestamp() + + token_result + .expires_in() + .map(|d| d.as_secs() as i64) + .unwrap_or(3600); + + // Save updated session back to Redis + let session_key = format!("user_session:{}", session_id); + let updated_json = serde_json::to_string(&user_session) + .map_err(|e| format!("Failed to serialize session: {:?}", e))?; + + repository + .set_with_expiry(&session_key, &updated_json, 86400) + .await + .map_err(|e| format!("Failed to update session in Redis: {:?}", e))?; + + Ok(new_access_token) +} + +async fn logout(jar: CookieJar, State(oauth_state): State>) -> impl IntoResponse { + // 1. Extract session ID from cookie + let session_id = match jar.get("session_id") { + Some(cookie) => cookie.value().to_string(), + None => { + log::warn!("Logout attempted without session cookie"); + return (StatusCode::BAD_REQUEST, "No active session").into_response(); + } + }; + + // 2. Get session from Redis to retrieve tokens + let session_key = format!("user_session:{}", session_id); + let session_json = match oauth_state.repository.get(&session_key).await { + Ok(Some(json)) => json, + Ok(None) => { + log::warn!("Session not found in Redis: {}", session_id); + // Session already gone, just clear cookie + return clear_session_cookie().into_response(); + } + Err(e) => { + log::error!("Redis error while fetching session for logout: {:?}", e); + return (StatusCode::INTERNAL_SERVER_ERROR, "Logout failed").into_response(); + } + }; + + let user_session: UserSession = match serde_json::from_str(&session_json) { + Ok(session) => session, + Err(e) => { + log::error!("Failed to parse session JSON during logout: {:?}", e); + // Clean up anyway + let _ = oauth_state.repository.delete(&session_key).await; + return clear_session_cookie().into_response(); + } + }; + + // 3. Revoke tokens at Keycloak + let revoke_result = revoke_tokens_at_keycloak( + &oauth_state, + &user_session.access_token, + &user_session.refresh_token, + ) + .await; + + if let Err(e) = revoke_result { + log::error!("Failed to revoke tokens at Keycloak: {}", e); + // Continue anyway - we'll still delete local session + } else { + log::info!( + "Successfully revoked tokens at Keycloak for session {}", + session_id + ); + } + + // 4. Delete session from Redis + match oauth_state.repository.delete(&session_key).await { + Ok(_) => { + log::info!("Successfully deleted session {} from Redis", session_id); + } + Err(e) => { + log::error!("Failed to delete session from Redis: {:?}", e); + } + } + + // 5. Clear session cookie and respond + clear_session_cookie().into_response() +} + +/// Helper function to revoke tokens at Keycloak's revocation endpoint +async fn revoke_tokens_at_keycloak( + oauth_state: &Arc, + access_token: &str, + refresh_token: &str, +) -> Result<(), String> { + // Get client credentials from OAuth client + let client_id = oauth_state.oauth_client.client_id().as_str(); + let client_secret = oauth_state.config.keycloak.client_secret.as_str(); + + // Build revocation endpoint URL + // Keycloak's revocation endpoint is typically at: + // {realm_url}/protocol/openid-connect/revoke + let token_url = oauth_state.config.keycloak.token_url.as_str(); + + // Replace /token with /revoke + let revoke_url = token_url.replace("/token", "/revoke"); + + log::info!("Revoking tokens at: {}", revoke_url); + + let client = reqwest::Client::new(); + + // Revoke refresh token (this also invalidates the access token) + let revoke_refresh_result = client + .post(&revoke_url) + .form(&[ + ("token", refresh_token), + ("token_type_hint", "refresh_token"), + ("client_id", client_id), + ("client_secret", client_secret), + ]) + .send() + .await + .map_err(|e| format!("Failed to send revoke request: {:?}", e))?; + + if !revoke_refresh_result.status().is_success() { + let status = revoke_refresh_result.status(); + let body = revoke_refresh_result + .text() + .await + .unwrap_or_else(|_| "Unable to read response".to_string()); + log::warn!( + "Token revocation returned non-success status {}: {}", + status, + body + ); + // Note: Keycloak returns 200 even if token is already invalid, so this is unusual + } + + // Optionally also revoke access token explicitly + let revoke_access_result = client + .post(&revoke_url) + .form(&[ + ("token", access_token), + ("token_type_hint", "access_token"), + ("client_id", client_id), + ("client_secret", client_secret), + ]) + .send() + .await + .map_err(|e| format!("Failed to send revoke request for access token: {:?}", e))?; + + if !revoke_access_result.status().is_success() { + let status = revoke_access_result.status(); + let body = revoke_access_result + .text() + .await + .unwrap_or_else(|_| "Unable to read response".to_string()); + log::warn!( + "Access token revocation returned non-success status {}: {}", + status, + body + ); + } + + Ok(()) +} + +/// Helper function to create a response that clears the session cookie +fn clear_session_cookie() -> Response { + // Set cookie with Max-Age=0 to delete it + let clear_cookie = "session_id=; Path=/; HttpOnly; SameSite=Lax; Max-Age=0"; + + Response::builder() + .status(StatusCode::OK) + .header(header::SET_COOKIE, clear_cookie) + .body("Logged out successfully".into()) + .unwrap() +} diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..7a89892 --- /dev/null +++ b/src/config.rs @@ -0,0 +1,97 @@ +use std::fs; +use std::path::PathBuf; + +const CONFIG_FILE: &str = "config.toml"; + +#[derive(serde::Serialize, serde::Deserialize, Clone)] +pub struct Config { + // Backend server configuration + pub log_file_prefix: String, + pub host_ip: String, + pub host_port: u16, + pub redis_url: String, + + pub frontend_url: String, + + // GSD RestAPI configuration + pub gsd_app_key: String, + pub gsd_rest_url: String, + pub gsd_user: String, + pub gsd_password: String, + pub gsd_app_names: Vec, + + pub keycloak: Keycloak, +} + +#[derive(serde::Serialize, serde::Deserialize, Clone)] +pub struct Keycloak { + pub realm_url: String, + pub client_id: String, + pub client_secret: String, + pub auth_url: String, + pub token_url: String, + pub redirect_url: String, + pub realm: String, + pub base_url: String, +} + +impl Config { + pub fn get_host_url(&self) -> String { + format!("{}:{}", self.host_ip, self.host_port) + } +} + +fn get_config_absolute_path() -> PathBuf { + PathBuf::from(CONFIG_FILE) +} + +pub fn load_config() -> Result> { + if fs::exists(get_config_absolute_path())? { + Ok(toml::from_str(&fs::read_to_string(CONFIG_FILE)?)?) + } else { + let config = create_standard_config(); + save_config(&config)?; + + Ok(config) + } +} + +pub fn generate_log_file_name(prefix: String) -> String { + format!("{}_{}.log", prefix, chrono::Local::now().format("%Y-%m-%dT%H-%M-%S%.6f%z")) +} + +pub fn save_config(config: &Config) -> Result<(), Box> { + fs::write(get_config_absolute_path(), toml::to_string(config)?)?; + + Ok(()) +} + +pub fn create_standard_config() -> Config { + Config { + log_file_prefix: String::from("delivery_backend"), + host_ip: String::from("127.0.0.1"), + host_port: 3000, + redis_url: String::from("redis://127.0.0.1:6379"), + gsd_rest_url: String::from("http://127.0.0.1:8334"), + gsd_app_key: String::from("GSD-RestApi"), + frontend_url: String::from("http://127.0.0.1:3000"), + gsd_app_names: vec![String::from("GSD-RestApi")], + gsd_user: String::from(""), + gsd_password: String::from(""), + + keycloak: Keycloak { + realm_url: String::from("http://127.0.0.1:8080/auth/realms/master"), + client_id: String::from("delivery-backend"), + client_secret: String::from(""), + realm: String::from("master"), + base_url: String::from("http://127.0.0.1:8080"), + auth_url: String::from( + "http://127.0.0.1:8080/auth/realms/master/protocol/openid-connect/auth", + ), + token_url: String::from( + "http://127.0.0.1:8080/auth/realms/master/protocol/openid-connect/token", + ), + redirect_url: String::from("http://127.0.0.1:3000/callback"), + }, + } +} diff --git a/src/dto.rs b/src/dto.rs new file mode 100644 index 0000000..88a1450 --- /dev/null +++ b/src/dto.rs @@ -0,0 +1,331 @@ +use chrono::{DateTime, TimeZone, Utc}; + +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] +pub struct CarInfoDTO { + pub amount_deliveries: u32, + pub car: CarDTO, +} + +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] +pub struct CarDTO { + pub id: u32, + pub car_name: String, + pub driver_name: Option, +} + +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] +pub struct GetCarInfosDTO { + pub deliveries: Vec, + pub date: String +} + +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] +pub struct ArticleDTO { + pub id: u64, + pub title: String, + pub quantity: u64, + pub price_per_quantity: f32, + pub deposit_price_per_quantity: f32, + pub quantity_delivered: u64, + pub quantity_returned: u64, + pub quantity_to_deposit: u64, + pub reference_to: Option +} + +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] +pub struct AddressDTO { + pub street: String, + pub housing_number: String, + pub postal_code: String, + pub city: String, + pub country: Option +} + +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] +pub struct CustomerDTO { + pub name: String, + pub id: u64, + pub address: AddressDTO +} + +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] +pub struct ReceiptDTO { + pub articles: Vec, + pub customer: CustomerDTO, + + pub total_gross_price: f32, + pub total_net_price: f32 +} + +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] +pub struct DeliveryDTO { + pub receipt: ReceiptDTO, + pub information_for_driver: String, + pub desired_delivery_time: DateTime, + pub time_delivered: Option>, +} + +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] +pub struct TourDTO { + pub car: CarDTO, + pub date: String, + pub deliveries: Vec, +} + +pub fn get_example_deliveries() -> GetCarInfosDTO { + GetCarInfosDTO { + date: format!("{}", Utc::now().format("%d.%m.%Y")), + deliveries: vec![ + CarInfoDTO { + car: CarDTO { + id: 1, + car_name: "OG DN 1998".to_string(), + driver_name: Some("Dennis Nemec".to_string()), + }, + amount_deliveries: 12, + }, + CarInfoDTO { + car: CarDTO { + id: 2, + car_name: "S SM 2547".to_string(), + driver_name: None // "Sarah Müller".to_string(), + }, + amount_deliveries: 8, + }, + CarInfoDTO { + car: CarDTO { + id: 3, + car_name: "M MS 3891".to_string(), + driver_name: Some("Michael Schmidt".to_string()), + }, + amount_deliveries: 15, + }, + CarInfoDTO { + car: CarDTO { + id: 4, + car_name: "KA AW 1024".to_string(), + driver_name: Some("Anna Weber".to_string()), + }, + amount_deliveries: 6, + }, + CarInfoDTO { + car: CarDTO { + id: 5, + car_name: "FR TB 7652".to_string(), + driver_name: None // "Thomas Becker".to_string(), + }, + amount_deliveries: 11, + }, + CarInfoDTO { + car: CarDTO { + id: 6, + car_name: "HD JH 4389".to_string(), + driver_name: Some("Julia Hoffmann".to_string()), + }, + amount_deliveries: 9, + }, + CarInfoDTO { + car: CarDTO { + id: 7, + car_name: "KN MF 5123".to_string(), + driver_name: Some("Markus Fischer".to_string()), + }, + amount_deliveries: 13, + }, + ], + } +} + +pub fn get_test_tour(car_id: u64) -> TourDTO { + TourDTO { + car: CarDTO { + id: car_id as u32, + car_name: String::from("Mercedes Sprinter"), + driver_name: Some(String::from("Hans Müller")), + }, + date: String::from("2026-02-05"), + deliveries: vec![ + // Lieferung 1 + DeliveryDTO { + receipt: ReceiptDTO { + articles: vec![ + ArticleDTO { + id: 1001, + title: String::from("Propangas 5kg"), + quantity: 4, + price_per_quantity: 18.99, + deposit_price_per_quantity: 0.0, + quantity_delivered: 4, + quantity_returned: 0, + quantity_to_deposit: 0, + reference_to: None, + }, + ArticleDTO { + id: 2001, + title: String::from("Pfandflasche 5kg"), + quantity: 4, + price_per_quantity: 0.0, + deposit_price_per_quantity: 35.00, + quantity_delivered: 4, + quantity_returned: 2, + quantity_to_deposit: 2, + reference_to: Some(1001), + }, + ArticleDTO { + id: 1002, + title: String::from("Propangas 11kg"), + quantity: 2, + price_per_quantity: 32.99, + deposit_price_per_quantity: 0.0, + quantity_delivered: 2, + quantity_returned: 0, + quantity_to_deposit: 0, + reference_to: None, + }, + ArticleDTO { + id: 2002, + title: String::from("Pfandflasche 11kg"), + quantity: 2, + price_per_quantity: 0.0, + deposit_price_per_quantity: 45.00, + quantity_delivered: 2, + quantity_returned: 1, + quantity_to_deposit: 1, + reference_to: Some(1002), + }, + ], + customer: CustomerDTO { + name: String::from("Grillhütte Waldheim"), + id: 5001, + address: AddressDTO { + street: String::from("Waldstraße"), + housing_number: String::from("15"), + postal_code: String::from("70597"), + city: String::from("Stuttgart"), + country: Some(String::from("Deutschland")), + }, + }, + total_gross_price: 211.94, + total_net_price: 178.10, + }, + information_for_driver: String::from("Flaschen beim Lagerraum hinter dem Gebäude abstellen. Alte Flaschen abholen."), + desired_delivery_time: Utc.with_ymd_and_hms(2026, 2, 5, 8, 0, 0).unwrap(), + time_delivered: None // Utc.with_ymd_and_hms(2026, 2, 5, 8, 15, 0).unwrap(), + }, + + // Lieferung 2 + DeliveryDTO { + receipt: ReceiptDTO { + articles: vec![ + ArticleDTO { + id: 1001, + title: String::from("Propangas 5kg"), + quantity: 8, + price_per_quantity: 18.99, + deposit_price_per_quantity: 0.0, + quantity_delivered: 8, + quantity_returned: 0, + quantity_to_deposit: 0, + reference_to: None, + }, + ArticleDTO { + id: 2001, + title: String::from("Pfandflasche 5kg"), + quantity: 8, + price_per_quantity: 0.0, + deposit_price_per_quantity: 35.00, + quantity_delivered: 8, + quantity_returned: 7, + quantity_to_deposit: 1, + reference_to: Some(1001), + }, + ArticleDTO { + id: 1003, + title: String::from("Propangas 33kg"), + quantity: 1, + price_per_quantity: 89.99, + deposit_price_per_quantity: 0.0, + quantity_delivered: 1, + quantity_returned: 0, + quantity_to_deposit: 0, + reference_to: None, + }, + ArticleDTO { + id: 2003, + title: String::from("Pfandflasche 33kg"), + quantity: 1, + price_per_quantity: 0.0, + deposit_price_per_quantity: 75.00, + quantity_delivered: 1, + quantity_returned: 1, + quantity_to_deposit: 0, + reference_to: Some(1003), + }, + ], + customer: CustomerDTO { + name: String::from("Campingplatz Sonnenhof"), + id: 5002, + address: AddressDTO { + street: String::from("Am See"), + housing_number: String::from("23"), + postal_code: String::from("70376"), + city: String::from("Stuttgart"), + country: Some(String::from("Deutschland")), + }, + }, + total_gross_price: 241.91, + total_net_price: 203.28, + }, + information_for_driver: String::from("Rezeption informieren. Flaschen zur Gasflaschenhütte bei Stellplatz A12 bringen."), + desired_delivery_time: Utc.with_ymd_and_hms(2026, 2, 5, 10, 0, 0).unwrap(), + time_delivered: Some(Utc.with_ymd_and_hms(2026, 2, 5, 10, 20, 0).unwrap()), + }, + + // Lieferung 3 + DeliveryDTO { + receipt: ReceiptDTO { + articles: vec![ + ArticleDTO { + id: 1002, + title: String::from("Propangas 11kg"), + quantity: 6, + price_per_quantity: 32.99, + deposit_price_per_quantity: 0.0, + quantity_delivered: 6, + quantity_returned: 0, + quantity_to_deposit: 0, + reference_to: None, + }, + ArticleDTO { + id: 2002, + title: String::from("Pfandflasche 11kg"), + quantity: 6, + price_per_quantity: 0.0, + deposit_price_per_quantity: 45.00, + quantity_delivered: 6, + quantity_returned: 5, + quantity_to_deposit: 1, + reference_to: Some(1002), + }, + ], + customer: CustomerDTO { + name: String::from("Baumarkt Schmidt GmbH"), + id: 5003, + address: AddressDTO { + street: String::from("Industriestraße"), + housing_number: String::from("88"), + postal_code: String::from("70565"), + city: String::from("Stuttgart"), + country: Some(String::from("Deutschland")), + }, + }, + total_gross_price: 242.94, + total_net_price: 204.15, + }, + information_for_driver: String::from("Wareneingang nutzen, Anlieferung nur bis 12 Uhr möglich."), + desired_delivery_time: Utc.with_ymd_and_hms(2026, 2, 5, 11, 30, 0).unwrap(), + time_delivered: Some(Utc.with_ymd_and_hms(2026, 2, 5, 11, 45, 0).unwrap()), + }, + ], + } +} \ No newline at end of file diff --git a/src/gsd.rs b/src/gsd.rs new file mode 100644 index 0000000..54fd5fa --- /dev/null +++ b/src/gsd.rs @@ -0,0 +1,2 @@ +pub(crate) mod dto; +pub(crate) mod service; diff --git a/src/gsd/dto.rs b/src/gsd/dto.rs new file mode 100644 index 0000000..3cc07da --- /dev/null +++ b/src/gsd/dto.rs @@ -0,0 +1,27 @@ +#[derive(serde::Deserialize, serde::Serialize)] +#[serde(rename_all = "camelCase")] +pub struct GSDLoginRequestDTO { + pub user: String, + pub pass: String, + pub app_names: Vec, +} + +#[derive(serde::Deserialize, serde::Serialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct GSDResponseDTO { + pub status: Option, + pub data: Option, +} + +#[derive(serde::Deserialize, serde::Serialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct GSDLoginResponseDataDTO { + pub session_id: Option, +} + +#[derive(serde::Deserialize, serde::Serialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct GSDResponseStatusDTO { + pub internal_status: String, + pub status_message: String, +} diff --git a/src/gsd/service.rs b/src/gsd/service.rs new file mode 100644 index 0000000..639d4cb --- /dev/null +++ b/src/gsd/service.rs @@ -0,0 +1,134 @@ +use crate::config::Config; +use crate::gsd::dto::*; +use axum::body::Body; +use axum::extract::Request; +use log::{error, info}; +use reqwest::Response; + +#[derive(Clone)] +pub struct GSDService { + host_url: String, + app_names: Vec, + app_key: String, + username: String, + password: String, +} + +#[derive(Debug)] +pub enum GSDServiceError { + LoginFailed, + LoginResponseParsingFailed, + RequestError(String), +} + +impl GSDService { + pub async fn get_session(&self) -> Result { + info!( + "Session: No session found. Generate session from GSD server {}", + self.host_url + ); + + let dto = GSDLoginRequestDTO { + user: self.username.clone(), + pass: self.password.clone(), + app_names: self.app_names.clone(), + }; + + let response = reqwest::Client::new() + .post(format!("{}/v1/login", self.host_url.clone())) + .header("appKey", self.app_key.as_str()) + .header("Content-Type", "application/json") + .json(&dto) + .send() + .await + .map_err(|e| { + error!("Session: error request to GSD: {}", e); + GSDServiceError::LoginFailed + })?; + + let response_dto: GSDResponseDTO = response.json().await.map_err(|e| { + error!("Session: error request to GSD: {}", e); + GSDServiceError::LoginResponseParsingFailed + })?; + let response_dto_unwrapped = response_dto.status.unwrap(); + + if response_dto_unwrapped.internal_status != "0" { + error!( + "Session: error message from GSD: {}", + response_dto_unwrapped.status_message + ); + Err(GSDServiceError::LoginFailed) + } else { + match response_dto.data { + Some(data) => { + info!( + "Session: successfully obtained session with session id {:?}", + &data.session_id.as_ref() + ); + Ok(data.session_id.unwrap()) + } + None => { + error!("Session: failed to obtain session id. No session id in request found."); + Err(GSDServiceError::LoginResponseParsingFailed) + } + } + } + } + + pub async fn forward_post_request( + &self, + request: Request, + ) -> Result { + let (parts, body) = request.into_parts(); + + reqwest::Client::new() + .post(format!("{}{}", self.host_url.clone(), parts.uri)) + .headers(parts.headers) + .body(axum::body::to_bytes(body, usize::MAX).await.unwrap()) + .send() + .await + .map_err(|e| GSDServiceError::RequestError(e.to_string())) + } + + pub async fn forward_patch_request( + &self, + request: Request, + ) -> Result { + let (parts, body) = request.into_parts(); + + reqwest::Client::new() + .patch(format!("{}{}", self.host_url.clone(), parts.uri)) + .headers(parts.headers) + .body(axum::body::to_bytes(body, usize::MAX).await.unwrap()) + .send() + .await + .map_err(|e| GSDServiceError::RequestError(e.to_string())) + } + + pub async fn forward_get_request( + &self, + request: Request, + ) -> Result { + let (parts, body) = request.into_parts(); + + reqwest::Client::new() + .get(format!("{}{}", self.host_url.clone(), parts.uri)) + .headers(parts.headers) + .body(axum::body::to_bytes(body, usize::MAX).await.unwrap()) + .send() + .await + .map_err(|e| GSDServiceError::RequestError(e.to_string())) + } +} + +impl From<&Config> for GSDService { + fn from(config: &Config) -> Self { + Self { + host_url: config.gsd_rest_url.clone(), + app_names: config.gsd_app_names.clone(), + app_key: config.gsd_app_key.clone(), + username: config.gsd_user.clone(), + password: config.gsd_password.clone(), + } + } +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..5a25afe --- /dev/null +++ b/src/main.rs @@ -0,0 +1,84 @@ +use crate::api::userinfo; +use crate::config::load_config; +use crate::middleware::AppState; +use crate::repository::RedisRepository; +use crate::util::initialize_logging; +use axum::routing::get; +use axum::{Extension, Router}; +use axum_keycloak_auth::PassthroughMode; +use axum_keycloak_auth::instance::{KeycloakAuthInstance, KeycloakConfig}; +use axum_keycloak_auth::layer::KeycloakAuthLayer; +use log::info; +use oauth2::url::Url; +use std::sync::Arc; + +mod api; +mod auth; +mod config; +mod gsd; +mod middleware; +mod model; +mod repository; +mod util; +mod response; +mod dto; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let config = load_config()?; + initialize_logging(&config); + + info!("Redirect URI: {}", config.keycloak.redirect_url); + info!("Logging initialized"); + info!("Starting Gas Delivery Backend"); + + let redis_url = config.redis_url.clone(); + let host_url = config.get_host_url().clone(); + + info!("Initializing redis server"); + let state = Arc::new(AppState { + config: config.clone(), + repository: RedisRepository::try_new(redis_url).await?, + gsd_service: (&config).into(), + oauth_client: auth::create_oauth_client(&config), + frontend_url: config.frontend_url.clone(), + }); + // + info!("Starting axum server"); + + let keycloak_instance: Arc = Arc::new(KeycloakAuthInstance::new( + KeycloakConfig::builder() + .server(Url::parse(config.keycloak.base_url.as_str())?) + .realm(config.keycloak.realm) + .build(), + )); + + let auth_router = auth::router(state.clone()); + let api_router = Router::new() + .route("/cars", get(api::supplier::load_supplier_cars)) + .route("/tour/{car_id}", get(api::tour::load_tour)) + .route("/userinfo", get(userinfo)) + .route_layer(Extension(state.clone())) + .route_layer( + KeycloakAuthLayer::::builder() + .instance(keycloak_instance.clone()) + .passthrough_mode(PassthroughMode::Block) + .persist_raw_claims(false) + .expected_audiences(vec![String::from("account")]) + .build(), + ) + .route_layer(axum::middleware::from_fn_with_state( + state.clone(), + middleware::session_auth_middleware, + )) + .with_state(state); + + let app = Router::new().merge(api_router).merge(auth_router); + + info!("Listening on {}", host_url); + let listener = tokio::net::TcpListener::bind(host_url.clone()).await?; + + axum::serve(listener, app).await?; + + Ok(()) +} diff --git a/src/middleware.rs b/src/middleware.rs new file mode 100644 index 0000000..f5bfab3 --- /dev/null +++ b/src/middleware.rs @@ -0,0 +1,168 @@ +use crate::auth::{OAuthClient, UserSession, refresh_access_token_internal}; +use crate::config::Config; +use crate::gsd::service::GSDService; +use crate::repository::RedisRepository; +use crate::util::set_and_log_session; +use axum::extract::{Request, State}; +use axum::http::{HeaderValue, StatusCode}; +use axum::middleware::Next; +use axum::response::{IntoResponse, Response}; +use axum_extra::extract::CookieJar; +use log::{error, info, warn}; +use std::sync::Arc; + +#[derive(Clone)] +pub struct AppState { + pub config: Config, + pub repository: RedisRepository, + pub gsd_service: GSDService, + pub oauth_client: OAuthClient, + pub frontend_url: String, +} + +/// Middleware to validate session and refresh tokens if needed +pub async fn session_auth_middleware( + jar: CookieJar, + State(state): State>, + mut request: Request, + next: Next, +) -> Response { + // 1. Extract session ID from cookie + let session_id = match jar.get("session_id") { + Some(cookie) => cookie.value().to_string(), + None => { + warn!("No session cookie found"); + return (StatusCode::UNAUTHORIZED, "No session cookie").into_response(); + } + }; + + // 2. Find session in Redis + let session_key = format!("user_session:{}", session_id); + let session_json = match state.repository.get(&session_key).await { + Ok(Some(json)) => json, + Ok(None) => { + warn!("Session not found in Redis: {}", session_id); + return (StatusCode::UNAUTHORIZED, "Session expired or invalid").into_response(); + } + Err(e) => { + error!("Redis error while fetching session: {:?}", e); + return (StatusCode::INTERNAL_SERVER_ERROR, "Internal error").into_response(); + } + }; + + // 3. Parse session data + let mut user_session: UserSession = match serde_json::from_str(&session_json) { + Ok(session) => session, + Err(e) => { + error!("Failed to parse session JSON: {:?}", e); + return (StatusCode::INTERNAL_SERVER_ERROR, "Invalid session data").into_response(); + } + }; + + // 4. Check if access token is expired + let now = chrono::Utc::now().timestamp(); + if user_session.expires_at <= now { + info!( + "Access token expired for session {}, attempting refresh", + session_id + ); + + // 5. Refresh the access token using refresh token + match refresh_access_token_internal( + &state.oauth_client, + &state.repository, + &session_id, + &mut user_session, + ) + .await + { + Ok(new_access_token) => { + info!( + "Successfully refreshed access token for session {}", + session_id + ); + user_session.access_token = new_access_token; + } + Err(e) => { + error!("Failed to refresh access token: {}", e); + // Clean up invalid session + let _ = state.repository.delete(&session_key).await; + return ( + StatusCode::UNAUTHORIZED, + "Session expired, please login again", + ) + .into_response(); + } + } + } else { + info!( + "Access token still valid for session {} (expires in {} seconds)", + session_id, + user_session.expires_at - now + ); + } + + // 6. Attach validated access token to request for downstream handlers + match HeaderValue::from_str(format!("Bearer {}", &user_session.access_token).as_str()) { + Ok(header_value) => { + request.headers_mut().insert("authorization", header_value); + } + Err(e) => { + error!("Failed to create authorization header: {:?}", e); + return (StatusCode::INTERNAL_SERVER_ERROR, "Internal error").into_response(); + } + } + + // 7. Pass the request to the next handler + next.run(request).await +} + +pub async fn gsd_decorate_header( + State(state): State>, + mut request: Request, + next: Next, +) -> Response { + let state_cloned = state.clone(); + + let session = state_cloned.repository.get_session().await; + match session { + Ok(session) => { + let session_value; + + if session.is_none() { + match state_cloned.gsd_service.get_session().await { + Ok(session) => { + session_value = session.clone(); + set_and_log_session(&state_cloned, session.clone()).await; + } + Err(error) => { + error!("Error getting session: {:?}", error); + return StatusCode::UNAUTHORIZED.into_response(); + } + } + } else { + session_value = session.unwrap(); + } + + request.headers_mut().insert( + "sessionId", + HeaderValue::from_str(session_value.as_str()).unwrap(), + ); + } + Err(error) => { + error!( + "Redis error occured during fetching current session id. Error: {}", + error + ); + return StatusCode::INTERNAL_SERVER_ERROR.into_response(); + } + } + + request.headers_mut().insert( + "appkey", + HeaderValue::from_str(state_cloned.config.gsd_app_key.as_str()).unwrap(), + ); + + next.run(request).await + +} diff --git a/src/model.rs b/src/model.rs new file mode 100644 index 0000000..eb70a0a --- /dev/null +++ b/src/model.rs @@ -0,0 +1,13 @@ +#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] +pub struct User { + pub employee: Employee, +} + +#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] +#[serde(rename_all = "camelCase")] +pub struct Employee { + pub last_name: String, + pub first_name: String, + pub mail: String, + pub supplier_id: u64 +} \ No newline at end of file diff --git a/src/repository.rs b/src/repository.rs new file mode 100644 index 0000000..92663eb --- /dev/null +++ b/src/repository.rs @@ -0,0 +1,51 @@ +use redis::aio::ConnectionManager; +use redis::{AsyncTypedCommands, Connection, RedisError, RedisResult}; + +#[derive(Clone)] +pub struct RedisRepository { + connection_manager: ConnectionManager, +} + +impl RedisRepository { + pub async fn try_new(redis_url: String) -> Result { + Ok(RedisRepository { + connection_manager: redis::Client::open(redis_url)? + .get_connection_manager() + .await?, + }) + } + + pub async fn get_session(&self) -> RedisResult> { + self.connection_manager + .clone() + .get::("current_session".to_string()) + .await + } + + pub async fn set_session(&self, session: String) -> RedisResult<()> { + self.connection_manager + .clone() + .set("current_session", session) + .await?; + + Ok(()) + } + + pub async fn set_with_expiry(&self, key: &str, value: &str, expiry: u64) -> RedisResult<()> { + self.connection_manager + .clone() + .set_ex(key, value, expiry) + .await + } + + pub async fn get(&self, key: &str) -> RedisResult> { + self.connection_manager + .clone() + .get::(key.to_string()) + .await + } + + pub async fn delete(&self, key: &str) -> RedisResult { + self.connection_manager.clone().del(key.to_string()).await + } +} diff --git a/src/response.rs b/src/response.rs new file mode 100644 index 0000000..e19eab3 --- /dev/null +++ b/src/response.rs @@ -0,0 +1,20 @@ +use axum::Json; +use axum::response::{IntoResponse, Response}; +use serde::{Deserialize, Serialize}; +use serde_json::json; + +pub struct ResponseFactory {} +impl ResponseFactory { + pub fn error(message: String, code: Option) -> FailResponse { + FailResponse { + code, + message, + } + } +} + +#[derive(Debug, Deserialize, Serialize)] +pub struct FailResponse { + pub code: Option, + pub message: String, +} \ No newline at end of file diff --git a/src/util.rs b/src/util.rs new file mode 100644 index 0000000..223fead --- /dev/null +++ b/src/util.rs @@ -0,0 +1,47 @@ +use crate::config::{Config, generate_log_file_name}; +use crate::middleware::AppState; +use log::{LevelFilter, error, info}; +use simplelog::{ColorChoice, CombinedLogger, TermLogger, TerminalMode, WriteLogger}; +use std::fs::File; +use std::sync::Arc; +use serde::de::DeserializeOwned; +use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine as _}; + +pub fn decode_payload_unchecked(token: &str) -> Result> { + let mut parts = token.split('.'); + let _header = parts.next().ok_or("missing header")?; + let payload_b64 = parts.next().ok_or("missing payload")?; + // signature is parts.next() but we ignore it here + let payload = URL_SAFE_NO_PAD.decode(payload_b64.as_bytes())?; + let claims = serde_json::from_slice::(&payload)?; + Ok(claims) +} + +pub fn initialize_logging(config: &Config) { + CombinedLogger::init(vec![ + TermLogger::new( + LevelFilter::Info, + simplelog::Config::default(), + TerminalMode::Mixed, + ColorChoice::Auto, + ), + WriteLogger::new( + LevelFilter::Info, + simplelog::Config::default(), + File::create(generate_log_file_name(config.log_file_prefix.clone())).unwrap(), + ), + ]) + .unwrap(); +} + +pub async fn set_and_log_session(state: &Arc, session: String) { + match state.repository.set_session(session.clone()).await { + Ok(_) => { + info!("Redis: saved session {}", &session); + } + + Err(err) => { + error!("Redis: failed to save session: {}", err); + } + } +}