FinMan Auth Service is a microservice responsible for handling authentication and JWT token management. This service provides functionalities to create tokens based on user credentials and validates tokens for authentication if required. Please note that the default username and password is admin.
- Go 1.22 or higher
- Docker
Create a .env
file in the root directory of the project and add the following environment variables:
# .env
JWT_SECRET=eDM!":jmx2/QoHBlY'.O8e4?Uy,",9
JWT_EXPIRE_MINUTE=20
PORT=8080
IP=0.0.0.0
-
Clone the repository:
git clone https://github.com/your-username/finman-auth-service.git cd finman-auth-service
-
Install dependencies:
go mod download
You can run the service locally using the following command:
go run main.go
Alternatively, you can run the service using Docker:
-
Build the Docker image:
docker build -t finman-auth-service .
-
Run the Docker container:
docker run --env-file .env -p 8080:8080 finman-auth-service
The service uses the following environment variables:
JWT_SECRET
: The secret key used to sign the JWT tokens.JWT_EXPIRE_MINUTE
: The expiration time for JWT tokens in minutes.PORT
: The port on which the service will run.IP
: The IP address on which the service will bind.
You can run the tests using the following command:
go test ./...
For testing with Docker, use the following command:
docker build -t finman-auth-service-test -f Dockerfile.test .
docker run --env-file .env finman-auth-service-test