Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/laurosilveira/alura-flix-api

This is a REST API with aim to learning about new features of Spring security with JWT from Spring version 6.
https://github.com/laurosilveira/alura-flix-api

docker-image java jwt-token mongodb rest-api spring-boot spring-security

Last synced: 5 days ago
JSON representation

This is a REST API with aim to learning about new features of Spring security with JWT from Spring version 6.

Awesome Lists containing this project

README

        

# alura-flix-api

This is an application with aim to learning about new features of Spring security from Spring version 6.
The application is available at:
[https://alura-flix-api-production.up.railway.app](https://alura-flix-api-production.up.railway.app/swagger-ui/index.html)

## About this project
* [About](#about)
* [Technologies](#Technologies)
* [Generate Swagger with openApi]()
* [How to run](#how-to-run)
* [Run with Docker](#run-with-docker-compose)
* [Run with mvn spring-boot:run]()
* [Authentication](#login)
* [Contributors](#contributors)

# About
This is an application with aim to learning about new features of Spring security from Spring version 6.
It is possible to access swagger documentation through url: [https://alura-flix-api-production.up.railway.app](https://alura-flix-api-production.up.railway.app/swagger-ui/index.html)

The username for test is: [email protected] and the password is: 123456, please notice this user has ROLE_USER.

![alura-flix-api-swagger.png](data/alura-flix-api-swagger.png)

# Technologies
- Java 17
- Spring boot 3
- Spring 6
- MongoDB Atlas
- Lombok
- Spring Security
- JWT Token library
- Docker
- Junit, Mockito
- Jacoco Report

# Generate swagger with openApi

In order to generate swagger openApi without run the application, you can execute

```shell
mvn verify
```

This will generate the swaager on directory /src/main/resources/swagger

# How to Run
### Run with docker-compose
#### Before run with docker-compose - Necessary set up environments

There's two environments variables tha should be setup:

```yaml
- JWT_SECRET=${JWT_SECRET}
- DATABASE_PRO=${DATABASE_PRO}
```

After that it is possible to run just executing docker-compose.yml this will download the latest version

```shell
docker-compose up
```

### Run with mvn spring-boot
```shell
mvn spring-boot:run
```
#### Login

In the authentication-controller use the credentials


username: [email protected] / password: 123456 to log in.

![login.png](data/login.png)

After that copy the Token JWT

![token-jwt.png](data/token-jwt.png)

And paste it in the Authorize button

![authorize-token.png](data/authorize-token.png)

That's it, you are already logged and can try out all endpoints :wink:

## Contributors
[@LauroSilveira](https://github.com/LauroSilveira)

Fell free to fork and contribute :wink: