BAEL-315 - reformatting config classes
This commit is contained in:
parent
be45787757
commit
e087fc921e
@ -18,13 +18,12 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
http
|
http.authorizeRequests()
|
||||||
.authorizeRequests()
|
.anyRequest().hasRole("SYSTEM")
|
||||||
.anyRequest().hasRole("SYSTEM")
|
.and()
|
||||||
.and()
|
.httpBasic()
|
||||||
.httpBasic()
|
.and()
|
||||||
.and()
|
.csrf()
|
||||||
.csrf()
|
.disable();
|
||||||
.disable();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,21 +22,20 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
http
|
http.sessionManagement()
|
||||||
.sessionManagement()
|
.sessionCreationPolicy(SessionCreationPolicy.ALWAYS)
|
||||||
.sessionCreationPolicy(SessionCreationPolicy.ALWAYS)
|
.and()
|
||||||
.and()
|
.requestMatchers()
|
||||||
.requestMatchers()
|
.antMatchers("/eureka/**")
|
||||||
.antMatchers("/eureka/**")
|
.and()
|
||||||
.and()
|
.authorizeRequests()
|
||||||
.authorizeRequests()
|
.antMatchers("/eureka/**").hasRole("SYSTEM")
|
||||||
.antMatchers("/eureka/**").hasRole("SYSTEM")
|
.anyRequest().denyAll()
|
||||||
.anyRequest().denyAll()
|
.and()
|
||||||
.and()
|
.httpBasic()
|
||||||
.httpBasic()
|
.and()
|
||||||
.and()
|
.csrf()
|
||||||
.csrf()
|
.disable();
|
||||||
.disable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@ -14,25 +14,24 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
@Autowired
|
@Autowired
|
||||||
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
|
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
|
||||||
auth.inMemoryAuthentication()
|
auth.inMemoryAuthentication()
|
||||||
.withUser("user").password("password").roles("USER")
|
.withUser("user").password("password").roles("USER")
|
||||||
.and()
|
.and()
|
||||||
.withUser("admin").password("admin").roles("ADMIN");
|
.withUser("admin").password("admin").roles("ADMIN");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
http
|
http.authorizeRequests()
|
||||||
.authorizeRequests()
|
.antMatchers("/resource/hello/cloud").permitAll()
|
||||||
.antMatchers("/resource/hello/cloud").permitAll()
|
.antMatchers("/eureka/**").hasRole("ADMIN")
|
||||||
.antMatchers("/eureka/**").hasRole("ADMIN")
|
.anyRequest().authenticated()
|
||||||
.anyRequest().authenticated()
|
.and()
|
||||||
.and()
|
.formLogin()
|
||||||
.formLogin()
|
.and()
|
||||||
.and()
|
.logout().permitAll()
|
||||||
.logout().permitAll()
|
.logoutSuccessUrl("/resource/hello/cloud").permitAll()
|
||||||
.logoutSuccessUrl("/resource/hello/cloud").permitAll()
|
.and()
|
||||||
.and()
|
.csrf()
|
||||||
.csrf()
|
.disable();
|
||||||
.disable();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,16 +19,15 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
http
|
http.httpBasic()
|
||||||
.httpBasic()
|
.disable()
|
||||||
.disable()
|
.authorizeRequests()
|
||||||
.authorizeRequests()
|
.antMatchers("/hello/cloud").permitAll()
|
||||||
.antMatchers("/hello/cloud").permitAll()
|
.antMatchers("/hello/user").hasAnyRole("USER", "ADMIN")
|
||||||
.antMatchers("/hello/user").hasAnyRole("USER", "ADMIN")
|
.antMatchers("/hello/admin").hasRole("ADMIN")
|
||||||
.antMatchers("/hello/admin").hasRole("ADMIN")
|
.anyRequest().authenticated()
|
||||||
.anyRequest().authenticated()
|
.and()
|
||||||
.and()
|
.csrf()
|
||||||
.csrf()
|
.disable();
|
||||||
.disable();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user