Reformat CustomWebSecurityConfigurerAdapter
This commit is contained in:
parent
6cca052251
commit
b451fcfc02
|
@ -13,28 +13,27 @@ import org.springframework.security.web.authentication.www.BasicAuthenticationFi
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
public class CustomWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
|
public class CustomWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MyBasicAuthenticationEntryPoint authenticationEntryPoint;
|
private MyBasicAuthenticationEntryPoint authenticationEntryPoint;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public void configureGlobal(AuthenticationManagerBuilder auth)
|
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
|
||||||
throws Exception {
|
auth.inMemoryAuthentication()
|
||||||
auth
|
.withUser("user1").password("user1Pass")
|
||||||
.inMemoryAuthentication()
|
.authorities("ROLE_USER");
|
||||||
.withUser("user1").password("user1Pass")
|
|
||||||
.authorities("ROLE_USER");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
http.authorizeRequests()
|
http.authorizeRequests()
|
||||||
.antMatchers("/securityNone").permitAll()
|
.antMatchers("/securityNone").permitAll()
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
.and()
|
.and()
|
||||||
.httpBasic()
|
.httpBasic()
|
||||||
.authenticationEntryPoint(authenticationEntryPoint);
|
.authenticationEntryPoint(authenticationEntryPoint);
|
||||||
|
|
||||||
http.addFilterAfter(new CustomFilter(),
|
http.addFilterAfter(new CustomFilter(),
|
||||||
BasicAuthenticationFilter.class);
|
BasicAuthenticationFilter.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue