This project provides an authentication API to be used by other applications to identify their users.
- Spring authenticator
- Table of Contents
- Sources
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
The Spring Boot version currently used in this project is 3.3.5.
The project's environment must contain these tools. Make sure that your Windows or WSL environnment variables contain the path to Java.
It is recommanded to develop the app using docker. This is not a hard requirement but it's highly encouraged. For more info, head to the Docker section of this documentation.
- Docker Desktop
- Docker-compose
- On linux or WSL (allready included in Docker Desktop): Docker-buildx
This file is used by Docker to configure the containers. The environment variables defined in .env can be transmitted to the container and the Spring Boot app through the compose.yml file.
- DON'T modify the
env-distfile but make a copy of it in the root folder. - Rename your copied file to
.env. - If needed, change the values of the environment variables defined.
.env file defines :
- The environment (dev, test or prod)
- The port to use for the Spring Boot app container
- The dev or test database URL and credentials. Prod database informations should only be defined as environment variables in the production environment.
These files are used by Spring Boot to configure the application. They can contain hard coded values or use environment variables as values.
The application.properties file located in the root folder is git ignored and let's you define configurations specific to your local environment or informations that must not be synchronized in the GIT repository. Secret keys for example.
- DON'T modify the
application.properties-distfile but make a copy of it in the root folder. - Rename your copied file to
application.properties. - Open the file in you editor and set the configurations you want. They will override the configurations defined in the src/main/resources folder.
In this app, we use docker-compose, a Docker wrapper. It allows you and other programmers to work in a same development or testing environment, starting a database container and a Spring Boot app container wich are working together.
The main commands you'll have to use are described in the commands cheat-sheet sub-section.
First, you need to build the containers :
- Make sure
ENVIRONMENT=devis set in.env! - Open a terminal and go to your root folder
- If needed, reset containers and volumes (datas) with
docker compose down -v - Use the command
docker compose build - Now that the containers have been built, you can start them with
docker compose up
Note that each time you change the ENVIRONMENT variables, you need to use
the command docker compose build you can also use the short docker compose up --build command.
- Make sure
ENVIRONMENT=testis set in.env! - Open a terminal and go to your root folder
- If needed, reset containers and volumes (datas) with
docker compose down -v - In the root folder, use the command
docker compose build - Now that the containers have been built, you can start them with
docker compose up
To manipulate your application from within a container, you simply need to
enter it using the command docker exec -it <container name> sh.
You're now using the container's terminal.
As the tests are meant to run in a Docker environment, we have to skip them when creating a .jpa archive.
Use this command :
mvn clean package -DskipTests
Here is a list of the most common commands you'll likely use !
Build containers
docker compose build
Start containers
docker compose up
run in background
docker compose up -d
stop containers
docker compose down
stop containers and delete volumes, wich are containing app datas
docker compose down -v
Enter a container with shell
docker exec -it <container name> sh
Run the app
mvn spring-boot:run
Downloads all the dependencies without building or compiling the app
mvn dependency:resolve
Same as mvn dependency:resolve but displays the dependency tree
mvn dependency:tree
Removes the previously built artefacts and .JAR file
mvn clean
Build the project into a .JAR file
mvn package
Check if the project's structure is valid
mvn validate
The application contains an automated documentation from the Spring REST Docs package. The documentation is created when running the application in test environment.
It creates an index.adoc file in the "src/asciidoc" folder and an index.html page in the "docs" folder.
Link to the generated index.adoc : src/asciidoc/index.adoc
Link to the generated index.html : docs/index.html
Link to the doc on GitHub : https://orifinformatique.github.io/spring-auth/

