Merge pull request #18 from azuki774/add-jwt #91
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- "**" | |
workflow_call: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.21.0 | |
- name: Test | |
run: make test | |
- name: Build | |
run: make bin | |
scenario-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.21.0 | |
- name: Build | |
run: make bin | |
- name: Running Server | |
run: | | |
nohup bin/go-simple-auth-proxy start --config deployment/ci.toml > server.log & | |
sleep 5s | |
env: | |
HMAC_SECRET: mokomoko | |
- name: Scenario 1 (No cookie or basicauth) - 401 | |
run: | | |
curl -I -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' http://localhost:8080 > output.log | |
grep 'HTTP/1.1 401 Unauthorized' output.log | |
curl -I -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' http://localhost:8080 > output.log | |
grep 'HTTP/1.1 401 Unauthorized' output.log | |
- name: Scenario 2 (no cookie, basicauth) - 200 | |
run: | | |
curl -I -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' -u user:pass http://localhost:8080 > output.log | |
curl -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' -u user:pass http://localhost:8080 >> output.log | |
grep 'HTTP/1.1 200 OK' output.log | |
grep '<title>Welcome to nginx!</title>' output.log | |
- name: Scenario 3 (save cookie, no cookie, basicauth) - 200 | |
run: | | |
curl -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' -I -u user:pass -c cookie.txt http://localhost:8080 > output.log | |
curl -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' -u user:pass http://localhost:8080 >> output.log | |
grep 'HTTP/1.1 200 OK' output.log | |
grep '<title>Welcome to nginx!</title>' output.log | |
- name: Scenario 4 (No cookie or basicauth) - 401 | |
run: | | |
curl -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' -I http://localhost:8080 > output.log | |
grep 'HTTP/1.1 401 Unauthorized' output.log | |
curl -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' -I http://localhost:8080 > output.log | |
grep 'HTTP/1.1 401 Unauthorized' output.log | |
- name: Scenario 5 (use cookie, no basicauth) - 200 | |
run: | | |
curl -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' -I -b cookie.txt http://localhost:8080 > output.log | |
curl -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' -b cookie.txt http://localhost:8080 >> output.log | |
grep 'HTTP/1.1 200 OK' output.log | |
grep '<title>Welcome to nginx!</title>' output.log | |
- name: Show Server log | |
run: cat server.log | |
if: ${{ ! cancelled() }} | |
services: | |
nginx-app: | |
image: nginx:latest | |
ports: | |
- 8888:80 |