|
@@ -4,6 +4,7 @@ import com.its.vds.webapp.security.SessionListener;
|
|
import com.its.vds.webapp.service.UserService;
|
|
import com.its.vds.webapp.service.UserService;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
+import org.springframework.http.HttpMethod;
|
|
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;
|
|
import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
|
import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
|
@@ -25,13 +26,26 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
this.userService = userService;
|
|
this.userService = userService;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
public void configure(WebSecurity web) throws Exception {
|
|
public void configure(WebSecurity web) throws Exception {
|
|
|
|
+ web.ignoring().antMatchers("/favicon.ico");
|
|
web.ignoring().antMatchers(new String[]{"/css/**", "/js/**", "/img/**", "/lib/**"});
|
|
web.ignoring().antMatchers(new String[]{"/css/**", "/js/**", "/img/**", "/lib/**"});
|
|
|
|
+
|
|
|
|
+ web.ignoring().antMatchers(HttpMethod.GET, "/api/**"); // GET Method 는 모두 통과
|
|
|
|
+ web.ignoring().antMatchers(HttpMethod.POST, "/api/**"); // GET Method 는 모두 통과
|
|
|
|
+ web.ignoring().antMatchers(HttpMethod.PUT, "/api/**"); // GET Method 는 모두 통과
|
|
|
|
+ web.ignoring().antMatchers(HttpMethod.DELETE, "/api/**"); // GET Method 는 모두 통과
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
protected void configure(HttpSecurity http) throws Exception {
|
|
protected void configure(HttpSecurity http) throws Exception {
|
|
|
|
|
|
http.authorizeRequests()
|
|
http.authorizeRequests()
|
|
|
|
+ // SWAGGER 권한 설정
|
|
|
|
+ .antMatchers("/swagger-ui.html", "/swagger/**", "/swagger-resources/**", "/webjars/**", "/v2/api-docs").permitAll()
|
|
|
|
+ // 웹소켓 권한 설정하지
|
|
|
|
+ .antMatchers("/ws/**").permitAll()
|
|
|
|
+ .antMatchers("/api/**").permitAll()
|
|
.antMatchers(new String[]{"/index"})
|
|
.antMatchers(new String[]{"/index"})
|
|
.hasRole("ADMIN")
|
|
.hasRole("ADMIN")
|
|
.antMatchers(new String[]{"/**"})
|
|
.antMatchers(new String[]{"/**"})
|