Goals
- Implement a secure API using the JSON Web Token open standard (RFC 7519).
- Consume the API from a React JS application.
-
Clone this repository. Compile and run the Spring Boot project.
-
Verify that authentication works by issuing the following command from the console:
This only works in Java 8 If Java 11 is used, I get this error
With Java 8
- Open the following url and try to understand the message you get from the server:
http://localhost:8080/api/test
Then try to locate the code fragment where the exception is thrown.
- Comment the line 13 @Bean on the SpringBootSecureApiApplication class. Re-run the project and go to the endpoint again:
http://localhost:8080/api/test
Why do you think it works now? Discuss your findings with your classmates.
- Works because the security for the path api/* was disabled
- Implement the logic to verify the user's credentials on the UserController and the UserServiceImpl classes.
-
Add the TaskController and services implemented on the previous lab. Ensure the endpoints are exposed under the /api path.
-
Verify that your implementation secures all the exposed methods under the /api path in your API.
Done
- Make a first request to the API to authenticate on the method componentDidMount():
Done
Done