게시판 : 임시 전체 허용

This commit is contained in:
KNKIM 2021-07-21 19:02:10 +09:00
parent b786824261
commit c1f5d1617f

View File

@ -1,106 +1,107 @@
package nlib.security;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
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.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.password.PasswordEncoder;
import nlib.cmm.crypto.NlibPasswordEncoder;
/**
* <pre>
* @Class Name : SpringSecurityConfig.java
*
* @Description : Spring Security 환경설정 클래스
*
*
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
*
* </pre>
*
* @ ------------ -------- ---------------------------
* @ 수정일 수정자 수정내용
* @ ------------ -------- ---------------------------
* @ 2021. 7. 6. KNKIM 최초 생성
*
*
* @author 이씨플라자 * DIGITALSHIP KNKIM
* @since 2021. 7. 6.
* @version 1.0
*
*/
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(securedEnabled = true)
public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring()
.antMatchers("/resources/**")
.antMatchers("/css/**")
.antMatchers("/images/**")
.antMatchers("/js/**")
.antMatchers("/temp/**")
.antMatchers("/favicon/**")
.antMatchers("/*/*Ajax.do")
;
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/login/login*.do").permitAll()
.antMatchers("/login/logout*.do").permitAll()
.antMatchers("/login/naver*.do").permitAll()
.antMatchers("/member/*.do").permitAll()
.antMatchers("/member/*.ajax").permitAll()
.antMatchers("/userInfo/*.do").permitAll()
.antMatchers("/info/inform/*.do").permitAll()
.antMatchers("/").permitAll()
.antMatchers("/index.jsp").permitAll()
.antMatchers("/index.do").permitAll()
.antMatchers("/main/header.do").permitAll()
.antMatchers("/main/menu.do").permitAll()
.antMatchers("/sample/password/getSampleEncoder.do").permitAll()
.anyRequest().authenticated()
.and().formLogin()
.loginPage("/login/loginForm.do")
.permitAll()
.and().csrf()
.disable();
http.logout()
.logoutSuccessUrl("/login/loginForm.do?logout")
.invalidateHttpSession(true).deleteCookies("JSESSIONID")
;
}
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Bean
public UserDetailsService userDetailsService() {
return new SecUserDetailsService();
}
@Bean
public PasswordEncoder getPasswordEncoder() {
return new NlibPasswordEncoder();
}
}
package nlib.security;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
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.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.password.PasswordEncoder;
import nlib.cmm.crypto.NlibPasswordEncoder;
/**
* <pre>
* @Class Name : SpringSecurityConfig.java
*
* @Description : Spring Security 환경설정 클래스
*
*
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
*
* </pre>
*
* @ ------------ -------- ---------------------------
* @ 수정일 수정자 수정내용
* @ ------------ -------- ---------------------------
* @ 2021. 7. 6. KNKIM 최초 생성
*
*
* @author 이씨플라자 * DIGITALSHIP KNKIM
* @since 2021. 7. 6.
* @version 1.0
*
*/
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(securedEnabled = true)
public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring()
.antMatchers("/resources/**")
.antMatchers("/css/**")
.antMatchers("/images/**")
.antMatchers("/js/**")
.antMatchers("/temp/**")
.antMatchers("/favicon/**")
.antMatchers("/*/*Ajax.do")
.antMatchers("/board/**")
;
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/login/login*.do").permitAll()
.antMatchers("/login/logout*.do").permitAll()
.antMatchers("/login/naver*.do").permitAll()
.antMatchers("/member/*.do").permitAll()
.antMatchers("/member/*.ajax").permitAll()
.antMatchers("/userInfo/*.do").permitAll()
.antMatchers("/info/inform/*.do").permitAll()
.antMatchers("/").permitAll()
.antMatchers("/index.jsp").permitAll()
.antMatchers("/index.do").permitAll()
.antMatchers("/main/header.do").permitAll()
.antMatchers("/main/menu.do").permitAll()
.antMatchers("/sample/password/getSampleEncoder.do").permitAll()
.anyRequest().authenticated()
.and().formLogin()
.loginPage("/login/loginForm.do")
.permitAll()
.and().csrf()
.disable();
http.logout()
.logoutSuccessUrl("/login/loginForm.do?logout")
.invalidateHttpSession(true).deleteCookies("JSESSIONID")
;
}
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Bean
public UserDetailsService userDetailsService() {
return new SecUserDetailsService();
}
@Bean
public PasswordEncoder getPasswordEncoder() {
return new NlibPasswordEncoder();
}
}