update Spring Boot version to 2.3.0.RELEASE

This commit is contained in:
anhefti 2021-02-02 17:58:40 +01:00
parent d103f00de3
commit 3c46251a9d
56 changed files with 186 additions and 166 deletions

View file

@ -12,7 +12,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<version>2.3.0.RELEASE</version>
</parent>
<packaging>jar</packaging>
@ -283,6 +283,10 @@
<artifactId>spring-security-jwt</artifactId>
<version>1.0.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- Flyway -->
<dependency>
@ -322,6 +326,7 @@
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.10.9</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>

View file

@ -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");

View file

@ -535,7 +535,7 @@ public final class Utils {
final MultiValueMap<String, String> 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;
}

View file

@ -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);

View file

@ -364,7 +364,8 @@ public abstract class RestCall<T> {
.cloneBuilder()
.path(RestCall.this.path)
.queryParams(this.queryParams)
.toUriString();
.build(false)
.toString();
}
public HttpEntity<?> buildRequestEntity() {

View file

@ -33,7 +33,7 @@ public class ActivateSEBRestriction extends RestCall<Exam> {
new TypeReference<Exam>() {
}),
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);

View file

@ -32,7 +32,7 @@ public class CheckSEBRestriction extends RestCall<Boolean> {
new TypeReference<Boolean>() {
}),
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);

View file

@ -33,7 +33,7 @@ public class DeactivateSEBRestriction extends RestCall<Exam> {
new TypeReference<Exam>() {
}),
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);

View file

@ -33,7 +33,7 @@ public class DeleteExamConfigMapping extends RestCall<EntityProcessingReport> {
new TypeReference<EntityProcessingReport>() {
}),
HttpMethod.DELETE,
MediaType.APPLICATION_JSON_UTF8,
MediaType.APPLICATION_JSON,
API.EXAM_CONFIGURATION_MAP_ENDPOINT + API.MODEL_ID_VAR_PATH_SEGMENT);
}
}

View file

@ -33,7 +33,7 @@ public class DeleteIndicator extends RestCall<EntityProcessingReport> {
new TypeReference<EntityProcessingReport>() {
}),
HttpMethod.DELETE,
MediaType.APPLICATION_JSON_UTF8,
MediaType.APPLICATION_JSON,
API.EXAM_INDICATOR_ENDPOINT + API.MODEL_ID_VAR_PATH_SEGMENT);
}

View file

@ -33,7 +33,7 @@ public class GetProctoringSettings extends RestCall<ProctoringSettings> {
new TypeReference<ProctoringSettings>() {
}),
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);

View file

@ -33,7 +33,7 @@ public class GetSEBRestrictionSettings extends RestCall<SEBRestriction> {
new TypeReference<SEBRestriction>() {
}),
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);

View file

@ -33,7 +33,7 @@ public class SaveExam extends RestCall<Exam> {
new TypeReference<Exam>() {
}),
HttpMethod.PUT,
MediaType.APPLICATION_JSON_UTF8,
MediaType.APPLICATION_JSON,
API.EXAM_ADMINISTRATION_ENDPOINT);
}
}

View file

@ -33,7 +33,7 @@ public class SaveExamConfigMapping extends RestCall<ExamConfigurationMap> {
new TypeReference<ExamConfigurationMap>() {
}),
HttpMethod.PUT,
MediaType.APPLICATION_JSON_UTF8,
MediaType.APPLICATION_JSON,
API.EXAM_CONFIGURATION_MAP_ENDPOINT);
}

View file

@ -33,7 +33,7 @@ public class SaveIndicator extends RestCall<Indicator> {
new TypeReference<Indicator>() {
}),
HttpMethod.PUT,
MediaType.APPLICATION_JSON_UTF8,
MediaType.APPLICATION_JSON,
API.EXAM_INDICATOR_ENDPOINT);
}

View file

@ -33,7 +33,7 @@ public class SaveProctoringSettings extends RestCall<Exam> {
new TypeReference<Exam>() {
}),
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);

View file

@ -33,7 +33,7 @@ public class SaveSEBRestriction extends RestCall<Exam> {
new TypeReference<Exam>() {
}),
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);

View file

@ -33,7 +33,7 @@ public class SaveInstitution extends RestCall<Institution> {
new TypeReference<Institution>() {
}),
HttpMethod.PUT,
MediaType.APPLICATION_JSON_UTF8,
MediaType.APPLICATION_JSON,
API.INSTITUTION_ENDPOINT);
}

View file

@ -33,7 +33,7 @@ public class SaveLmsSetup extends RestCall<LmsSetup> {
new TypeReference<LmsSetup>() {
}),
HttpMethod.PUT,
MediaType.APPLICATION_JSON_UTF8,
MediaType.APPLICATION_JSON,
API.LMS_SETUP_ENDPOINT);
}
}

View file

@ -33,7 +33,7 @@ public class TestLmsSetupAdHoc extends RestCall<LmsSetupTestResult> {
new TypeReference<LmsSetupTestResult>() {
}),
HttpMethod.PUT,
MediaType.APPLICATION_JSON_UTF8,
MediaType.APPLICATION_JSON,
API.LMS_SETUP_TEST_AD_HOC_ENDPOINT);
}

View file

