Skip to content

Commit

Permalink
Remove incorrect Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
emil-jacero committed Jun 23, 2024
1 parent 7162b3c commit b752dd1
Showing 1 changed file with 2 additions and 53 deletions.
55 changes: 2 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ The service requires the following environment variables to be set:
To build the Docker image, run:

```sh
docker build -t auth-service .
make docker-build
```

### Run the Container

To run the container with the required environment variables, use:

```sh
docker run -e AUTH_USERNAME=testuser -e AUTH_PASSWORD=testpassword -p 9001:9001 auth-service
docker run -e AUTH_USERNAME=testuser -e AUTH_PASSWORD=testpassword -p 9001:9001 grpc-basic-auth
```

Replace testuser and testpassword with your desired credentials.
Expand All @@ -41,58 +41,7 @@ Replace testuser and testpassword with your desired credentials.
To test the service without an Authorization header, run:

```sh
curl -v http://localhost:9001/
```

You should receive a 403 Forbidden response.

#### With Authorization Header

To test the service with a valid Authorization header, run:

```sh
curl -v -H "Authorization: Bearer testuser:testpassword" http://localhost:9001/
```

You should receive a 200 OK response if the credentials are valid.

#### Example Test Script

You can use the following script to automate testing:

```sh
#!/bin/bash

echo "Testing without Authorization header..."
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:9001/)
if [ "$response" -eq 403 ]; then
echo "PASS: Received 403 Forbidden without Authorization header"
else
echo "FAIL: Expected 403 Forbidden but received $response"
fi

echo "Testing with valid Authorization header..."
response=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Bearer testuser:testpassword" http://localhost:9001/)
if [ "$response" -eq 200 ]; then
echo "PASS: Received 200 OK with valid Authorization header"
else
echo "FAIL: Expected 200 OK but received $response"
fi

echo "Testing with invalid Authorization header..."
response=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Bearer invalidtoken" http://localhost:9001/)
if [ "$response" -eq 403 ]; then
echo "PASS: Received 403 Forbidden with invalid Authorization header"
else
echo "FAIL: Expected 403 Forbidden but received $response"
fi
```

Save this script to a file (e.g., test.sh), make it executable, and run it:

```sh
chmod +x test.sh
./test.sh
```

## Code Structure
Expand Down

0 comments on commit b752dd1

Please sign in to comment.