Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge config.properties and application.properties #76

Merged
merged 4 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Frontend of the application is developed separately.

The setup requires the following steps:
1) configure the application according to [Setup Guide](setup.md)
2) configure `config.properties` to contain `security.sameSite=None`
2) configure `application.properties` to contain `security.sameSite=None`
This is important if you are running the application over HTTP so
web browser would not block requests to the server due to CORS policy.
3) build the backend `mvn clean package`
Expand Down
4 changes: 2 additions & 2 deletions doc/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

### Application Configuration

The application uses `src/main/resources/config.properties` to configure:
The application uses `src/main/resources/application.properties` to configure:
* connection to internal triple store
* REST endpoint of Form service
* SMTP configuration for sending emails
Expand Down Expand Up @@ -54,7 +54,7 @@ SForms service is configured in `formGenServiceUrl`, the call to the service sho
### OpenID Connect Authentication

RecordManager can work with an external authentication service implementing the OpenID Connect protocol. To use it,
set the `security.provider` (in `config.properties` or via `SECURITY_PROVIDER` via an environment variable) configuration to `oidc`
set the `security.provider` (in `application.properties` or via `SECURITY_PROVIDER` via an environment variable) configuration to `oidc`
and configure the `spring.security.oauth2.resourceserver.jwt.issuer-uri` (in `application.properties` or using an environment variable)
parameter to the URI of the OAuth2 token issuer. When using Keycloak, this corresponds to the URI of the realm through
which Record Manager users authenticate their requests. For example, the value may be `http://localhost:8080/realms/record-manager`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.springframework.context.annotation.PropertySource;

@SpringBootApplication
@PropertySource("classpath:config.properties")
public class RecordManagerApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/cz/cvut/kbss/study/util/ConfigParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -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("security.oidc.roleClaim"),

CORS_ALLOWED_ORIGINS("security.cors.allowedOrigins"),
Expand Down
69 changes: 68 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,69 @@
server.servlet.context-path=/record-manager
management.endpoints.web.exposure.include=health
management.endpoints.web.exposure.include=health

# 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
[email protected]
# 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=<div><p>Dear user {{username}}, </p><p>please set your new password here: {{link}} </p><p>Best regards, <br>StudyManager</p></div>

# UserInvite email subject
email.invitationSubject=Welcome to study
# UserInvite email html content, variables: username, link, name, appContext
email.invitationContent=<div><p>Dear {{name}}, </p><p>you have been invited to a study running at {{appContext}}. </p><p>Your username is: {{username}}. </p>\
<p>Please set your password here: {{link}} </p><p>Best regards, <br>StudyManager</p></div>

# Password change email
email.passwordChangeSubject=Password Change
# PasswordReset email html content, variables: username, appContext
email.passwordChangeContent=<div><p>Dear user {{username}}, </p><p>your password has been changed. </p><p>Best regards, <br>RecordManager</p></div>

# Profile update email
email.profileUpdateSubject=Profile updated by a study coordinator
# PasswordReset email html content, variables: username, appContext
email.profileUpdateContent=<div><p>Dear user {{username}}, </p><p>your profile at {{appContext}} has been updated by a study coordinator. </p><p>Best regards, <br>RecordManager</p></div>

# 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
security.oidc.roleClaim=realm_access.roles

# Configures allowed origins for CORS (e.g. http://localhost:3000). Use a comma to separate multiple values
security.cors.allowedOrigins=

records.allowedRejectReason=true
66 changes: 0 additions & 66 deletions src/main/resources/config.properties

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.springframework.core.env.Environment;

@Configuration
@PropertySource("classpath:config.properties")
@PropertySource("classpath:application.properties")
@Profile("test")
public class TestFormGenPersistenceFactory {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
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
formGenRepositoryUrl=test-formGen-repository

repositoryUrl=study-test-repository

driver=cz.cvut.kbss.ontodriver.rdf4j.Rdf4jDataSource

formGenRepositoryUrl=test-formGen-repositor\
y
formGenServiceUrl=http://localhost:8081/formGenerator
Loading