package pl.hycom.pip.messanger.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

	private static final String ROLE_ADMIN = "ADMIN";

	@Override
	protected void configure(HttpSecurity http) throws Exception {
		http
				.authorizeRequests()
				.antMatchers("/db-admin/console/**", "/webhook/**").permitAll()
				.antMatchers("/admin/**").hasRole("ADMIN")
				.anyRequest().authenticated()
				.and()
				.formLogin()
				.loginPage("/login")
				.permitAll();

		http
				.csrf()
				.ignoringAntMatchers("/db-admin/console/**");

		http.headers().frameOptions().disable();
	}

	@Override
	protected void configure(AuthenticationManagerBuilder authManagerBuilder) throws Exception {
		authManagerBuilder.inMemoryAuthentication()
				.withUser("admin").password("admin").roles(ROLE_ADMIN);
	}

	@Override
	public void configure(WebSecurity webSecurity) {
		webSecurity.ignoring().antMatchers("/css/**", "/js/**");
	}
}
@@ -868,19 +868,16 @@
 /webhook
-/**
 %22).permi
@@ -921,23 +921,26 @@
 hasRole(
-%22
+ROLE_
 ADMIN
-%22
 )%0A%09%09%09%09.a
@@ -963,24 +963,25 @@
 enticated()%0A
+%0A
 %09%09%09%09.and()%0A%09
@@ -995,21 +995,16 @@
 mLogin()
-%0A%09%09%09%09
 .loginPa
@@ -1015,21 +1015,16 @@
 /login%22)
-%0A%09%09%09%09
 .permitA
@@ -1027,25 +1027,28 @@
 mitAll()
-;
 %0A%0A%09%09
+%09
-http
+%09.and()
 %0A%09%09%09%09.cs
@@ -1051,21 +1051,16 @@
 %09.csrf()
-%0A%09%09%09%09
 .ignorin
@@ -1099,17 +1099,25 @@
 **%22)
-;
 %0A%0A%09%09
-http
+%09%09.and()%0A%09%09%09%09
 .hea

fix dla messenger api