diff --git a/README.md b/README.md index 9b7365f3..dcdb932b 100644 --- a/README.md +++ b/README.md @@ -185,12 +185,22 @@ For those wanting to use Stirling-PDFs backend API to link with their own custom [here](https://app.swaggerhub.com/apis-docs/Frooodle/Stirling-PDF/) or navigate to /swagger-ui/index.html of your stirling-pdf instance for your versions documentation (Or by following the API button in your settings of Stirling-PDF) +## Login authentication (CURRENTLY ALPHA TAG ONLY) +###Prerequisites: +- User must have the folder ./configs volumed within docker so that it is retained during updates. +- The environment variable 'login.enabled' must be set to true +- The environment variables "INITIAL_USERNAME" and "INITIAL_PASSWORD" must also be populated (only required on first boot to create initial user, ignored after.) + +One the above has been done on restart a new stirling-pdf-DB.mv.db will show if everything worked. +When you login to stirling PDF you will be redirected to /login page to login. After that everything should function as normal +To access login settings go to Account settings in the settings cog (top right in navbar) this is also where you find your API key. +To add new users go to bottom of Account settings and hit 'Admin Settings', here you can add new users. +For API usage you must provide a header with 'X-API-Key' and the associated API key for that user. + + ## FAQ -### Q1: Can you add authentication in Stirling PDF? -There is no Auth within Stirling PDF and there is none planned. This feature will not be added. Instead we recommended you use trusted and secure authentication software like Authentik or Authelia. - -### Q2: What are your planned features? +### Q1: What are your planned features? - Crop - Progress bar/Tracking - Full custom logic pipelines to combine multiple operations together. @@ -201,5 +211,5 @@ There is no Auth within Stirling PDF and there is none planned. This feature wil - URL to PDF - Change contrast -### Q3: Why is my application downloading .htm files? +### Q2: Why is my application downloading .htm files? This is a issue caused commonly by your NGINX congifuration. The default file upload size for NGINX is 1MB, you need to add the following in your Nginx sites-available file. client_max_body_size SIZE; Where "SIZE" is 50M for example for 50MB files. diff --git a/src/main/java/stirling/software/SPDF/config/security/InitialSetup.java b/src/main/java/stirling/software/SPDF/config/security/InitialSetup.java index bf0d694e..d1d286dc 100644 --- a/src/main/java/stirling/software/SPDF/config/security/InitialSetup.java +++ b/src/main/java/stirling/software/SPDF/config/security/InitialSetup.java @@ -20,9 +20,7 @@ public class InitialSetup { if(initialUsername != null && initialPassword != null) { userService.saveUser(initialUsername, initialPassword, Role.ADMIN.getRoleId()); } - else { - userService.saveUser("admin", "password", Role.ADMIN.getRoleId()); - } + } } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index e52f939e..20638f7d 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -20,7 +20,7 @@ server.error.include-message=always #logging.level.org.springframework=DEBUG #logging.level.org.springframework.security=DEBUG -login.enabled=true +#login.enabled=true server.servlet.session.tracking-modes=cookie server.servlet.context-path=${APP_ROOT_PATH:/} @@ -38,7 +38,7 @@ spring.resources.static-locations=file:customFiles/static/ #spring.thymeleaf.cache=false -spring.datasource.url=jdbc:h2:file:./mydatabase;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE +spring.datasource.url=jdbc:h2:file:./configs/stirling-pdf-DB;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE spring.datasource.driver-class-name=org.h2.Driver spring.datasource.username=sa spring.datasource.password=