Skip to content

Commit

Permalink
SEBSERV-530 added bundled profile instead of ws,gui
Browse files Browse the repository at this point in the history
  • Loading branch information
anhefti committed Sep 19, 2024
1 parent 992d690 commit 1a1069b
Show file tree
Hide file tree
Showing 14 changed files with 153 additions and 306 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public class ClientHttpRequestFactoryService {

private static final Logger log = LoggerFactory.getLogger(ClientHttpRequestFactoryService.class);

private static final Collection<String> DEV_PROFILES = Arrays.asList("dev-gui", "test", "demo", "dev-ws");
private static final Collection<String> PROD_PROFILES = Arrays.asList("prod-gui", "prod-ws");
private static final Collection<String> DEV_PROFILES = Arrays.asList("dev", "test", "demo");
private static final Collection<String> PROD_PROFILES = Arrays.asList("prod", "prod-gui", "prod-ws");

private final int connectTimeout;
private final int connectionRequestTimeout;
Expand Down
37 changes: 0 additions & 37 deletions src/main/java/ch/ethz/seb/sebserver/SEBServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,14 @@
package ch.ethz.seb.sebserver;

import org.apache.catalina.connector.Connector;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
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;
import ch.ethz.seb.sebserver.gbl.profile.ProdWebServiceProfile;

/** SEB-Server (Safe Exam Browser Server) is a server component to maintain and support
* Exams running with SEB (Safe Exam Browser). TODO add link(s)
* <p>
Expand All @@ -48,35 +40,6 @@ public static void main(final String[] args) {
SpringApplication.run(SEBServer.class, args);
}

/*
* Add a redirect Connector on http port to redirect all http calls
* to https.
*
* NOTE: This works with TomcatServletWebServerFactory and embedded tomcat.
* If the webservice and/or gui is going to running on another server or
* redirect is handled by a proxy, this redirect can be deactivated within
* the "sebserver.ssl.redirect.enabled" property set to false
*/
@Bean
@ProdWebServiceProfile
@ProdGuiProfile
public ServletWebServerFactory servletContainer(
final Environment env,
final ApplicationContext applicationContext) {

final String enabled = env.getProperty(
"sebserver.ssl.redirect.enabled",
Constants.FALSE_STRING);

if (!BooleanUtils.toBoolean(enabled)) {
return new TomcatServletWebServerFactory();
}

final TomcatServletWebServerFactory tomcat = new HTTPSRedirectServerFactory();
tomcat.addAdditionalTomcatConnectors(redirectConnector(env));
return tomcat;
}

@Bean
public HttpFirewall allowEncodedParamsFirewall() {
final StrictHttpFirewall firewall = new StrictHttpFirewall();
Expand Down
26 changes: 0 additions & 26 deletions src/main/java/ch/ethz/seb/sebserver/gbl/profile/DevGuiProfile.java

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
import org.springframework.context.annotation.Profile;

/** Profile annotation for SEB-Server gui components.
*
* <p>
* Use this as profile annotation on components that are only needed in the web-gui environment
* but for all vertical profiles like dev, prod and test */
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Profile({ "dev-gui", "prod-gui", "demo" })
@Profile({ "gui", "bundled" })
public @interface GuiProfile {
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
import org.springframework.context.annotation.Profile;

/** Profile annotation for SEB-Server web-service components.
*
* <p>
* Use this as profile annotation on components that are only needed in the web-service environment
* but for all vertical profiles like dev, prod and test */
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Profile({ "dev-ws", "prod-ws", "test", "demo" })
@Profile({ "ws", "bundled", "test" })
public @interface WebServiceProfile {
}
1 change: 1 addition & 0 deletions src/main/resources/config/application-bundled.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
spring.profiles.include=ws,gui
21 changes: 0 additions & 21 deletions src/main/resources/config/application-dev-gui.properties

This file was deleted.

117 changes: 0 additions & 117 deletions src/main/resources/config/application-dev-ws.properties

This file was deleted.

Loading

0 comments on commit 1a1069b

Please sign in to comment.