This project is a Spring Boot application that provides a service for generating unique user IDs. It's designed to be used in a microservices architecture where a central service is needed to manage and distribute unique identifiers.
The application exposes a RESTful API for generating UIDs and is secured using Bearer Token authentication. It leverages an LDAP directory to ensure that the generated UIDs do not conflict with existing user IDs.
Key Technologies:
- Framework: Spring Boot
- Language: Java 21
- Security: Spring Security with Bearer Token authentication
- Directory Service: LDAP (via UnboundID LDAP SDK)
- API Documentation: SpringDoc OpenAPI
- Java 21
- Apache Maven
To build the project, run the following command from the project root directory:
mvn clean packageThis will generate a JAR file in the target directory.
To run the application, use the following command:
java -jar target/l9g-uidgen.jarThe application will start on the port configured in src/main/resources/application.yaml.
The application is configured using the config.yaml and secret.bin files. These files should be placed in the same directory as the JAR file.
config.yaml:
This file contains the main configuration for the application, including the LDAP connection details and the UID generation parameters.
secret.bin:
This file contains the encrypted secrets used by the application, such as the LDAP password and the bearer tokens.
To generate a new bearer token, you can use the -g command-line option:
java -jar target/l9g-uidgen.jar -gTo encrypt a value for use in the configuration, you can use the -e command-line option:
java -jar target/l9g-uidgen.jar -e "my-secret-value"- Code Style: The project follows the standard Java coding conventions.
- Dependencies: Project dependencies are managed using Maven.
- API Documentation: The RESTful API is documented using SpringDoc OpenAPI. You can access the OpenAPI UI at
/swagger-ui.htmland the OpenAPI specification at/v3/api-docs.