https://github.com/vladimirfomene/movie-api
Secured Spring WebFlux API With Auth0
https://github.com/vladimirfomene/movie-api
auth0 mongodb spring webflux
Last synced: 2 months ago
JSON representation
Secured Spring WebFlux API With Auth0
- Host: GitHub
- URL: https://github.com/vladimirfomene/movie-api
- Owner: vladimirfomene
- Created: 2018-11-09T03:40:19.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-23T09:22:29.000Z (over 7 years ago)
- Last Synced: 2025-02-24T15:49:22.093Z (over 1 year ago)
- Topics: auth0, mongodb, spring, webflux
- Language: Java
- Size: 62.5 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# REST API with Spring WebFlux
## IDE and Tools
* I used Intellij IDE to develop this sample application.
* I created a skeleton of the project from [Spring Boot's bootstrap site](https://start.spring.io/)
* Specified Gradle as my build system and selected Security, Reactive Web, Reactive MongoDB and Embedded MongoDB for my dependencies.
## App Dependencies
* This app depends on Spring's Security, Reactive Web, Reactive MongoDB, Embedded MongoDB, `spring-security-oauth2-jose`
and `spring-security-oauth2-resource-server`.
## App Components
* Created a representation of the API on Auth0 and secured it using Auth0's Authorization server.
* REST API implemented using the Spring WebFlux API and Annotated Controllers.
## Running the App
Run the app from a terminal by issuing the following command:
```bash
./gradlew bootRun
```
## Testing the application
Make sure you have `Curl` or `Postman` installed to test the endpoints of the API.
* To get all the movies from the API run the following command:
```bash
curl -v -X GET http://localhost:8080/movies
```
* To get a particular movie from the API.
```bash
curl -v -X GET http://localhost:8080/movies/{id}
```
where id corresponds to the `id` of anyone of the movie entries you got as result from the first request.
* To update a particular movie from the API.
```bash
curl -v -H "Authorization: Bearer " -H "Content-Type: application/json" -X PUT -d
'{
"id": "",
"name": "",
"releaseDate": ""
}' http://localhost:8080/movies/{id}
```
where id corresponds to the `id` of anyone of the movie entries you got as result from the first request.
* To delete a particular movie from the API.
```bash
curl -v -H "Authorization: Bearer " -X DELETE http://localhost:8080/movies/{id}
```
where id corresponds to the `id` of anyone of the movie entries you got as result from the first request.
* Finally, to delete all the movies from the API.
```bash
curl -v -H "Authorization: Bearer " -X DELETE http://localhost:8080/movies
```
where id corresponds to the `id` of anyone of the movie entries you got as result from the first request.