marshallmcdonnell / spring-rest-api-mongodb-security

Spring REST API with Spring Security using MongoDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spring REST API Example for DF Rappers using MongoDB and Spring Security

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.

Getting Started

For docker setup, run:

docker-compose build && docker-compose up

Spin down with:

docker-compose down

Security

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

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

Stack / Tools

Setup was created using Spring Initializr

  • Spring Boot
    • Spring WEB
    • Spring Security
  • MongoDB

Reference Documentation

For further reference, please consider the following sections:

Guides

The following guides illustrate how to use some features concretely:

About

Spring REST API with Spring Security using MongoDB

License:GNU General Public License v3.0


Languages

Language:Java 94.2%Language:JavaScript 5.8%