diff --git a/src/main/java/cz/cvut/kbss/study/RecordManagerApplication.java b/src/main/java/cz/cvut/kbss/study/RecordManagerApplication.java index df496f36..28ae6281 100644 --- a/src/main/java/cz/cvut/kbss/study/RecordManagerApplication.java +++ b/src/main/java/cz/cvut/kbss/study/RecordManagerApplication.java @@ -5,7 +5,6 @@ import org.springframework.context.annotation.PropertySource; @SpringBootApplication -@PropertySource("classpath:config.properties") public class RecordManagerApplication { public static void main(String[] args) { diff --git a/src/main/java/cz/cvut/kbss/study/persistence/FormGenPersistenceFactory.java b/src/main/java/cz/cvut/kbss/study/persistence/FormGenPersistenceFactory.java index bad6ff41..0bab5333 100644 --- a/src/main/java/cz/cvut/kbss/study/persistence/FormGenPersistenceFactory.java +++ b/src/main/java/cz/cvut/kbss/study/persistence/FormGenPersistenceFactory.java @@ -19,7 +19,6 @@ import static cz.cvut.kbss.study.util.ConfigParam.FORM_GEN_REPOSITORY_URL; @Configuration -@PropertySource("classpath:config.properties") public class FormGenPersistenceFactory { private final Environment environment; diff --git a/src/main/java/cz/cvut/kbss/study/util/ConfigParam.java b/src/main/java/cz/cvut/kbss/study/util/ConfigParam.java index 0ee9caf6..96c0c2a9 100644 --- a/src/main/java/cz/cvut/kbss/study/util/ConfigParam.java +++ b/src/main/java/cz/cvut/kbss/study/util/ConfigParam.java @@ -39,6 +39,8 @@ public enum ConfigParam { E_PROFILE_UPDATE_SUBJECT("email.profileUpdateSubject"), E_PROFILE_UPDATE_CONTENT("email.profileUpdateContent"), + SECURITY_PROVIDER("security.provider"), + OIDC_ROLE_CLAIM("oidc.roleClaim"), CORS_ALLOWED_ORIGINS("cors.allowedOrigins"); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties deleted file mode 100644 index e43a0b0e..00000000 --- a/src/main/resources/application.properties +++ /dev/null @@ -1,2 +0,0 @@ -server.servlet.context-path=/record-manager -management.endpoints.web.exposure.include=health \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 00000000..264c692c --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,66 @@ +server: + servlet: + context-path: /record-manager + +# Driver to manage triple stores +driver: cz.cvut.kbss.ontodriver.rdf4j.Rdf4jDataSource + +# URL of repository that holds main data of the application +repositoryUrl: http://localhost:7200/repositories/record-manager-app + +# URL of repository where output and configuration of form-generator should be held +formGenRepositoryUrl: http://localhost:7200/repositories/record-manager-formgen + +# REST endpoint of form generator service +formGenServiceUrl: "http://localhost:8080/s-pipes/service?_pId=transform&sgovRepositoryUrl=https%3A%2F%2Fgraphdb.onto.fel.cvut.cz%2Frepositories%2Fkodi-slovnik-gov-cz" + +# Option to pass sameSite attribute for set-cookie headers. Possible values are None,Lax,Strict. +# In case of None value also attribute "Secure;" is added. +security: + sameSite: "" + + # Provider of application security + provider: internal + +# Url of the website for password reset emails (must have "/" at the end) +appContext: http://localhost:3000/record-manager + +# SMTP configuration +smtp: + host: smtp.gmail.com + port: 587 + user: recordmanager@gmail.com + password: AdminOrganization123 + +# Email settings +email: + displayName: Record Manager + from: "" + replyTo: "" + cc: "" + bcc: "" + + # Password Reset email configuration + passwordResetSubject: Password Reset + passwordResetContent: "

Dear user {{username}},

please set your new password here: {{link}}

Best regards,
StudyManager

" + + # User Invite email configuration + invitationSubject: Welcome to study + invitationContent: "

Dear {{name}},

you have been invited to a study running at {{appContext}}.

Your username is: {{username}}.

\ +

Please set your password here: {{link}}

Best regards,
StudyManager

" + + # Password Change email configuration + passwordChangeSubject: Password Change + passwordChangeContent: "

Dear user {{username}},

your password has been changed.

Best regards,
RecordManager

" + + # Profile Update email configuration + profileUpdateSubject: Profile updated by a study coordinator + profileUpdateContent: "

Dear user {{username}},

your profile at {{appContext}} has been updated by a study coordinator.

Best regards,
RecordManager

" + +# Claim containing user roles in the OIDC access token +oidc: + roleClaim: realm_access.roles + +# Configures allowed origins for CORS +cors: + allowedOrigins: "" diff --git a/src/main/resources/config.properties b/src/main/resources/config.properties deleted file mode 100644 index ce8e8d90..00000000 --- a/src/main/resources/config.properties +++ /dev/null @@ -1,64 +0,0 @@ -# Driver to manage triple stores -driver=cz.cvut.kbss.ontodriver.rdf4j.Rdf4jDataSource -# URL of repository that holds main data of the application -repositoryUrl=http://localhost:7200/repositories/record-manager-app -# URL of repository where output and configuration of form-generator should be held -formGenRepositoryUrl=http://localhost:7200/repositories/record-manager-formgen -# REST endpoint of form generator service -formGenServiceUrl=http://localhost:8080/s-pipes/service?_pId=transform&sgovRepositoryUrl=https%3A%2F%2Fgraphdb.onto.fel.cvut.cz%2Frepositories%2Fkodi-slovnik-gov-cz -# Option to pass sameSite attribute for set-cookie headers. Possible values are None,Lax,Strict. In case of None value also attribute "Secure;" is added. -security.sameSite= - -# Url of the website for password reset emails. e.g. https://study.com/ (must have "/" at the end) -appContext=http://localhost:3000/record-manager - -# SMTP host -smtp.host=smtp.gmail.com -# SMTP port -smtp.port=587 -# SMTP user -smtp.user=recordmanager@gmail.com -# SMTP password -smtp.password=AdminOrganization123 - -# Email display name -email.displayName=Record Manager -# if email.from is not entered, smtp.user is used instead -email.from= -# Email cc addresses where all invitations will be sent. For more use delimiter "," (can remain empty) -email.replyTo= -email.cc= -email.bcc= - -# You can use variables in email contents by using {{variable}}, available variables are listed before email content property -# Password Reset email subject -email.passwordResetSubject=Password Reset -# PasswordReset email html content, variables: username, link, appContext -email.passwordResetContent=

Dear user {{username}},

please set your new password here: {{link}}

Best regards,
StudyManager

- -# UserInvite email subject -email.invitationSubject=Welcome to study -# UserInvite email html content, variables: username, link, name, appContext -email.invitationContent=

Dear {{name}},

you have been invited to a study running at {{appContext}}.

Your username is: {{username}}.

\ -

Please set your password here: {{link}}

Best regards,
StudyManager

- -# Password change email -email.passwordChangeSubject=Password Change -# PasswordReset email html content, variables: username, appContext -email.passwordChangeContent=

Dear user {{username}},

your password has been changed.

Best regards,
RecordManager

- -# Profile update email -email.profileUpdateSubject=Profile updated by a study coordinator -# PasswordReset email html content, variables: username, appContext -email.profileUpdateContent=

Dear user {{username}},

your profile at {{appContext}} has been updated by a study coordinator.

Best regards,
RecordManager

- -# Provider of application security. Possible values are 'internal' for internally stored users and 'oidc' for using an -# OIDC-compatible authentication service. Its URL is configured via Spring Boot configuration parameters -security.provider=internal - -# Claim containing user roles in the OIDC access token (applies only when 'oidc' security provider is selected). Use -# dot notation for nested objects -oidc.roleClaim=realm_access.roles - -# Configures allowed origins for CORS (e.g. http://localhost:3000). Use a comma to separate multiple values -cors.allowedOrigins= \ No newline at end of file diff --git a/src/test/java/cz/cvut/kbss/study/persistence/TestFormGenPersistenceFactory.java b/src/test/java/cz/cvut/kbss/study/persistence/TestFormGenPersistenceFactory.java index c400b9c4..0e8df28b 100644 --- a/src/test/java/cz/cvut/kbss/study/persistence/TestFormGenPersistenceFactory.java +++ b/src/test/java/cz/cvut/kbss/study/persistence/TestFormGenPersistenceFactory.java @@ -16,7 +16,7 @@ import org.springframework.core.env.Environment; @Configuration -@PropertySource("classpath:config.properties") +@PropertySource("classpath:application.properties") @Profile("test") public class TestFormGenPersistenceFactory { diff --git a/src/test/java/cz/cvut/kbss/study/persistence/TestPersistenceFactory.java b/src/test/java/cz/cvut/kbss/study/persistence/TestPersistenceFactory.java index a8edbae9..0f36b125 100644 --- a/src/test/java/cz/cvut/kbss/study/persistence/TestPersistenceFactory.java +++ b/src/test/java/cz/cvut/kbss/study/persistence/TestPersistenceFactory.java @@ -24,7 +24,7 @@ import static cz.cvut.kbss.ontodriver.config.OntoDriverProperties.DATA_SOURCE_USERNAME; @Configuration -@PropertySource("classpath:config.properties") +@PropertySource("classpath:application.properties") @Profile("test") public class TestPersistenceFactory { diff --git a/src/test/resources/config.properties b/src/test/resources/application.properties similarity index 68% rename from src/test/resources/config.properties rename to src/test/resources/application.properties index ed9a2eec..4a82a326 100644 --- a/src/test/resources/config.properties +++ b/src/test/resources/application.properties @@ -1,7 +1,9 @@ test.repositoryUrl=study-test-repository -repositoryUrl=study-test-repository test.driver=cz.cvut.kbss.ontodriver.rdf4j.Rdf4jDataSource -driver=cz.cvut.kbss.ontodriver.rdf4j.Rdf4jDataSource test.formGenRepositoryUrl=test-formGen-repository + +repositoryUrl=study-test-repository + formGenRepositoryUrl=test-formGen-repository -formGenServiceUrl=http://localhost:8081/formGenerator \ No newline at end of file + +formGenServiceUrl=http://localhost:8081/formGenerator