Switch authentication to OAuth 2 #27

Merged
ansv7779 merged 6 commits from oauth2-login into develop 2024-12-16 16:55:49 +01:00
2 changed files with 9 additions and 0 deletions
Showing only changes of commit c3aeb32045 - Show all commits

View File

@ -2,6 +2,11 @@
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).

View File

@ -200,6 +200,10 @@ public class DataInitializer implements Lifecycle {
admin.addRole(Roles.SYSADMIN);
createBeta(admin);
passwordService.updatePassword(admin, "aey7ru8aefei0jaW2wo9eX8EiShi0aan");
Username defaultOAuth2Principal = new Username();
defaultOAuth2Principal.setUsername("dev@localhost");
defaultOAuth2Principal.setUser(admin);
save(defaultOAuth2Principal);
}
private void createBeta(User user) {