From 6159dc58f50d3e4680779b7989bbd4d49a76bad5 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 09 五月 2025 19:13:35 +0800 Subject: [PATCH] 添加日志 --- src/main/java/com/taoke/autopay/config/WebSecurityConfig.java | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/taoke/autopay/config/WebSecurityConfig.java b/src/main/java/com/taoke/autopay/config/WebSecurityConfig.java index 1ab4317..95b5e64 100644 --- a/src/main/java/com/taoke/autopay/config/WebSecurityConfig.java +++ b/src/main/java/com/taoke/autopay/config/WebSecurityConfig.java @@ -14,6 +14,7 @@ import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.dao.DaoAuthenticationProvider; +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.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; @@ -182,7 +183,7 @@ * @param: httpServletRequest **/ private void verificationCode(HttpServletRequest httpServletRequest) throws VerificationCodeException { - String requestCode = httpServletRequest.getParameter("captcha"); + String requestCode = httpServletRequest.getParameter("code"); HttpSession httpSession = httpServletRequest.getSession(); String captcha = httpSession.getAttribute("captcha") + ""; httpSession.removeAttribute("captcha"); @@ -197,7 +198,7 @@ http.headers().frameOptions().disable(); http.authorizeRequests() // 閰嶇疆涓嶉渶瑕侀壌鏉冪殑鎺ュ彛 - .antMatchers("/admin/api/captcha.jpg*", "/api/**", "/webapi/**").permitAll() + .antMatchers("/admin/api/captcha.jpg*", "/api/**", "/webapi/**","/credit/api/**","*/agentapi/**").permitAll() //閰嶇疆闇�瑕侀壌鏉冪殑鎺ュ彛 .antMatchers("/admin/api/**", "/admin/index.html").authenticated() .and() @@ -250,6 +251,23 @@ // http.addFilterBefore(new PreRequestVerifyFilter(), UsernamePasswordAuthenticationFilter.class); } + + @Override + protected void configure(AuthenticationManagerBuilder auth) throws Exception { + auth.authenticationProvider(new MyAuthenticationProvider(new MyUserDetailsService(), new PasswordEncoder() { + @Override + public String encode(CharSequence charSequence) { + return charSequence.toString(); + } + + @Override + public boolean matches(CharSequence charSequence, String s) { + return s.equalsIgnoreCase(charSequence.toString()); + } + })); + + } + class MyUserDetailsService implements UserDetailsService { @Override -- Gitblit v1.8.0