Commit 22b154a0 authored by Matija Obreza's avatar Matija Obreza
Browse files

CORS enabled in Spring Security

- Set CORS headers for /html/**
- Updated JSPs with CDN links
parent 474d143f
......@@ -34,7 +34,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
@RequestMapping("/robots.txt")
public class RobotsTxtController {
@Value("${base.host}")
@Value("${host.name}")
private String host;
@Value("${robots.allow}")
......
......@@ -141,6 +141,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// CSRF
.and().csrf()
// cors
.and().cors()
// Logout and login
.and().logout().logoutUrl("/logout").logoutSuccessUrl("/")
......
......@@ -174,7 +174,7 @@ public class WebConfiguration extends WebMvcConfigurerAdapter {
// .exposedHeaders("header1", "header2")
// .allowCredentials(false).maxAge(3600);
registry.addMapping("/html/**").allowCredentials(false).allowedMethods("GET", "OPTIONS", "HEAD").allowedOrigins(baseUrl);
registry.addMapping("/html/**").allowCredentials(false).allowedMethods("GET", "OPTIONS", "HEAD").allowedOrigins(baseUrl).maxAge(3600);
}
public MappingJackson2HttpMessageConverter jacksonMessageConverter() {
......
......@@ -63,7 +63,7 @@
<span class="icon-bar"></span>
</button>
<%--<a class="navbar-brand" href="<c:url value="/admin/" />"> <spring:message code="page.home.title" /> </a>--%>
<a class="navbar-brand nav-logo clearfix" href="<c:url value="/admin/" />"><img src="/html/1/images/GENESYS-ICON.svg" /><img src="/html/1/images/GENESYS-LOGO.svg" /></a>
<a class="navbar-brand nav-logo clearfix" href="<c:url value="/admin/" />"><img src="<c:url value="${cdnServers.next}/html/1/images/GENESYS-ICON.svg" />" /><img src="/html/1/images/GENESYS-LOGO.svg" /></a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<div class="col-md-7 col-lg-10 no-space">
......@@ -75,7 +75,7 @@
<span class="icon-bar"></span>
</button>
<%--<a class="navbar-brand" href="<c:url value="/admin/" />"> <spring:message code="page.home.title" /> </a>--%>
<a class="navbar-brand nav-logo clearfix" href="<c:url value="/admin/" />"><img src="/html/1/images/GENESYS-ICON.svg" /><img src="/html/1/images/GENESYS-LOGO.svg" /></a>
<a class="navbar-brand nav-logo clearfix" href="<c:url value="/admin/" />"><img src="<c:url value="${cdnServers.next}/html/1/images/GENESYS-ICON.svg" />" /><img src="<c:url value="${cdnServers.next}/html/1/images/GENESYS-LOGO.svg" />" /></a>
</div>
<ul class="nav navbar-nav nav-menu-admin">
......
......@@ -8,7 +8,7 @@
<div class="container-fluid">
<!-- <p class="text-muted">Place sticky footer content here.</p> -->
<div class="footer-logo">
<a href="<c:url value="/welcome" />"><img src="<c:url value="/html/1/images/GENESYS-ICON.svg" />" alt="Genesys - Gateway to Genetic Resources" /><img src="<c:url value="/html/1/images/GENESYS-LOGO_black.svg" />"
<a href="<c:url value="/welcome" />"><img src="<c:url value="${cdnServers.next}/html/1/images/GENESYS-ICON.svg" />" alt="Genesys - Gateway to Genetic Resources" /><img src="<c:url value="${cdnServers.next}/html/1/images/GENESYS-LOGO_black.svg" />"
alt="Genesys - Gateway to Genetic Resources" /></a>
</div>
......
......@@ -10,7 +10,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand nav-logo clearfix" href="<c:url value="/welcome" />"><img src="<c:url value="/html/1/images/GENESYS-ICON.svg" />" /><img src="<c:url value="/html/1/images/GENESYS-LOGO.svg" />" /></a>
<a class="navbar-brand nav-logo clearfix" href="<c:url value="/welcome" />"><img src="<c:url value="${cdnServers.next}/html/1/images/GENESYS-ICON.svg" />" /><img src="<c:url value="${cdnServers.next}/html/1/images/GENESYS-LOGO.svg" />" /></a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<div class="col-md-6 col-lg-9 no-space">
......@@ -21,7 +21,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand nav-logo clearfix" href="<c:url value="/welcome" />"><img src="/html/1/images/GENESYS-ICON.svg" /><img src="/html/1/images/GENESYS-LOGO.svg" /></a>
<a class="navbar-brand nav-logo clearfix" href="<c:url value="/welcome" />"><img src="<c:url value="${cdnServers.next}/html/1/images/GENESYS-ICON.svg" />" /><img src="<c:url value="${cdnServers.next}/html/1/images/GENESYS-LOGO.svg" />" /></a>
</div>
<ul class="nav navbar-nav nav-menu" id="navigation-menu">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment