Compare commits
1 Commits
c6d34f87d7
...
d1ce242dc9
| Author | SHA1 | Date | |
|---|---|---|---|
| d1ce242dc9 |
30
.github/workflows/test.yml
vendored
30
.github/workflows/test.yml
vendored
@@ -204,11 +204,25 @@ jobs:
|
||||
run: |
|
||||
echo "Testing unauthenticated JMAP endpoint..."
|
||||
|
||||
# Call without authentication
|
||||
JMAP_RESPONSE=$(curl -sf "http://localhost:8080/.well-known/jmap")
|
||||
# Call without authentication (follow redirects with -L)
|
||||
HTTP_CODE=$(curl -s -L \
|
||||
-o /tmp/jmap_response_no_auth.json \
|
||||
-w "%{http_code}" \
|
||||
"http://localhost:8080/.well-known/jmap")
|
||||
|
||||
echo "HTTP Status Code: $HTTP_CODE"
|
||||
echo "JMAP Response:"
|
||||
cat /tmp/jmap_response_no_auth.json
|
||||
|
||||
# Check if request succeeded
|
||||
if [ "$HTTP_CODE" != "200" ]; then
|
||||
echo "::error::JMAP endpoint returned HTTP $HTTP_CODE for unauthenticated request"
|
||||
cat /tmp/jmap_response_no_auth.json || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify username is empty (no authentication)
|
||||
USERNAME=$(echo "$JMAP_RESPONSE" | jq -r '.username // empty')
|
||||
USERNAME=$(cat /tmp/jmap_response_no_auth.json | jq -r '.username // empty')
|
||||
|
||||
if [ -z "$USERNAME" ]; then
|
||||
echo "✓ Unauthenticated access returns empty username"
|
||||
@@ -221,13 +235,15 @@ jobs:
|
||||
echo "Testing user authentication via JMAP endpoint..."
|
||||
|
||||
# Test user1@test1.local authentication (follow redirects with -L)
|
||||
HTTP_CODE=$(curl -s -L -o /tmp/jmap_response.json -w "%{http_code}" \
|
||||
HTTP_CODE=$(curl -s -L \
|
||||
-o /tmp/jmap_response_auth.json
|
||||
-w "%{http_code}" \
|
||||
-u "user1@test1.local:UserPass123!" \
|
||||
"http://localhost:8080/.well-known/jmap")
|
||||
|
||||
echo "HTTP Status Code: $HTTP_CODE"
|
||||
echo "JMAP Response:"
|
||||
cat /tmp/jmap_response.json | jq '.' || cat /tmp/jmap_response.json
|
||||
cat /tmp/jmap_response_auth.json
|
||||
|
||||
# Check if request succeeded
|
||||
if [ "$HTTP_CODE" != "200" ]; then
|
||||
@@ -236,7 +252,7 @@ jobs:
|
||||
fi
|
||||
|
||||
# Verify username field contains our test user
|
||||
USERNAME=$(cat /tmp/jmap_response.json | jq -r '.username // empty')
|
||||
USERNAME=$(cat /tmp/jmap_response_auth.json | jq -r '.username // empty')
|
||||
|
||||
if [ "$USERNAME" = "user1@test1.local" ]; then
|
||||
echo "✓ User authentication successful: $USERNAME"
|
||||
@@ -246,7 +262,7 @@ jobs:
|
||||
fi
|
||||
|
||||
# Verify accounts object is not empty (means user is authenticated)
|
||||
ACCOUNTS=$(cat /tmp/jmap_response.json | jq '.accounts // {}')
|
||||
ACCOUNTS=$(cat /tmp/jmap_response_auth.json | jq '.accounts // {}')
|
||||
if [ "$ACCOUNTS" != "{}" ]; then
|
||||
echo "✓ User has active accounts"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user