Skip to content

Commit

Permalink
Use env ribbon
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Sep 26, 2023
1 parent e1ee485 commit 637b020
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<link href="/api/v1/disclaimer" rel="stylesheet">
<meta
name="description"
content="SURFconext Invite"
Expand Down
18 changes: 18 additions & 0 deletions client/src/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
@import "styles/tooltip";
@import "styles/forms";
@import "styles/responsive";

body:after {
position: fixed;
width: 109px;
height: 28px;
top: 15px;
right: -25px;
text-align: center;
font-size: 16px;
font-family: sans-serif;
text-transform: uppercase;
font-weight: bold;
color: white;
line-height: 30px;
transform: rotate(45deg);
}


33 changes: 33 additions & 0 deletions server/src/main/java/access/api/EnvironmentController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package access.api;

import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
public class EnvironmentController {


private final String disclaimerBackgroundColor;
private final String disclaimerContent;

public EnvironmentController(@Value("${gui.disclaimer.background-color}") String disclaimerBackgroundColor,
@Value("${gui.disclaimer.content}") String disclaimerContent) {
this.disclaimerBackgroundColor = disclaimerBackgroundColor;
this.disclaimerContent = disclaimerContent;
}

@GetMapping("/api/v1/disclaimer")
public void disclaimer(HttpServletResponse response) throws IOException {
response.setContentType("text/css");
response.getWriter().write("body::after {background: " + disclaimerBackgroundColor + ";content: \"" +
disclaimerContent + "\";}");
response.getWriter().flush();

}

}
1 change: 1 addition & 0 deletions server/src/main/java/access/security/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ SecurityFilterChain sessionSecurityFilterChain(HttpSecurity http,
.authorizeHttpRequests(c -> c
.requestMatchers(
"/api/v1/csrf",
"/api/v1/disclaimer",
"/api/v1/users/config",
"/api/v1/users/logout",
"/api/v1/invitations/public",
Expand Down
5 changes: 5 additions & 0 deletions server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ institution-admin:
entitlement: "urn:mace:surfnet.nl:surfnet.nl:sab:role:SURFconextverantwoordelijke"
organization-guid-prefix: "urn:mace:surfnet.nl:surfnet.nl:sab:organizationGUID:"

gui:
disclaimer:
background-color: red
content: LOCAL

config:
client-url: "http://localhost:3000"
welcome-url: "http://localhost:4000"
Expand Down

0 comments on commit 637b020

Please sign in to comment.