@ -33,7 +33,7 @@ public class SaveClientConfig extends RestCall<SEBClientConfig> {
new TypeReference<SEBClientConfig>() {
}),
HttpMethod.PUT,
MediaType.APPLICATION_JSON_UTF8,
MediaType.APPLICATION_JSON,
API.SEB_CLIENT_CONFIG_ENDPOINT);
}

View file

@ -33,7 +33,7 @@ public class CopyConfiguration extends RestCall<ConfigurationNode> {
new TypeReference<ConfigurationNode>() {
}),
HttpMethod.PUT,
MediaType.APPLICATION_JSON_UTF8,
MediaType.APPLICATION_JSON,
API.CONFIGURATION_NODE_ENDPOINT
+ API.CONFIGURATION_COPY_PATH_SEGMENT);
}

View file

@ -33,7 +33,7 @@ public class SaveExamConfig extends RestCall<ConfigurationNode> {
new TypeReference<ConfigurationNode>() {
}),
HttpMethod.PUT,
MediaType.APPLICATION_JSON_UTF8,
MediaType.APPLICATION_JSON,
API.CONFIGURATION_NODE_ENDPOINT);
}

View file

@ -33,7 +33,7 @@ public class SaveExamConfigTableValues extends RestCall<ConfigurationTableValues
new TypeReference<ConfigurationTableValues>() {
}),
HttpMethod.PUT,
MediaType.APPLICATION_JSON_UTF8,
MediaType.APPLICATION_JSON,
API.CONFIGURATION_VALUE_ENDPOINT + API.CONFIGURATION_TABLE_VALUE_PATH_SEGMENT);
}

View file

@ -33,7 +33,7 @@ public class SaveExamConfigValue extends RestCall<ConfigurationValue> {
new TypeReference<ConfigurationValue>() {
}),
HttpMethod.PUT,
MediaType.APPLICATION_JSON_UTF8,
MediaType.APPLICATION_JSON,
API.CONFIGURATION_VALUE_ENDPOINT);
}

View file

@ -32,7 +32,7 @@ public class PropagateInstruction extends RestCall<String> {
new TypeReference<String>() {
}),
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);

View file

@ -33,7 +33,7 @@ public class ChangePassword extends RestCall<UserInfo> {
new TypeReference<UserInfo>() {
}),
HttpMethod.PUT,
MediaType.APPLICATION_JSON_UTF8,
MediaType.APPLICATION_JSON,
API.USER_ACCOUNT_ENDPOINT + API.PASSWORD_PATH_SEGMENT);
}

View file

@ -34,7 +34,7 @@ public class SaveUserAccount extends RestCall<UserInfo> {
new TypeReference<UserInfo>() {
}),
HttpMethod.PUT,
MediaType.APPLICATION_JSON_UTF8,
MediaType.APPLICATION_JSON,
API.USER_ACCOUNT_ENDPOINT);
}

View file

