scipro/README.md
Andreas Svanberg ccac2c1cf8
All checks were successful
Build and test / build-and-test (push) Successful in 6m54s
Enable creating an API using Spring Web (#5)
SciPro will have to provide information to the upcoming student portal. Wicket does not have the ability to serve JSON in the usual REST way and is only able to serve HTML. The most common way to write JSON over HTTP API:s in Java is using Spring Web, but currently SciPro uses Guice for dependency injection rather than Spring which makes adding Spring Web a bit more tricky.

This pull request attempts to solve this by doing the following;
* Replacing Guice with Spring
* Adding a new API module that uses Spring Web
* Turning the entire system into a standard Spring Boot web application

The hope is that these changes will bring the following benefits;
* Harmonize our web stack (Daisy uses Spring and the new lecture hall system is full Spring Boot)
* Enable easy development of a traditional JSON over HTTP API
* Ease future recruitment by using the most common Java web frameworks

Reviewed-on: #5
Reviewed-by: niat8586 <nico@dsv.su.se>
Co-authored-by: Andreas Svanberg <andreass@dsv.su.se>
Co-committed-by: Andreas Svanberg <andreass@dsv.su.se>
2024-11-06 11:23:28 +01:00

940 B

Working with the API

The API is protected by OAuth 2 acting as a resource server verifying tokens using token introspection.

When developing it uses a locally running instance of an authorization server that is run inside Docker. It can be started with docker compose -f docker-compose.yml up. Since there is no frontend to interact with the authorization server there's a helper script in GetToken.java that can be run directly with java GetToken.java to run through the authorization flow and get an access token.

Once the token has been obtained go to the Swagger UI to interact with the API. Click the "Authorize" button in the top right and paste the access token to log in.