graph TD
A[Store Service]--> B[Order Service]
A[Store Service] --> C[Warehouse Service]
A[Store Service] --> D[Warranty Service]
B[OrderService] --> D[Warranty Service]
B[OrderService] --> C[Warehouse Service]
C[Warehouse Service] --> D[Warranty Service]
# build services
$ ./gradlew clean build
# build docker images
$ docker compose build
# run images
$ docker compose up -d
- Регистрируемся на Auth0.
- Создаем приложение:
Applications
->Create Application
:Native
, заходим в созданное приложение и копируемClient ID
иClient Secret
. - Переходим в
Advanced Settings
->Grant Types
: толькоPassword
(Resource Owner Password Flow). - Переходим в
API
->Create API
:- Name:
Cinema Aggregator Service
; - Identifier:
http://store.romanow-alex.ru
; - Signing Algorithm: RS256.
- Name:
- Настраиваем хранилище паролей:
Settings
->Tenant Settings
->API Authorization Settings
:- Default Audience:
http://store.romanow-alex.ru
; - Default Directory:
Username-Password-Authentication
.
- Default Audience:
- Создаем тестового пользователя:
User Management
->Users
->Create User
:- Email:
[email protected]
; - Password:
Qwerty123
; - Connection:
Username-Password-Authentication
.
- Email:
После настройки у вас должен успешно выполняться запрос на проверку получение токена (подставить свои настройки):
curl --location --request POST 'https://romanowalex.eu.auth0.com/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode '[email protected]' \
--data-urlencode 'password=Qwerty123' \
--data-urlencode 'scope=openid' \
--data-urlencode 'client_id=<Client ID>' \
--data-urlencode 'client_secret=<Client Secret>'
В ответ получаем токен:
{
"access_token": "...",
"id_token": "...",
"scope": "openid profile email ...",
"expires_in": 86400,
"token_type": "Bearer"
}
$ brew install k6
$ k6 run \
--out influxdb=http://localhost:8086/k6 \
-e [email protected] \
-e PASSWORD=Qwerty123 \
-e CLIENT_ID=pXrawhpoDM63b82A7fkiLvRIH81wgmH9 \
-e CLIENT_SECRET=LzQSxUOE2dmAUdgstWke4ngXUeZNLVczvSid7ZVV8HTegCRbOxchQtJ_23EuZ9_V \
k6.js