| | |
| | | import com.google.code.kaptcha.util.Config; |
| | | import com.ks.goldcorn.entity.AdminUser; |
| | | import com.ks.goldcorn.service.AdminUserManager; |
| | | import io.seata.rm.datasource.DataSourceProxy; |
| | | import net.sf.json.JSONObject; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Primary; |
| | | import org.springframework.security.authentication.BadCredentialsException; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | import org.springframework.security.authentication.dao.DaoAuthenticationProvider; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | | import javax.sql.DataSource; |
| | | import java.io.IOException; |
| | | import java.util.Properties; |
| | | |
| | | @EnableWebSecurity |
| | | public class WebSecurityConfig extends WebSecurityConfigurerAdapter { |
| | | |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class); |
| | | |
| | | @Resource |
| | | private AdminUserManager adminUserManager; |
| | | |
| | | private final String LOGIN_PROCESSING_URL="/admin/api/login"; |
| | | private final String LOGIN_PROCESSING_URL = "/admin/api/login"; |
| | | |
| | | //图形验证码配置 |
| | | @Bean |
| | |
| | | |
| | | @Override |
| | | protected void configure(HttpSecurity http) throws Exception { |
| | | http.headers().frameOptions().disable(); |
| | | http.authorizeRequests() |
| | | .antMatchers("/admin/api/captcha.jpg*").permitAll() |
| | | .antMatchers("/admin/api/*").authenticated() |
| | | .antMatchers("/admin/api/**", "/index.html").authenticated() |
| | | .and() |
| | | .formLogin() |
| | | //自定义登录界面 |
| | |
| | | @Override |
| | | public void onLogoutSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException { |
| | | logger.info("onLogoutSuccess"); |
| | | |
| | | } |
| | | }) |
| | | .and() |