Space Auth is a lightweight authentication microservice written in Go, utilizing Gin as the web framework and Redis as the session store. It provides endpoints for user registration, login, logout, and session management.
- User registration with Argon2id password hashing.
- Secure login with password validation.
- Session management using Redis.
- REST API with JSON responses.
- Dockerized for deployment.
- Go 1.23 or later
- Redis server
- Docker (optional, for containerized deployment)
git clone [email protected]:mar-cial/space-auth.git
cd space-auth
go mod tidy
Set the required environment variable:
export REDIS_URL=redis://localhost:6379
go run cmd/main.go
docker build -t space-auth .
docker run -p 8080:8080 -e REDIS_URL=redis://your-redis-host:6379 space-auth
POST /register
{
"phonenumber": "+1234567890",
"password": "securepassword"
}
POST /login
{
"phonenumber": "+1234567890",
"password": "securepassword"
}
POST /logout
{
"token": "session-token"
}
space-auth/
├── cmd/main.go # Entry point
├── internal/
│ ├── adapter/
│ │ ├── handler/ # HTTP handlers
│ │ ├── repository/redis/ # Redis repository
│ ├── core/
│ │ ├── domain/ # Domain entities
│ │ ├── port/ # Interfaces
│ │ ├── service/ # Business logic
├── templates/ # HTML templates
├── Dockerfile # Docker configuration
├── go.mod # Go module file
This project is licensed under the MIT License.