This is my example project for a Spring Boot REST API for a CRUD-style application w/ added Spring Security.
It follows Thomas Gleason's blog tutorial.
For docker setup, run:
docker-compose build && docker-compose up
Spin down with:
docker-compose down
The bcrypt hashing function is used for the encryption of User passwords.
To encrypt the password in the seed data for MongoDB (in dockerfiles/seed-data.js
),
the devglan online bcrypt hash generator was used
to create the encrypted version of the password.
The default username and password are are:
- username:
erugh
- password:
dontflop
To create the authorization header token, use the following command to generate the token:
echo -n "<username>:<password>" | base64
Thus, for the defaults, you would get the token ZXVyZ2g6ZG9udGZsb3A=
from:
echo -n "eurgh:dontflop" | base64
Example using the default username and password token (lists all current Rappers):
curl --request GET --header "Authorization: Basic ZXVyZ2g6ZG9udGZsb3A=" http://bigbird.ornl.gov:8080/rappers
Setup was created using Spring Initializr
- Spring Boot
- Spring WEB
- Spring Security
- MongoDB
For further reference, please consider the following sections:
- Official Apache Maven documentation
- Spring Boot Maven Plugin Reference Guide
- Create an OCI image
- Spring Web
- Spring Data JPA
The following guides illustrate how to use some features concretely: