Skip to content

Commit

Permalink
#87: Move EULA to welcome page and make configurable via EULA_HTML pr…
Browse files Browse the repository at this point in the history
…operty.
  • Loading branch information
kenmeacham committed Nov 13, 2023
1 parent 3353fcb commit efd73de
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
# Spring boot application property reset.on.start, default value is true
#RESET_ON_START=false

# EULA filename (i.e. filename without .html suffix)
#EULA_FILENAME=EULA
# EULA html
#EULA_HTML=<p>The Spyderisk software is open source, licensed under <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a></p>

2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ services:
SPRING_DATA_MONGODB_HOST: mongo
KEYCLOAK_CREDENTIALS_SECRET: ${KEYCLOAK_CREDENTIALS_SECRET:-DfkQBcVpjbO6gTMXMBUBfHe45UmFhGxk}
RESET_ON_START: ${RESET_ON_START:-true}
EULA_FILENAME: ${EULA_FILENAME:-EULA}
EULA_HTML: ${EULA_HTML}
volumes:
# Persistent named volume for the jena-tdb storage
- type: volume
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ protected void configure(HttpSecurity http) throws Exception {

// permit anyone to access the following public pages
.antMatchers("/", "/welcome").permitAll()
.antMatchers("/", "/EULA").permitAll()

// Explicitly list all operations on models that can be performed unauthenticated.
// We need to explicitly restrict "/models" as "/models/**" also matches it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,18 @@

package uk.ac.soton.itinnovation.security.systemmodeller.rest;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class MvcConfig extends WebMvcConfigurerAdapter {

@Value("${eula.filename}")
private String eulaViewname;

@Override
public void addViewControllers(ViewControllerRegistry registry) {

registry.addViewController("/").setViewName("welcome");
registry.addViewController("/welcome").setViewName("welcome");
registry.addViewController("/EULA").setViewName(eulaViewname);
registry.addViewController("/dashboard").setViewName("dashboard");
registry.addViewController("/domain-manager").setViewName("domainManager");
registry.addViewController("/admin").setViewName("admin");
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ server.compression.mime-types=text/html,text/xml,text/plain,text/css,text/javasc
# Compress the response only if the response size is at least 1KB
server.compression.min-response-size=1024

# EULA filename (i.e. without .html suffix)
eula.filename=EULA
# EULA html
eula.html=<p>The Spyderisk software is open source, licensed under <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a></p>

# File upload
spring.servlet.multipart.max-file-size=100MB
Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/static/css/welcome.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ html, body {
margin-top: 10px;
}

.welcome-page .eula-textbox {
border: 2px solid #000;
padding: 15px;
overflow-y: auto;
height: 200px;
width: 470px;
}

.footer {
background-color: #000000;
height: 50px;
Expand Down
12 changes: 0 additions & 12 deletions src/main/resources/templates/EULA.html

This file was deleted.

3 changes: 2 additions & 1 deletion src/main/resources/templates/welcome.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ <h1 class="text-center branding">SPYDE<b>RISK</b></h1>
<a th:href="@{~/documentation}" class="btn btn-primary btn-large">View Documentation</a>
</div>
<div class="eula">
<a th:href="@{/EULA}" >End User License Agreement</a>
<h3 class="text-center">End User License Agreement</h3>
<div class="eula-textbox" th:utext="${@environment.getProperty('eula.html')}"></div>
</div>
</div>
<div class="footer">
Expand Down

0 comments on commit efd73de

Please sign in to comment.