@ -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 {

View file

@ -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<APIMessage> errors = Arrays.asList(APIMessage.ErrorMessage.GENERIC.of(ex.getMessage()));
log.error("Unexpected internal error catched at the API endpoint: ", ex);
final List<APIMessage> 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<Object> handleUnexpected(
public ResponseEntity<Object> handleGeneric(
final Exception ex,
final WebRequest request) {
log.error("Unexpected internal error catched at the API endpoint: ", ex);
return APIMessage.ErrorMessage.UNEXPECTED
log.error("Unexpected generic error catched at the API endpoint: ", ex);
return APIMessage.ErrorMessage.GENERIC
.createErrorResponse(ex.getMessage());
}

View file

@ -62,7 +62,7 @@ public abstract class ActivatableEntityController<T extends GrantEntity, M exten
path = API.ACTIVE_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Page<T> allActive(
@RequestParam(
name = Entity.FILTER_ATTR_INSTITUTION,
@ -90,7 +90,7 @@ public abstract class ActivatableEntityController<T extends GrantEntity, M exten
path = API.INACTIVE_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Page<T> allInactive(
@RequestParam(
name = Entity.FILTER_ATTR_INSTITUTION,
@ -118,7 +118,7 @@ public abstract class ActivatableEntityController<T extends GrantEntity, M exten
path = API.PATH_VAR_ACTIVE,
method = RequestMethod.POST,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public EntityProcessingReport activate(@PathVariable final String modelId) {
return setActive(modelId, true)
.getOrThrow();
@ -128,7 +128,7 @@ public abstract class ActivatableEntityController<T extends GrantEntity, M exten
value = API.PATH_VAR_INACTIVE,
method = RequestMethod.POST,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public EntityProcessingReport deactivate(@PathVariable final String modelId) {
return setActive(modelId, false)
.getOrThrow();

View file

@ -87,7 +87,7 @@ public class ClientEventController extends ReadonlyEntityController<ClientEvent,
path = API.SEB_CLIENT_EVENT_SEARCH_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Page<ExtendedClientEvent> getExtendedPage(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -129,7 +129,7 @@ public class ClientEventController extends ReadonlyEntityController<ClientEvent,
@RequestMapping(
method = RequestMethod.DELETE,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public EntityProcessingReport hardDeleteAll(
@RequestParam(name = API.PARAM_MODEL_ID_LIST) final List<String> ids,
@RequestParam(name = API.PARAM_BULK_ACTION_ADD_INCLUDES, defaultValue = "false") final boolean addIncludes,

View file

@ -59,7 +59,7 @@ public class ConfigurationAttributeController extends EntityController<Configura
path = API.LIST_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public List<ConfigurationAttribute> getForIds(
@RequestParam(name = API.PARAM_MODEL_ID_LIST, required = false) final String modelIds) {

View file

@ -70,7 +70,7 @@ public class ConfigurationController extends ReadonlyEntityController<Configurat
path = API.CONFIGURATION_SAVE_TO_HISTORY_PATH_SEGMENT + API.MODEL_ID_VAR_PATH_SEGMENT,
method = RequestMethod.POST,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Configuration saveToHistory(@PathVariable final Long modelId) {
return this.entityDAO.byPK(modelId)
@ -85,7 +85,7 @@ public class ConfigurationController extends ReadonlyEntityController<Configurat
path = API.CONFIGURATION_UNDO_PATH_SEGMENT + API.MODEL_ID_VAR_PATH_SEGMENT,
method = RequestMethod.POST,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Configuration undo(@PathVariable final String modelId) {
return this.entityDAO.byModelId(modelId)
@ -99,7 +99,7 @@ public class ConfigurationController extends ReadonlyEntityController<Configurat
path = API.CONFIGURATION_RESTORE_FROM_HISTORY_PATH_SEGMENT + API.MODEL_ID_VAR_PATH_SEGMENT,
method = RequestMethod.POST,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Configuration restoreFormHistory(
@PathVariable final String modelId,
@RequestParam(name = API.PARAM_PARENT_MODEL_ID, required = true) final Long configurationNodeId) {

View file

@ -130,7 +130,7 @@ public class ConfigurationNodeController extends EntityController<ConfigurationN
path = API.MODEL_ID_VAR_PATH_SEGMENT + API.CONFIGURATION_FOLLOWUP_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Configuration getFollowup(@PathVariable final Long modelId) {
this.entityDAO
@ -147,7 +147,7 @@ public class ConfigurationNodeController extends EntityController<ConfigurationN
path = API.MODEL_ID_VAR_PATH_SEGMENT + API.CONFIGURATION_SETTINGS_PUBLISHED_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public SettingsPublished settingsPublished(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -168,8 +168,8 @@ public class ConfigurationNodeController extends EntityController<ConfigurationN
@RequestMapping(
path = API.CONFIGURATION_COPY_PATH_SEGMENT,
method = RequestMethod.PUT,
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
public ConfigurationNode copyConfiguration(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -202,7 +202,7 @@ public class ConfigurationNodeController extends EntityController<ConfigurationN
path = API.MODEL_ID_VAR_PATH_SEGMENT + API.CONFIGURATION_CONFIG_KEY_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public ConfigKey getConfigKey(
@PathVariable final Long modelId,
@RequestParam(
@ -258,7 +258,7 @@ public class ConfigurationNodeController extends EntityController<ConfigurationN
path = API.CONFIGURATION_IMPORT_PATH_SEGMENT,
method = RequestMethod.POST,
consumes = MediaType.APPLICATION_OCTET_STREAM_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Configuration importExamConfig(
@RequestHeader(name = Domain.CONFIGURATION_NODE.ATTR_NAME, required = false) final String name,
@RequestHeader(name = Domain.CONFIGURATION_NODE.ATTR_DESCRIPTION,
@ -311,7 +311,7 @@ public class ConfigurationNodeController extends EntityController<ConfigurationN
path = API.MODEL_ID_VAR_PATH_SEGMENT + API.CONFIGURATION_IMPORT_PATH_SEGMENT,
method = RequestMethod.POST,
consumes = MediaType.APPLICATION_OCTET_STREAM_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Configuration importExamConfigOnExistingConfig(
@PathVariable final Long modelId,
@RequestHeader(name = API.IMPORT_PASSWORD_ATTR_NAME, required = false) final String password,
@ -345,7 +345,7 @@ public class ConfigurationNodeController extends EntityController<ConfigurationN
path = API.PARENT_MODEL_ID_VAR_PATH_SEGMENT + API.TEMPLATE_ATTRIBUTE_ENDPOINT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Page<TemplateAttribute> getTemplateAttributePage(
@PathVariable(name = API.PARAM_PARENT_MODEL_ID, required = true) final Long parentModelId,
@RequestParam(
@ -397,7 +397,7 @@ public class ConfigurationNodeController extends EntityController<ConfigurationN
+ API.MODEL_ID_VAR_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public TemplateAttribute getTemplateAttribute(
@PathVariable(name = API.PARAM_PARENT_MODEL_ID, required = true) final Long parentModelId,
@PathVariable(name = API.PARAM_MODEL_ID, required = true) final Long modelId,
@ -423,7 +423,7 @@ public class ConfigurationNodeController extends EntityController<ConfigurationN
+ API.TEMPLATE_ATTRIBUTE_RESET_VALUES,
method = RequestMethod.PATCH,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public TemplateAttribute resetTemplateAttributeValues(
@PathVariable(name = API.PARAM_PARENT_MODEL_ID, required = true) final Long parentModelId,
@PathVariable(name = API.PARAM_MODEL_ID, required = true) final Long modelId,
@ -449,7 +449,7 @@ public class ConfigurationNodeController extends EntityController<ConfigurationN
+ API.TEMPLATE_ATTRIBUTE_ATTACH_DEFAULT_ORIENTATION,
method = RequestMethod.PATCH,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public TemplateAttribute attachDefaultTemplateAttributeOrientation(
@PathVariable(name = API.PARAM_PARENT_MODEL_ID, required = true) final Long parentModelId,
@PathVariable(name = API.PARAM_MODEL_ID, required = true) final Long modelId,
@ -478,7 +478,7 @@ public class ConfigurationNodeController extends EntityController<ConfigurationN
+ API.TEMPLATE_ATTRIBUTE_REMOVE_ORIENTATION,
method = RequestMethod.PATCH,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public TemplateAttribute removeTemplateAttributeOrientation(
@PathVariable(name = API.PARAM_PARENT_MODEL_ID, required = true) final Long parentModelId,
@PathVariable(name = API.PARAM_MODEL_ID, required = true) final Long modelId,

View file

@ -99,7 +99,7 @@ public class ConfigurationValueController extends EntityController<Configuration
path = API.CONFIGURATION_TABLE_VALUE_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public ConfigurationTableValues getTableValue(
@RequestParam(
name = Domain.CONFIGURATION_VALUE.ATTR_CONFIGURATION_ATTRIBUTE_ID,
@ -120,8 +120,8 @@ public class ConfigurationValueController extends EntityController<Configuration
@RequestMapping(
path = API.CONFIGURATION_TABLE_VALUE_PATH_SEGMENT,
method = RequestMethod.PUT,
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
public ConfigurationTableValues savePut(
@Valid @RequestBody final ConfigurationTableValues tableValue) {

View file

@ -132,7 +132,7 @@ public abstract class EntityController<T extends Entity, M extends Entity> {
@RequestMapping(
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Page<T> getPage(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -172,7 +172,7 @@ public abstract class EntityController<T extends Entity, M extends Entity> {
path = API.NAMES_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Collection<EntityName> getNames(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -209,7 +209,7 @@ public abstract class EntityController<T extends Entity, M extends Entity> {
path = API.MODEL_ID_VAR_PATH_SEGMENT + API.DEPENDENCY_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Collection<EntityDependency> getDependencies(
@PathVariable final String modelId,
@RequestParam(name = API.PARAM_BULK_ACTION_TYPE, required = true) final BulkActionType bulkActionType,
@ -238,7 +238,7 @@ public abstract class EntityController<T extends Entity, M extends Entity> {
path = API.MODEL_ID_VAR_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public T getBy(@PathVariable final String modelId) {
return this.entityDAO
@ -255,7 +255,7 @@ public abstract class EntityController<T extends Entity, M extends Entity> {
path = API.LIST_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public List<T> getForIds(@RequestParam(name = API.PARAM_MODEL_ID_LIST, required = true) final String modelIds) {
return Result.tryCatch(() -> Arrays.stream(StringUtils.split(modelIds, Constants.LIST_SEPARATOR_CHAR))
@ -275,7 +275,7 @@ public abstract class EntityController<T extends Entity, M extends Entity> {
@RequestMapping(
method = RequestMethod.POST,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public T create(
@RequestParam final MultiValueMap<String, String> allRequestParams,
@RequestParam(
@ -306,8 +306,8 @@ public abstract class EntityController<T extends Entity, M extends Entity> {
@RequestMapping(
method = RequestMethod.PUT,
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
public T savePut(@Valid @RequestBody final T modifyData) {
return this.checkModifyAccess(modifyData)
.flatMap(this::validForSave)
@ -324,7 +324,7 @@ public abstract class EntityController<T extends Entity, M extends Entity> {
@RequestMapping(
path = API.MODEL_ID_VAR_PATH_SEGMENT,
method = RequestMethod.DELETE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public EntityProcessingReport hardDelete(
@PathVariable final String modelId,
@RequestParam(name = API.PARAM_BULK_ACTION_ADD_INCLUDES, defaultValue = "false") final boolean addIncludes,
@ -346,7 +346,7 @@ public abstract class EntityController<T extends Entity, M extends Entity> {
@RequestMapping(
method = RequestMethod.DELETE,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public EntityProcessingReport hardDeleteAll(
@RequestParam(name = API.PARAM_MODEL_ID_LIST) final List<String> ids,
@RequestParam(name = API.PARAM_BULK_ACTION_ADD_INCLUDES, defaultValue = "false") final boolean addIncludes,

View file

@ -81,7 +81,7 @@ public class ExamAPIDiscoveryController {
@RequestMapping(
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public ExamAPIDiscovery getDiscovery() {
return this.DISCOVERY_INFO;
}

View file

@ -86,7 +86,7 @@ public class ExamAPI_V1_Controller {
path = API.EXAM_API_HANDSHAKE_ENDPOINT,
method = RequestMethod.POST,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public CompletableFuture<Collection<RunningExamInfo>> handshakeCreate(
@RequestParam(name = API.PARAM_INSTITUTION_ID, required = false) final Long instIdRequestParam,
@RequestParam(name = API.EXAM_API_PARAM_EXAM_ID, required = false) final Long examIdRequestParam,
@ -274,7 +274,7 @@ public class ExamAPI_V1_Controller {
path = API.EXAM_API_PING_ENDPOINT,
method = RequestMethod.POST,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public void ping(final HttpServletRequest request, final HttpServletResponse response) {
final String connectionToken = request.getHeader(API.EXAM_API_SEB_CONNECTION_TOKEN);
@ -308,7 +308,7 @@ public class ExamAPI_V1_Controller {
@RequestMapping(
path = API.EXAM_API_EVENT_ENDPOINT,
method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void event(
@RequestHeader(name = API.EXAM_API_SEB_CONNECTION_TOKEN, required = true) final String connectionToken,

View file

@ -128,7 +128,7 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
@RequestMapping(
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
@Override
public Page<Exam> getPage(
@RequestParam(
@ -215,7 +215,7 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
path = API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_ADMINISTRATION_CHECK_IMPORTED_PATH_SEGMENT,
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Collection<EntityKey> checkImported(
@PathVariable final String modelId,
@RequestParam(
@ -236,7 +236,7 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
path = API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_ADMINISTRATION_CONSISTENCY_CHECK_PATH_SEGMENT,
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Collection<APIMessage> checkExamConsistency(
@PathVariable final Long modelId,
@RequestParam(
@ -257,7 +257,7 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
path = API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_ADMINISTRATION_CHECK_RESTRICTION_PATH_SEGMENT,
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Boolean checkSEBRestriction(
@PathVariable final Long modelId,
@RequestParam(
@ -275,7 +275,7 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
path = API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_ADMINISTRATION_SEB_RESTRICTION_PATH_SEGMENT,
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public SEBRestriction getSEBRestriction(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -294,7 +294,7 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
path = API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_ADMINISTRATION_SEB_RESTRICTION_PATH_SEGMENT,
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Exam saveSEBRestrictionData(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -317,7 +317,7 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
path = API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_ADMINISTRATION_SEB_RESTRICTION_PATH_SEGMENT,
method = RequestMethod.PUT,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Exam applySEBRestriction(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -337,7 +337,7 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
path = API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_ADMINISTRATION_SEB_RESTRICTION_PATH_SEGMENT,
method = RequestMethod.DELETE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Exam deleteSEBRestriction(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -357,7 +357,7 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
path = API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_ADMINISTRATION_SEB_RESTRICTION_CHAPTERS_PATH_SEGMENT,
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Chapters getChapters(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -385,7 +385,7 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
path = API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_ADMINISTRATION_PROCTORING_PATH_SEGMENT,
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public ProctoringSettings getExamProctoring(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -404,7 +404,7 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
path = API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_ADMINISTRATION_PROCTORING_PATH_SEGMENT,
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Exam saveExamProctoring(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,

View file

@ -133,7 +133,7 @@ public class ExamConfigurationMappingController extends EntityController<ExamCon
@RequestMapping(
method = RequestMethod.POST,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public ExamConfigurationMap create(
@RequestParam final MultiValueMap<String, String> allRequestParams,
@RequestParam(
@ -163,7 +163,7 @@ public class ExamConfigurationMappingController extends EntityController<ExamCon
@RequestMapping(
path = API.MODEL_ID_VAR_PATH_SEGMENT,
method = RequestMethod.DELETE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public EntityProcessingReport hardDelete(
@PathVariable final String modelId,
@RequestParam(name = API.PARAM_BULK_ACTION_ADD_INCLUDES, defaultValue = "false") final boolean addIncludes,

View file

@ -116,7 +116,7 @@ public class ExamMonitoringController {
@RequestMapping(
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Page<Exam> getPage(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -158,7 +158,7 @@ public class ExamMonitoringController {
path = API.PARENT_MODEL_ID_VAR_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Collection<ClientConnectionData> getConnectionData(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -203,7 +203,7 @@ public class ExamMonitoringController {
API.EXAM_MONITORING_SEB_CONNECTION_TOKEN_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public ClientConnectionData getConnectionDataForSingleConnection(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -235,7 +235,7 @@ public class ExamMonitoringController {
path = API.PARENT_MODEL_ID_VAR_PATH_SEGMENT +
API.EXAM_MONITORING_INSTRUCTION_ENDPOINT,
method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
consumes = MediaType.APPLICATION_JSON_VALUE)
public void registerInstruction(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -253,7 +253,7 @@ public class ExamMonitoringController {
API.EXAM_MONITORING_SEB_CONNECTION_TOKEN_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Collection<ClientNotification> pendingNotifications(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,

View file

@ -90,7 +90,7 @@ public class ExamProctoringController {
+ API.EXAM_PROCTORING_ROOMS_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Collection<RemoteProctoringRoom> getProcotringCollectingRoomsOfExam(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -107,7 +107,7 @@ public class ExamProctoringController {
path = API.MODEL_ID_VAR_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public SEBProctoringConnectionData getProctorRoomData(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -136,7 +136,7 @@ public class ExamProctoringController {
+ API.EXAM_PROCTORING_ROOM_CONNECTIONS_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Collection<ClientConnection> getProctorRoomConnectionData(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -157,7 +157,7 @@ public class ExamProctoringController {
path = API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_PROCTORING_BROADCAST_SEND_ATTRIBUTES,
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public void sendBroadcastAttributes(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -204,7 +204,7 @@ public class ExamProctoringController {
path = API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_PROCTORING_REJOIN_COLLECTING_ROOM_PATH_SEGMENT,
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public void sendRejoinExamCollectingRoomToClients(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -244,7 +244,7 @@ public class ExamProctoringController {
path = API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_PROCTORING_JOIN_ROOM_PATH_SEGMENT,
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public SEBProctoringConnectionData sendJoinProctoringRoomToClients(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -319,7 +319,7 @@ public class ExamProctoringController {
path = API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_PROCTORING_TOWNHALL_ROOM_DATA,
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public RemoteProctoringRoom getTownhallRoomData(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -337,7 +337,7 @@ public class ExamProctoringController {
path = API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_PROCTORING_ACTIVATE_TOWNHALL_ROOM,
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public SEBProctoringConnectionData activateTownhall(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,
@ -401,7 +401,7 @@ public class ExamProctoringController {
path = API.MODEL_ID_VAR_PATH_SEGMENT
+ API.EXAM_PROCTORING_DEACTIVATE_TOWNHALL_ROOM,
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public void deactivateTownhall(
@RequestParam(
name = API.PARAM_INSTITUTION_ID,

View file

@ -93,7 +93,7 @@ public class InfoController {
@RequestMapping(
path = API.PRIVILEGES_PATH_SEGMENT,
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Collection<Privilege> privileges() {
return this.authorizationGrantService.getAllPrivileges();
}

View file

@ -79,7 +79,7 @@ public class LmsSetupController extends ActivatableEntityController<LmsSetup, Lm
path = API.LMS_SETUP_TEST_PATH_SEGMENT + API.MODEL_ID_VAR_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public LmsSetupTestResult testLms(
@RequestParam(
name = Entity.FILTER_ATTR_INSTITUTION,
@ -106,8 +106,8 @@ public class LmsSetupController extends ActivatableEntityController<LmsSetup, Lm
@RequestMapping(
path = API.LMS_SETUP_TEST_PATH_SEGMENT + API.LMS_SETUP_TEST_AD_HOC_PATH_SEGMENT,
method = RequestMethod.PUT,
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
public LmsSetupTestResult testLmsAdHoc(@Valid @RequestBody final LmsSetup lmsSetup) {
this.authorization.checkModify(lmsSetup);

View file

@ -71,7 +71,7 @@ public class QuizController {
@RequestMapping(
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public Page<QuizData> getQuizPage(
@RequestParam(
name = Entity.FILTER_ATTR_INSTITUTION,
@ -113,7 +113,7 @@ public class QuizController {
path = API.MODEL_ID_VAR_PATH_SEGMENT,
method = RequestMethod.GET,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public QuizData getQuiz(
@PathVariable final String modelId,
@RequestParam(name = QuizData.QUIZ_ATTR_LMS_SETUP_ID, required = true) final Long lmsSetupId) {

View file

@ -63,7 +63,7 @@ public class RegisterUserController {
@RequestMapping(
method = RequestMethod.POST,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public UserInfo registerNewUser(
@RequestParam final MultiValueMap<String, String> allRequestParams,
final HttpServletRequest request) {

View file

@ -148,8 +148,8 @@ public class UserAccountController extends ActivatableEntityController<UserInfo,
@RequestMapping(
path = API.PASSWORD_PATH_SEGMENT,
method = RequestMethod.PUT,
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
public UserInfo changePassword(@Valid @RequestBody final PasswordChange passwordChange) {
final String modelId = passwordChange.getModelId();

View file

@ -70,7 +70,7 @@ public class UserActivityLogController extends ReadonlyEntityController<UserActi
@RequestMapping(
method = RequestMethod.DELETE,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public EntityProcessingReport hardDeleteAll(
@RequestParam(name = API.PARAM_MODEL_ID_LIST) final List<String> ids,
@RequestParam(name = API.PARAM_BULK_ACTION_ADD_INCLUDES, defaultValue = "false") final boolean addIncludes,

View file

@ -67,22 +67,41 @@ public abstract class WebserviceResourceConfiguration extends ResourceServerConf
super.setConfigurers(configurers);
}
protected void addConfiguration(final String apiEndpoint, final HttpSecurity http) throws Exception {
protected void addConfiguration(final ConfigurerAdapter configurerAdapter, final HttpSecurity http)
throws Exception {
// To override of additional configuration is needed
http
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.antMatcher(configurerAdapter.apiEndpoint + "/**")
.authorizeRequests()
.anyRequest()
.authenticated()
.and()
.exceptionHandling()
.authenticationEntryPoint(configurerAdapter.authenticationEntryPoint)
.and()
.formLogin().disable()
.httpBasic().disable()
.logout().disable()
.headers().frameOptions().disable()
.and()
.csrf().disable();
}
private static final class ConfigurerAdapter extends ResourceServerConfigurerAdapter {
protected static final class ConfigurerAdapter extends ResourceServerConfigurerAdapter {
private final WebserviceResourceConfiguration webserviceResourceConfiguration;
private final TokenStore tokenStore;
private final WebClientDetailsService webServiceClientDetails;
private final AuthenticationManager authenticationManager;
private final AuthenticationEntryPoint authenticationEntryPoint;
private final String resourceId;
private final String apiEndpoint;
private final boolean supportRefreshToken;
private final int accessTokenValiditySeconds;
private final int refreshTokenValiditySeconds;
public final WebserviceResourceConfiguration webserviceResourceConfiguration;
public final TokenStore tokenStore;
public final WebClientDetailsService webServiceClientDetails;
public final AuthenticationManager authenticationManager;
public final AuthenticationEntryPoint authenticationEntryPoint;
public final String resourceId;
public final String apiEndpoint;
public final boolean supportRefreshToken;
public final int accessTokenValiditySeconds;
public final int refreshTokenValiditySeconds;
public ConfigurerAdapter(
final WebserviceResourceConfiguration webserviceResourceConfiguration,
@ -124,26 +143,7 @@ public abstract class WebserviceResourceConfiguration extends ResourceServerConf
@Override
public void configure(final HttpSecurity http) throws Exception {
http
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.antMatcher(this.apiEndpoint + "/**")
.authorizeRequests()
.anyRequest()
.authenticated()
.and()
.exceptionHandling()
.authenticationEntryPoint(this.authenticationEntryPoint)
.and()
.formLogin().disable()
.httpBasic().disable()
.logout().disable()
.headers().frameOptions().disable()
.and()
.csrf().disable();
this.webserviceResourceConfiguration.addConfiguration(this.apiEndpoint, http);
this.webserviceResourceConfiguration.addConfiguration(this, http);
}
}

File diff suppressed because one or more lines are too long

View file

@ -195,7 +195,7 @@ public class SEBClientBot {
headers.set(EXAM_API_SEB_CONNECTION_TOKEN, connectionToken);
final MultiValueMap<String, String> eventHeaders = new LinkedMultiValueMap<>();
eventHeaders.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE);
eventHeaders.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
eventHeaders.set(EXAM_API_SEB_CONNECTION_TOKEN, connectionToken);
if (connectionToken != null) {

View file

@ -156,7 +156,7 @@ public abstract class AdministrationAPIIntegrationTester {
}
public RestAPITestHelper withBodyJson(final Object object) throws Exception {
this.contentType = MediaType.APPLICATION_JSON_UTF8;
this.contentType = MediaType.APPLICATION_JSON;
this.body = AdministrationAPIIntegrationTester.this.jsonMapper.writeValueAsString(object);
return this;
}

View file

@ -547,7 +547,7 @@ public class UserAPITest extends AdministrationAPIIntegrationTester {
// final String contentAsString = this.mockMvc
// .perform(post(this.endpoint + RestAPI.ENDPOINT_USER_ACCOUNT + "/save")
// .header("Authorization", "Bearer " + token)
// .contentType(MediaType.APPLICATION_JSON_UTF8)
// .contentType(MediaType.APPLICATION_JSON)
// .content(modifyUserJson))
// .andReturn().getResponse().getContentAsString();
//
@ -603,7 +603,7 @@ public class UserAPITest extends AdministrationAPIIntegrationTester {
UserInfo modifiedUserResult = this.jsonMapper.readValue(
this.mockMvc.perform(put(this.endpoint + API.USER_ACCOUNT_ENDPOINT)
.header("Authorization", "Bearer " + token)
.contentType(MediaType.APPLICATION_JSON_UTF8)
.contentType(MediaType.APPLICATION_JSON)
.content(modifyUserJson))
.andExpect(status().isOk())
.andReturn().getResponse().getContentAsString(),
@ -732,7 +732,7 @@ public class UserAPITest extends AdministrationAPIIntegrationTester {
this.mockMvc.perform(put(this.endpoint + API.USER_ACCOUNT_ENDPOINT)
.header("Authorization", "Bearer " + examAdminToken1)
.contentType(MediaType.APPLICATION_JSON_UTF8)
.contentType(MediaType.APPLICATION_JSON)
.content(modifiedUserJson))
.andExpect(status().isOk())
.andReturn().getResponse().getContentAsString();
@ -759,7 +759,7 @@ public class UserAPITest extends AdministrationAPIIntegrationTester {
final String newUserJson = this.jsonMapper.writeValueAsString(userInfo);
this.mockMvc.perform(put(this.endpoint + API.USER_ACCOUNT_ENDPOINT)
.header("Authorization", "Bearer " + token)
.contentType(MediaType.APPLICATION_JSON_UTF8)
.contentType(MediaType.APPLICATION_JSON)
.content(newUserJson))
.andExpect(status().isForbidden())
.andReturn().getResponse().getContentAsString();
@ -787,7 +787,7 @@ public class UserAPITest extends AdministrationAPIIntegrationTester {
final String newUserJson = this.jsonMapper.writeValueAsString(userInfo);
this.mockMvc.perform(put(this.endpoint + API.USER_ACCOUNT_ENDPOINT)
.header("Authorization", "Bearer " + token)
.contentType(MediaType.APPLICATION_JSON_UTF8)
.contentType(MediaType.APPLICATION_JSON)
.content(newUserJson))
.andExpect(status().isForbidden())
.andReturn().getResponse().getContentAsString();
@ -819,7 +819,7 @@ public class UserAPITest extends AdministrationAPIIntegrationTester {
this.mockMvc.perform(
put(this.endpoint + API.USER_ACCOUNT_ENDPOINT + API.PASSWORD_PATH_SEGMENT)
.header("Authorization", "Bearer " + sebAdminToken)
.contentType(MediaType.APPLICATION_JSON_UTF8)
.contentType(MediaType.APPLICATION_JSON)
.content(modifiedUserJson))
.andExpect(status().isOk())
.andReturn().getResponse().getContentAsString();
@ -870,7 +870,7 @@ public class UserAPITest extends AdministrationAPIIntegrationTester {
this.mockMvc.perform(
put(this.endpoint + API.USER_ACCOUNT_ENDPOINT + API.PASSWORD_PATH_SEGMENT)
.header("Authorization", "Bearer " + sebAdminToken)
.contentType(MediaType.APPLICATION_JSON_UTF8)
.contentType(MediaType.APPLICATION_JSON)
.content(modifiedUserJson))
.andExpect(status().isBadRequest())
.andReturn().getResponse().getContentAsString(),
@ -894,7 +894,7 @@ public class UserAPITest extends AdministrationAPIIntegrationTester {
this.mockMvc.perform(
put(this.endpoint + API.USER_ACCOUNT_ENDPOINT + API.PASSWORD_PATH_SEGMENT)
.header("Authorization", "Bearer " + sebAdminToken)
.contentType(MediaType.APPLICATION_JSON_UTF8)
.contentType(MediaType.APPLICATION_JSON)
.content(modifiedUserJson))
.andExpect(status().isBadRequest())
.andReturn().getResponse().getContentAsString(),

View file

@ -126,7 +126,7 @@ public abstract class ExamAPIIntegrationTester {
final ResultActions result = this.mockMvc.perform(post("/oauth/token")
.params(params)
.with(httpBasic(clientId, clientSecret))
.accept(MediaType.APPLICATION_JSON_UTF8_VALUE))
.accept(MediaType.APPLICATION_JSON_VALUE))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE));
@ -144,7 +144,7 @@ public abstract class ExamAPIIntegrationTester {
final MockHttpServletRequestBuilder builder = post(this.endpoint + "/handshake")
.header("Content-Type", "application/x-www-form-urlencoded")
.header("Authorization", "Bearer " + accessToken)
.accept(MediaType.APPLICATION_JSON_UTF8_VALUE);
.accept(MediaType.APPLICATION_JSON_VALUE);
String body = "";
@ -163,7 +163,7 @@ public abstract class ExamAPIIntegrationTester {
.andReturn();
final ResultActions result = this.mockMvc.perform(asyncDispatch(mvcResult))
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE));
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE));
return result.andReturn().getResponse();
}
@ -198,12 +198,12 @@ public abstract class ExamAPIIntegrationTester {
.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE)
.header("Authorization", "Bearer " + accessToken)
.header(API.EXAM_API_SEB_CONNECTION_TOKEN, connectionToken)
.accept(MediaType.APPLICATION_JSON_UTF8_VALUE)
.accept(MediaType.APPLICATION_JSON_VALUE)
: patch(this.endpoint + "/handshake")
.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE)
.header("Authorization", "Bearer " + accessToken)
.header(API.EXAM_API_SEB_CONNECTION_TOKEN, connectionToken)
.accept(MediaType.APPLICATION_JSON_UTF8_VALUE);
.accept(MediaType.APPLICATION_JSON_VALUE);
String body = "";
if (examId != null) {
@ -235,7 +235,7 @@ public abstract class ExamAPIIntegrationTester {
.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE)
.header("Authorization", "Bearer " + accessToken)
.header(API.EXAM_API_SEB_CONNECTION_TOKEN, connectionToken)
.accept(MediaType.APPLICATION_JSON_UTF8_VALUE);
.accept(MediaType.APPLICATION_JSON_VALUE);
final MvcResult mvcResult = this.mockMvc
.perform(builder)
@ -254,7 +254,7 @@ public abstract class ExamAPIIntegrationTester {
.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE)
.header("Authorization", "Bearer " + accessToken)
.header(API.EXAM_API_SEB_CONNECTION_TOKEN, connectionToken)
.accept(MediaType.APPLICATION_JSON_UTF8_VALUE);
.accept(MediaType.APPLICATION_JSON_VALUE);
final String body = API.EXAM_API_PING_TIMESTAMP + "=" + DateTime.now(DateTimeZone.UTC).getMillis()
+ "&" + API.EXAM_API_PING_NUMBER + "=" + num;
@ -274,10 +274,10 @@ public abstract class ExamAPIIntegrationTester {
final String text) throws Exception {
final MockHttpServletRequestBuilder builder = post(this.endpoint + API.EXAM_API_EVENT_ENDPOINT)
.header("Content-Type", MediaType.APPLICATION_JSON_UTF8_VALUE)
.header("Content-Type", MediaType.APPLICATION_JSON_VALUE)
.header("Authorization", "Bearer " + accessToken)
.header(API.EXAM_API_SEB_CONNECTION_TOKEN, connectionToken)
.accept(MediaType.APPLICATION_JSON_UTF8_VALUE);
.accept(MediaType.APPLICATION_JSON_VALUE);
final String body = "{ \"type\": \"%s\", \"timestamp\": %s, \"numericValue\": %s, \"text\": \"%s\" }";
builder.content(String.format(body, type, timestamp, value, text));

View file

@ -1,3 +1,6 @@
DROP ALL OBJECTS;
-- -----------------------------------------------------
-- Table `institution`
-- -----------------------------------------------------
@ -574,4 +577,3 @@ CREATE TABLE IF NOT EXISTS `client_instruction` (
ON UPDATE NO ACTION)
;