Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VUU333: Implement SSL on Layout Server #1120

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions layout-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.finos.vuu.layoutserver;
package org.finos.vuu.layoutserver.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.finos.vuu.layoutserver.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.web.SecurityFilterChain;

@Configuration
@EnableWebSecurity
public class SecurityConfig {

@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http.requiresChannel().anyRequest().requiresSecure();
return http.build();
}

}
7 changes: 7 additions & 0 deletions layout-server/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
server.port=8081
server.servlet.contextPath=/api
springdoc.swagger-ui.path=/swagger
# SSL
server.ssl.enabled=true
server.ssl.key-store-type=PKCS12
server.ssl.key-store=classpath:certs/localhost.p12
server.ssl.key-store-password=password
server.ssl.key-alias=1
# Database
spring.datasource.url=jdbc:h2:mem:layoutdb;NON_KEYWORDS=GROUP,USER
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions vuu-ui/scripts/esbuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export async function build(config) {
define: {
"process.env.NODE_ENV": `"${env}"`,
"process.env.NODE_DEBUG": `false`,
"process.env.LOCAL": `true`,
"process.env.LAYOUT_BASE_URL": `"http://127.0.0.1:8081/api"`,
"process.env.LOCAL": `false`,
"process.env.LAYOUT_BASE_URL": `"https://localhost:8081/api"`,
},
external,
footer,
Expand Down
4 changes: 2 additions & 2 deletions vuu-ui/showcase/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export default defineConfig({
},
define: {
"process.env.NODE_DEBUG": false,
"process.env.LOCAL": true,
"process.env.LAYOUT_BASE_URL": `"http://127.0.0.1:8081/api"`,
"process.env.LOCAL": false,
"process.env.LAYOUT_BASE_URL": `"https://localhost:8081/api"`,
},
esbuild: {
jsx: `automatic`,
Expand Down