diff --git a/pom.xml b/pom.xml
index 4b71f31f..99def859 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,7 +12,7 @@
org.springframework.boot
spring-boot-starter-parent
- 2.1.0.RELEASE
+ 2.3.0.RELEASE
jar
@@ -283,6 +283,10 @@
spring-security-jwt
1.0.9.RELEASE
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
@@ -322,6 +326,7 @@
joda-time
joda-time
+ 2.10.9
com.fasterxml.jackson.datatype
diff --git a/src/main/java/ch/ethz/seb/sebserver/SEBServer.java b/src/main/java/ch/ethz/seb/sebserver/SEBServer.java
index f0ae0de5..293f76b7 100644
--- a/src/main/java/ch/ethz/seb/sebserver/SEBServer.java
+++ b/src/main/java/ch/ethz/seb/sebserver/SEBServer.java
@@ -18,6 +18,8 @@ import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
+import org.springframework.security.web.firewall.HttpFirewall;
+import org.springframework.security.web.firewall.StrictHttpFirewall;
import ch.ethz.seb.sebserver.gbl.Constants;
import ch.ethz.seb.sebserver.gbl.profile.ProdGuiProfile;
@@ -75,6 +77,13 @@ public class SEBServer {
return tomcat;
}
+ @Bean
+ public HttpFirewall allowEncodedParamsFirewall() {
+ final StrictHttpFirewall firewall = new StrictHttpFirewall();
+ firewall.setAllowUrlEncodedPercent(true);
+ return firewall;
+ }
+
private Connector redirectConnector(final Environment env) {
final String sslPort = env.getRequiredProperty("server.port");
final String httpPort = env.getProperty("sebserver.ssl.redirect.html.port", "80");
diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/util/Utils.java b/src/main/java/ch/ethz/seb/sebserver/gbl/util/Utils.java
index 0c5d77ca..60ff5b9e 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gbl/util/Utils.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gbl/util/Utils.java
@@ -535,7 +535,7 @@ public final class Utils {
final MultiValueMap headers = new LinkedMultiValueMap<>();
headers.set(
HttpHeaders.CONTENT_TYPE,
- org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE);
+ org.springframework.http.MediaType.APPLICATION_JSON_VALUE);
return headers;
}
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/InstitutionalAuthenticationEntryPoint.java b/src/main/java/ch/ethz/seb/sebserver/gui/InstitutionalAuthenticationEntryPoint.java
index c56f03fb..7c46a35c 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/InstitutionalAuthenticationEntryPoint.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/InstitutionalAuthenticationEntryPoint.java
@@ -11,6 +11,7 @@ package ch.ethz.seb.sebserver.gui;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
+import java.nio.charset.StandardCharsets;
import java.util.List;
import javax.servlet.RequestDispatcher;
@@ -18,7 +19,6 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.codec.Charsets;
import org.apache.commons.codec.binary.Base64InputStream;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.rap.rwt.RWT;
@@ -93,7 +93,7 @@ public final class InstitutionalAuthenticationEntryPoint implements Authenticati
final Resource resource = resourceLoader.getResource(defaultLogoFileName);
final Reader reader = new InputStreamReader(
new Base64InputStream(resource.getInputStream(), true),
- Charsets.UTF_8);
+ StandardCharsets.UTF_8);
_defaultLogo = FileCopyUtils.copyToString(reader);
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/RestCall.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/RestCall.java
index 575b139b..95785864 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/RestCall.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/RestCall.java
@@ -364,7 +364,8 @@ public abstract class RestCall {
.cloneBuilder()
.path(RestCall.this.path)
.queryParams(this.queryParams)
- .toUriString();
+ .build(false)
+ .toString();
}
public HttpEntity> buildRequestEntity() {
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/ActivateSEBRestriction.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/ActivateSEBRestriction.java
index 67de13f7..8c97cb46 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/ActivateSEBRestriction.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/ActivateSEBRestriction.java
@@ -33,7 +33,7 @@ public class ActivateSEBRestriction extends RestCall {
new TypeReference() {
}),
HttpMethod.PUT,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.EXAM_ADMINISTRATION_ENDPOINT
+ API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_ADMINISTRATION_SEB_RESTRICTION_PATH_SEGMENT);
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/CheckSEBRestriction.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/CheckSEBRestriction.java
index d7a02885..e86f869b 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/CheckSEBRestriction.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/CheckSEBRestriction.java
@@ -32,7 +32,7 @@ public class CheckSEBRestriction extends RestCall {
new TypeReference() {
}),
HttpMethod.GET,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.EXAM_ADMINISTRATION_ENDPOINT
+ API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_ADMINISTRATION_CHECK_RESTRICTION_PATH_SEGMENT);
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/DeactivateSEBRestriction.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/DeactivateSEBRestriction.java
index 1d327f13..b1953d09 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/DeactivateSEBRestriction.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/DeactivateSEBRestriction.java
@@ -33,7 +33,7 @@ public class DeactivateSEBRestriction extends RestCall {
new TypeReference() {
}),
HttpMethod.DELETE,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.EXAM_ADMINISTRATION_ENDPOINT
+ API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_ADMINISTRATION_SEB_RESTRICTION_PATH_SEGMENT);
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/DeleteExamConfigMapping.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/DeleteExamConfigMapping.java
index 23d7c5e9..a0092230 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/DeleteExamConfigMapping.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/DeleteExamConfigMapping.java
@@ -33,7 +33,7 @@ public class DeleteExamConfigMapping extends RestCall {
new TypeReference() {
}),
HttpMethod.DELETE,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.EXAM_CONFIGURATION_MAP_ENDPOINT + API.MODEL_ID_VAR_PATH_SEGMENT);
}
}
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/DeleteIndicator.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/DeleteIndicator.java
index d6517105..0bcfd39b 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/DeleteIndicator.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/DeleteIndicator.java
@@ -33,7 +33,7 @@ public class DeleteIndicator extends RestCall {
new TypeReference() {
}),
HttpMethod.DELETE,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.EXAM_INDICATOR_ENDPOINT + API.MODEL_ID_VAR_PATH_SEGMENT);
}
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/GetProctoringSettings.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/GetProctoringSettings.java
index 7a16bd22..3e336d25 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/GetProctoringSettings.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/GetProctoringSettings.java
@@ -33,7 +33,7 @@ public class GetProctoringSettings extends RestCall {
new TypeReference() {
}),
HttpMethod.GET,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.EXAM_ADMINISTRATION_ENDPOINT
+ API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_ADMINISTRATION_PROCTORING_PATH_SEGMENT);
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/GetSEBRestrictionSettings.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/GetSEBRestrictionSettings.java
index 701239c5..33fc140d 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/GetSEBRestrictionSettings.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/GetSEBRestrictionSettings.java
@@ -33,7 +33,7 @@ public class GetSEBRestrictionSettings extends RestCall {
new TypeReference() {
}),
HttpMethod.GET,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.EXAM_ADMINISTRATION_ENDPOINT
+ API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_ADMINISTRATION_SEB_RESTRICTION_PATH_SEGMENT);
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveExam.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveExam.java
index f75b9d77..4a1fcf02 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveExam.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveExam.java
@@ -33,7 +33,7 @@ public class SaveExam extends RestCall {
new TypeReference() {
}),
HttpMethod.PUT,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.EXAM_ADMINISTRATION_ENDPOINT);
}
}
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveExamConfigMapping.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveExamConfigMapping.java
index d42bda83..df3d269c 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveExamConfigMapping.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveExamConfigMapping.java
@@ -33,7 +33,7 @@ public class SaveExamConfigMapping extends RestCall {
new TypeReference() {
}),
HttpMethod.PUT,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.EXAM_CONFIGURATION_MAP_ENDPOINT);
}
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveIndicator.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveIndicator.java
index 23a03406..96529032 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveIndicator.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveIndicator.java
@@ -33,7 +33,7 @@ public class SaveIndicator extends RestCall {
new TypeReference() {
}),
HttpMethod.PUT,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.EXAM_INDICATOR_ENDPOINT);
}
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveProctoringSettings.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveProctoringSettings.java
index e0249b68..dbacc253 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveProctoringSettings.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveProctoringSettings.java
@@ -33,7 +33,7 @@ public class SaveProctoringSettings extends RestCall {
new TypeReference() {
}),
HttpMethod.POST,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.EXAM_ADMINISTRATION_ENDPOINT
+ API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_ADMINISTRATION_PROCTORING_PATH_SEGMENT);
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveSEBRestriction.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveSEBRestriction.java
index d3e79c18..dac28050 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveSEBRestriction.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/exam/SaveSEBRestriction.java
@@ -33,7 +33,7 @@ public class SaveSEBRestriction extends RestCall {
new TypeReference() {
}),
HttpMethod.POST,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.EXAM_ADMINISTRATION_ENDPOINT
+ API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_ADMINISTRATION_SEB_RESTRICTION_PATH_SEGMENT);
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/institution/SaveInstitution.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/institution/SaveInstitution.java
index 373b087b..61786491 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/institution/SaveInstitution.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/institution/SaveInstitution.java
@@ -33,7 +33,7 @@ public class SaveInstitution extends RestCall {
new TypeReference() {
}),
HttpMethod.PUT,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.INSTITUTION_ENDPOINT);
}
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/lmssetup/SaveLmsSetup.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/lmssetup/SaveLmsSetup.java
index 2e9445f2..102551b4 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/lmssetup/SaveLmsSetup.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/lmssetup/SaveLmsSetup.java
@@ -33,7 +33,7 @@ public class SaveLmsSetup extends RestCall {
new TypeReference() {
}),
HttpMethod.PUT,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.LMS_SETUP_ENDPOINT);
}
}
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/lmssetup/TestLmsSetupAdHoc.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/lmssetup/TestLmsSetupAdHoc.java
index 93c2fbf8..cbe7eefd 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/lmssetup/TestLmsSetupAdHoc.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/lmssetup/TestLmsSetupAdHoc.java
@@ -33,7 +33,7 @@ public class TestLmsSetupAdHoc extends RestCall {
new TypeReference() {
}),
HttpMethod.PUT,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.LMS_SETUP_TEST_AD_HOC_ENDPOINT);
}
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/clientconfig/SaveClientConfig.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/clientconfig/SaveClientConfig.java
index e3884e2a..236d6f0f 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/clientconfig/SaveClientConfig.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/clientconfig/SaveClientConfig.java
@@ -33,7 +33,7 @@ public class SaveClientConfig extends RestCall {
new TypeReference() {
}),
HttpMethod.PUT,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.SEB_CLIENT_CONFIG_ENDPOINT);
}
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/examconfig/CopyConfiguration.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/examconfig/CopyConfiguration.java
index 58c4e176..ccc573b7 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/examconfig/CopyConfiguration.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/examconfig/CopyConfiguration.java
@@ -33,7 +33,7 @@ public class CopyConfiguration extends RestCall {
new TypeReference() {
}),
HttpMethod.PUT,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.CONFIGURATION_NODE_ENDPOINT
+ API.CONFIGURATION_COPY_PATH_SEGMENT);
}
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/examconfig/SaveExamConfig.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/examconfig/SaveExamConfig.java
index c0ffb056..2d60e5fe 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/examconfig/SaveExamConfig.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/examconfig/SaveExamConfig.java
@@ -33,7 +33,7 @@ public class SaveExamConfig extends RestCall {
new TypeReference() {
}),
HttpMethod.PUT,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.CONFIGURATION_NODE_ENDPOINT);
}
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/examconfig/SaveExamConfigTableValues.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/examconfig/SaveExamConfigTableValues.java
index 5399b545..6144f76e 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/examconfig/SaveExamConfigTableValues.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/examconfig/SaveExamConfigTableValues.java
@@ -33,7 +33,7 @@ public class SaveExamConfigTableValues extends RestCall() {
}),
HttpMethod.PUT,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.CONFIGURATION_VALUE_ENDPOINT + API.CONFIGURATION_TABLE_VALUE_PATH_SEGMENT);
}
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/examconfig/SaveExamConfigValue.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/examconfig/SaveExamConfigValue.java
index 6ee26bb0..50e9516e 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/examconfig/SaveExamConfigValue.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/seb/examconfig/SaveExamConfigValue.java
@@ -33,7 +33,7 @@ public class SaveExamConfigValue extends RestCall {
new TypeReference() {
}),
HttpMethod.PUT,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.CONFIGURATION_VALUE_ENDPOINT);
}
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/session/PropagateInstruction.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/session/PropagateInstruction.java
index dfed4714..442df26a 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/session/PropagateInstruction.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/session/PropagateInstruction.java
@@ -32,7 +32,7 @@ public class PropagateInstruction extends RestCall {
new TypeReference() {
}),
HttpMethod.POST,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.EXAM_MONITORING_ENDPOINT
+ API.PARENT_MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_MONITORING_INSTRUCTION_ENDPOINT);
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/useraccount/ChangePassword.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/useraccount/ChangePassword.java
index ac908c07..3c108f7d 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/useraccount/ChangePassword.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/useraccount/ChangePassword.java
@@ -33,7 +33,7 @@ public class ChangePassword extends RestCall {
new TypeReference() {
}),
HttpMethod.PUT,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.USER_ACCOUNT_ENDPOINT + API.PASSWORD_PATH_SEGMENT);
}
diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/useraccount/SaveUserAccount.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/useraccount/SaveUserAccount.java
index ee16e0ac..0e826008 100644
--- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/useraccount/SaveUserAccount.java
+++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/useraccount/SaveUserAccount.java
@@ -34,7 +34,7 @@ public class SaveUserAccount extends RestCall {
new TypeReference() {
}),
HttpMethod.PUT,
- MediaType.APPLICATION_JSON_UTF8,
+ MediaType.APPLICATION_JSON,
API.USER_ACCOUNT_ENDPOINT);
}
diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/WebServiceSecurityConfig.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/WebServiceSecurityConfig.java
index 27917766..722bdcb9 100644
--- a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/WebServiceSecurityConfig.java
+++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/WebServiceSecurityConfig.java
@@ -239,7 +239,7 @@ public class WebServiceSecurityConfig extends WebSecurityConfigurerAdapter {
webServiceClientDetails,
authenticationManager,
(request, response, exception) -> {
- response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
+ response.setContentType(MediaType.APPLICATION_JSON_VALUE);
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
log.warn("Unauthorized Request: {}", request, exception);
log.info("Redirect to login after unauthorized request");
@@ -279,13 +279,16 @@ public class WebServiceSecurityConfig extends WebSecurityConfigurerAdapter {
}
@Override
- protected void addConfiguration(final String apiEndpoint, final HttpSecurity http) throws Exception {
- http.antMatcher(apiEndpoint + "/**")
+ protected void addConfiguration(
+ final ConfigurerAdapter configurerAdapter,
+ final HttpSecurity http) throws Exception {
+
+ http.antMatcher(configurerAdapter.apiEndpoint + "/**")
.authorizeRequests()
+
.anyRequest()
.hasAuthority(UserRole.SEB_SERVER_ADMIN.name());
}
-
}
private static class LoginRedirectOnUnauthorized implements AuthenticationEntryPoint {
diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/APIExceptionHandler.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/APIExceptionHandler.java
index 2b56b838..4667dbef 100644
--- a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/APIExceptionHandler.java
+++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/APIExceptionHandler.java
@@ -92,8 +92,8 @@ public class APIExceptionHandler extends ResponseEntityExceptionHandler {
final RuntimeException ex,
final WebRequest request) {
- log.error("Unexpected generic error catched at the API endpoint: ", ex);
- final List errors = Arrays.asList(APIMessage.ErrorMessage.GENERIC.of(ex.getMessage()));
+ log.error("Unexpected internal error catched at the API endpoint: ", ex);
+ final List errors = Arrays.asList(APIMessage.ErrorMessage.UNEXPECTED.of(ex.getMessage()));
return new ResponseEntity<>(
errors,
Utils.createJsonContentHeader(),
@@ -188,12 +188,12 @@ public class APIExceptionHandler extends ResponseEntityExceptionHandler {
}
@ExceptionHandler(Exception.class)
- public ResponseEntity