Reorganized classes according to the last pull request's comments.
This commit is contained in:
parent
7e0bf584a1
commit
858d14baf3
|
@ -1,9 +1,8 @@
|
||||||
package org.baeldung.spring;
|
package org.baeldung.security.filter.configuration;
|
||||||
|
|
||||||
import org.baeldung.security.basic.MyBasicAuthenticationEntryPoint;
|
import org.baeldung.security.basic.MyBasicAuthenticationEntryPoint;
|
||||||
import org.baeldung.security.filter.CustomFilter;
|
import org.baeldung.security.filter.CustomFilter;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
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.HttpSecurity;
|
||||||
|
@ -13,28 +12,29 @@ import org.springframework.security.web.authentication.www.BasicAuthenticationFi
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
@ComponentScan("org.baeldung.security")
|
public class CustomWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
|
||||||
public class SecSecurityConfigJava extends WebSecurityConfigurerAdapter {
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MyBasicAuthenticationEntryPoint authenticationEntryPoint;
|
private MyBasicAuthenticationEntryPoint authenticationEntryPoint;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
|
public void configureGlobal(AuthenticationManagerBuilder auth)
|
||||||
|
throws Exception {
|
||||||
auth
|
auth
|
||||||
.inMemoryAuthentication()
|
.inMemoryAuthentication()
|
||||||
.withUser("user1").password("user1Pass").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(), BasicAuthenticationFilter.class);
|
http.addFilterAfter(new CustomFilter(),
|
||||||
|
BasicAuthenticationFilter.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -2,14 +2,13 @@ package org.baeldung.spring;
|
||||||
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.ImportResource;
|
|
||||||
|
|
||||||
//@Configuration
|
@Configuration
|
||||||
|
@ComponentScan("org.baeldung.security")
|
||||||
//@ImportResource({ "classpath:webSecurityConfig.xml" })
|
//@ImportResource({ "classpath:webSecurityConfig.xml" })
|
||||||
//@ComponentScan("org.baeldung.security")
|
public class SecSecurityConfig {
|
||||||
public class SecSecurityConfigXML {
|
|
||||||
|
|
||||||
public SecSecurityConfigXML() {
|
public SecSecurityConfig() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue