Andreas Svanberg
323d6fc61e
All checks were successful
Build and test / build-and-test (push) Successful in 21m10s
Click link and see that system is working. Log in using the principal `admin@example.com`. Change something in the deployed system. Re-run the action. See that the database has reset. **Major change** Added OAuth 2 login so no longer need modified web.xml with filter. Run `docker compose up` to start the local OAuth 2 authorization server to log in. Use the custom ticket form and enter the username you want to log in as in the "Principal" field. Squashed all migrations since there are faulty ones that can't be applied to an empty database. Reviewed-on: #15 Reviewed-by: Tom Zhao <tom.zhao@dsv.su.se> Co-authored-by: Andreas Svanberg <andreass@dsv.su.se> Co-committed-by: Andreas Svanberg <andreass@dsv.su.se>
52 lines
2.9 KiB
Markdown
52 lines
2.9 KiB
Markdown
## Working with the web GUI (Wicket)
|
|
The web GUI is protected by OAuth 2 log in. Run the Docker Compose containers with
|
|
`docker compose up` to start the authorization server to be able to log in.
|
|
|
|
If you run SciPro in development mode (DEV profile) you will be able to log in
|
|
as the "default" OAuth 2 user populated in the upper form. If you have other
|
|
data in your database you will have to use the lower form and specify a valid
|
|
username in the principal field.
|
|
|
|
## Working with the API
|
|
The API is protected by OAuth 2 acting as a [resource server](https://www.oauth.com/oauth2-servers/the-resource-server/)
|
|
verifying tokens using [token introspection](https://datatracker.ietf.org/doc/html/rfc7662).
|
|
|
|
When developing it uses a locally running instance of an
|
|
[authorization server](https://datatracker.ietf.org/doc/html/rfc6749#section-1.1)
|
|
that is run inside [Docker](https://www.docker.com). 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](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](http://localhost:8080/api/swagger) to interact with the API.
|
|
Click the "Authorize" button in the top right and paste the access token to log in.
|
|
|
|
## Code formatting
|
|
This project uses [prettier-java](https://github.com/jhipster/prettier-java)
|
|
to format all Java code. To reformat the code run
|
|
`./mvnw validate frontend:npm@reformat -pl .`.
|
|
Yes it's a mouthful but unfortunately the [prettier-maven-plugin](https://github.com/HubSpot/prettier-maven-plugin)
|
|
does not work due to an [outstanding issue](https://github.com/HubSpot/prettier-maven-plugin/issues/79).
|
|
|
|
The formatting is validated by CI, but you should do it beforehand with a simple `./mvnw verify -pl .`.
|
|
|
|
### Making IntelliJ format for you
|
|
For this to work you also need to have [Node.js](https://nodejs.org)
|
|
installed and configured under `Settings -> Language & Frameworks -> Node.js`
|
|
and the file you're saving *must* be able to compile otherwise no formatting
|
|
can be performed.
|
|
|
|
Go to `Settings -> Language & Frameworks -> JavaScript -> Prettier` and then check
|
|
`Automatic Prettier Configuration`, set `Run for files` to `**/*.{java}`,
|
|
and finally check `Run on save`.
|
|
|
|
## Test servers
|
|
All pull requests are automatically deployed to a test server.
|
|
The URL to the test server will be posted as a comment in the pull request once deployed.
|
|
|
|
Prepare test data in the `DataInitializer` class to help others test your changes.
|
|
Document (in the pull request) which users to log in as and what to do to see the changes.
|
|
|
|
If you want to reset the data to its original state you can re-run the "deploy-branch.yaml"
|
|
workflow at https://gitea.dsv.su.se/DMC/scipro/actions for the branch you want to reset.
|