Improve gateway service 2
This commit is contained in:
39
scripts/test_unified_auth.sh
Executable file
39
scripts/test_unified_auth.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Testing Unified Authentication System"
|
||||
|
||||
# 1. Get auth token
|
||||
echo "1. Getting authentication token..."
|
||||
TOKEN=$(curl -s -X POST http://localhost:8000/api/v1/auth/login \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"email": "test@bakery.com", "password": "testpass123"}' \
|
||||
| jq -r '.access_token')
|
||||
|
||||
echo "Token obtained: ${TOKEN:0:20}..."
|
||||
|
||||
# 2. Test data service through gateway
|
||||
echo -e "\n2. Testing data service through gateway..."
|
||||
curl -s -X GET http://localhost:8000/api/v1/data/sales \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "X-Tenant-ID: test-tenant" \
|
||||
| jq '.'
|
||||
|
||||
# 3. Test training service through gateway
|
||||
echo -e "\n3. Testing training service through gateway..."
|
||||
curl -s -X POST http://localhost:8000/api/v1/training/jobs \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "X-Tenant-ID: test-tenant" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"include_weather": true,
|
||||
"include_traffic": false,
|
||||
"min_data_points": 30
|
||||
}' \
|
||||
| jq '.'
|
||||
|
||||
# 4. Test direct service call (should work with headers)
|
||||
echo -e "\n4. Testing direct service call..."
|
||||
curl -s -X GET http://localhost:8002/health \
|
||||
| jq '.'
|
||||
|
||||
echo -e "\nUnified authentication test complete!"
|
||||
Reference in New Issue
Block a user