Skip to content
Snippets Groups Projects
Commit 479ada65 authored by Otto Visser's avatar Otto Visser
Browse files

Fix production version again (broken by getting development/local

working)
parent f011caa8
No related branches found
No related tags found
No related merge requests found
...@@ -17,11 +17,14 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -17,11 +17,14 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.Profile;
import org.springframework.core.io.ResourceLoader; import org.springframework.core.io.ResourceLoader;
import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.saml.*; import org.springframework.security.saml.*;
import org.springframework.security.saml.context.SAMLContextProviderImpl; import org.springframework.security.saml.context.SAMLContextProviderImpl;
...@@ -49,6 +52,8 @@ import org.springframework.security.web.util.matcher.AntPathRequestMatcher; ...@@ -49,6 +52,8 @@ import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import java.util.*; import java.util.*;
@Profile("production") @Profile("production")
@Configuration
@EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true)
public class SamlWebSecurityConfig extends WebSecurityConfigurerAdapter { public class SamlWebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired @Autowired
...@@ -102,6 +107,35 @@ public class SamlWebSecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -102,6 +107,35 @@ public class SamlWebSecurityConfig extends WebSecurityConfigurerAdapter {
return http; return http;
} }
/**
* Defines the web based security configuration.
*
* @param http It allows configuring web based security for specific http requests.
* @throws Exception
*/
@Override
protected void configure(HttpSecurity http) throws Exception {
http = samlizedConfig(http);
http.authorizeRequests()
.antMatchers("/").permitAll()
.antMatchers("/manifest.json").permitAll()
.antMatchers("/favicon.ico").permitAll()
.antMatchers("/sw.js").permitAll()
.antMatchers("/css/**").permitAll()
.antMatchers("/img/**").permitAll()
.antMatchers("/js/**").permitAll()
.antMatchers("/webjars/**").permitAll()
.antMatchers("/stomp/**").permitAll()
.antMatchers("/saml/**").permitAll()
.anyRequest()
.authenticated();
http
.logout()
.logoutSuccessUrl("/");
}
@Bean @Bean
public static SAMLBootstrap SAMLBootstrap() { public static SAMLBootstrap SAMLBootstrap() {
return new SAMLBootstrap(); return new SAMLBootstrap();
......
...@@ -51,5 +51,4 @@ public class SSOController { ...@@ -51,5 +51,4 @@ public class SSOController {
private boolean isForwarded(HttpServletRequest request) { private boolean isForwarded(HttpServletRequest request) {
return request.getAttribute("javax.servlet.forward.request_uri") != null; return request.getAttribute("javax.servlet.forward.request_uri") != null;
} }
} }
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="#" th:href="${#mvc.url('PC#profile').build()}">Profile</a></li> <li><a href="#" th:href="${#mvc.url('PC#profile').build()}">Profile</a></li>
<li><a href="#" onclick="$('#logout').submit();">Logout</a></li> <li><a href="#" th:href="@{/saml/logout}">Logout</a></li>
</ul> </ul>
</li> </li>
</th:block> </th:block>
...@@ -80,8 +80,6 @@ ...@@ -80,8 +80,6 @@
</li> </li>
</ul> </ul>
</div> </div>
<form th:action="${#mvc.url('AC#logout').build()}" method="POST" id="logout">
</form>
</div> </div>
</nav> </nav>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment