This is a simple Go application that exposes an HTTP endpoint for user authentication. It uses SQLite to store user credentials and verifies the username and password against the database.
- Exposes a single HTTP endpoint
/auth
for authentication. - Validates user credentials stored in an SQLite database.
- Reads user credentials from a CSV file to populate the database.
- Performs double-check user/password verification.
-
Clone the repository:
git clone https://github.com/forkbombeu/plain_auth_service.git cd plain_auth_service
-
Install the required Go packages:
go mod tidy
- Run the application:
go run main.go
The server will start on localhost:8080
.
Send a POST request to the /auth
endpoint with a JSON body containing the username and password.
Example:
curl http://test.auth.forkbomb.eu:8080/auth \
-d '{"username":"admin", "password":"admin123"}'
{
"address": "http://test.auth.forkbomb.eu:8080/auth",
"auth": {
"username":"admin",
"password":"admin123"
}
}
Rule unknown ignore
Given I connect to 'address' and send object 'auth' and do post and output into 'result'
Given I have a 'string dictionary' named 'result'
Then print the 'result'
slexfe -F auth | slangroom-exec | jq
expected output:
{
"result": {
"result": "Success",
"status": "200"
}
}
200 OK
with messageSuccess
if the credentials are correct.401 Unauthorized
if the credentials are incorrect.
Unlicensed, and written in 5min with the help of AI generated creative content