refactor: structure of an hexagonal architecture

Created a kernel crate to store models and future action implementations.
Will be useful to create admin cli.
This commit is contained in:
Matthieu Bessat 2024-11-28 12:47:00 +01:00
parent 69af48bb62
commit 3713cc2443
87 changed files with 834 additions and 474 deletions

1
tests/manual/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
tmp

View file

@ -0,0 +1,7 @@
#!/usr/bin/sh
curl -v http://localhost:8085/api/token \
-u "a1785786-8be1-443c-9a6f-35feed703609":"49c6c16a-0a8a-4981-a60d-5cb96582cc1a" \
-d grant_type="authorization_code" \
-d code="$(cat tmp/authorize_code.txt)" \
-d redirect_uri="http://localhost:9090/authorize" > tmp/access_token.json

8
tests/manual/all.sh Executable file
View file

@ -0,0 +1,8 @@
#!/usr/bin/sh
set -xeuo pipefail
./login.sh
./authorize.sh
./access_token_request.sh
./get_user_info.sh

15
tests/manual/authorize.sh Executable file
View file

@ -0,0 +1,15 @@
#!/usr/bin/sh
curl -v http://localhost:8085/authorize \
-G \
-D "tmp/headers.txt" \
--cookie "tmp/.curl-cookies" \
-d client_id="a1785786-8be1-443c-9a6f-35feed703609" \
-d response_type="code" \
-d redirect_uri="http://localhost:9090/callback" \
-d scope="user_read_basic" \
-d state="qxYAfk4kf6pbZkms78jM"
code="$(cat tmp/headers.txt | grep -i "location" | awk -F ": " '{print $2}' | trurl -f - -g "{query:code}")"
echo "$code" > tmp/authorize_code.txt

View file

@ -0,0 +1,5 @@
INSERT INTO users
(id, handle, email, roles, status, password_hash, created_at)
VALUES
('30c134a7-d541-4ec7-9310-9c8e298077db', 'test', 'test@example.org', '[]', 'Active', '$argon2i$v=19$m=4096,t=3,p=1$V2laYjAwTlFHOUpiekRlVzRQUU0$33h8XwAWM3pKQM7Ksler0l7rMJfseTuWPJKrdX/cGyc', '2024-11-30T00:00:00Z');

5
tests/manual/get_user_info.sh Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/sh
curl -v http://localhost:8085/api/user \
-u "a1785786-8be1-443c-9a6f-35feed703609":"49c6c16a-0a8a-4981-a60d-5cb96582cc1a" \
-H "Authorization: JWT $(jq -r .access_token tmp/access_token.json)"

6
tests/manual/login.sh Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/sh
curl -v http://localhost:8085/login \
--cookie-jar "tmp/.curl-cookies" \
-d login="test" \
-d password="test"

10
tests/manual/oauth2c.sh Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/bash
oauth2c http://localhost:8085 \
--client-id "a1785786-8be1-443c-9a6f-35feed703609" \
--client-secret "49c6c16a-0a8a-4981-a60d-5cb96582cc1a" \
--response-types code \
--response-mode query \
--grant-type authorization_code \
--auth-method client_secret_basic \
--scopes "user_read_basic"

6
tests/manual/register.sh Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/sh
curl -v http://localhost:8085/register \
-d email="test@example.org" \
-d handle="test" \
-d password="test"