File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package pl .orange .bst .mixer ;
2+
3+ import org .springframework .beans .factory .annotation .Value ;
4+ import org .springframework .context .annotation .Bean ;
5+ import org .springframework .context .annotation .Configuration ;
6+ import org .springframework .context .annotation .Profile ;
7+ import org .springframework .security .config .annotation .method .configuration .EnableGlobalMethodSecurity ;
8+ import org .springframework .security .config .annotation .web .builders .HttpSecurity ;
9+ import org .springframework .security .config .annotation .web .configuration .EnableWebSecurity ;
10+ import org .springframework .security .config .annotation .web .configuration .WebSecurityConfigurerAdapter ;
11+ import org .springframework .security .core .authority .AuthorityUtils ;
12+ import org .springframework .security .core .userdetails .User ;
13+ import org .springframework .security .core .userdetails .UserDetails ;
14+ import org .springframework .security .core .userdetails .UserDetailsService ;
15+ import org .springframework .security .core .userdetails .UsernameNotFoundException ;
16+
17+ import java .util .List ;
18+ import java .util .stream .Collectors ;
19+ import java .util .stream .Stream ;
20+
21+ @ Configuration
22+ @ EnableWebSecurity
23+ @ EnableGlobalMethodSecurity (prePostEnabled = true )
24+ @ Profile ("noauth" )
25+ public class NoAuthSecurityConfig extends WebSecurityConfigurerAdapter {
26+
27+
28+ @ Override
29+ protected void configure (HttpSecurity http ) throws Exception {
30+ http .csrf ().disable ();
31+ http
32+ .authorizeRequests ()
33+ .antMatchers ("/**" ).permitAll ();
34+ }
35+ }
Original file line number Diff line number Diff line change 88import org .springframework .boot .autoconfigure .SpringBootApplication ;
99import org .springframework .context .annotation .Bean ;
1010import org .springframework .context .annotation .Configuration ;
11+ import org .springframework .context .annotation .Profile ;
1112import org .springframework .security .config .annotation .method .configuration .EnableGlobalMethodSecurity ;
1213import org .springframework .security .config .annotation .web .builders .HttpSecurity ;
1314import org .springframework .security .config .annotation .web .configuration .EnableWebSecurity ;
2627@ Configuration
2728@ EnableWebSecurity
2829@ EnableGlobalMethodSecurity (prePostEnabled = true )
29- public class Config extends WebSecurityConfigurerAdapter {
30+ @ Profile ("!noauth" )
31+ public class SecurityConfig extends WebSecurityConfigurerAdapter {
3032
3133 @ Value ("${allowed.users}" )
3234 private String commonNames ;
Original file line number Diff line number Diff line change @@ -5,6 +5,6 @@ server.ssl.keyStoreType: PKCS12
55server.ssl.key-alias =mixer
66server.ssl.trust-store =etc/pki/trust.jks
77server.ssl.trust-store-password =changeit
8- server.ssl.client-auth =need
8+ server.ssl.client-auth =want
99openvasmd.socket =/usr/local/var/run/openvasmd.sock
1010allowed.users =localhost,127.0.0.1
You can’t perform that action at this time.
0 commit comments