wlzboy
5 天以前 7de1396e315896dbc72a9d54e44f77434ea90f18
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
@@ -21,6 +21,7 @@
import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl;
import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl;
import com.ruoyi.framework.security.WechatAuthenticationProvider;
import com.ruoyi.framework.security.QyWechatAuthenticationProvider;
import com.ruoyi.common.annotation.Anonymous;
import org.springframework.security.web.util.matcher.RequestMatcher;
import org.springframework.web.method.HandlerMethod;
@@ -85,6 +86,12 @@
    private WechatAuthenticationProvider wechatAuthenticationProvider;
    /**
     * 企业微信认证提供者
     */
    @Autowired
    private QyWechatAuthenticationProvider qyWechatAuthenticationProvider;
    /**
     * 获取所有标注了@Anonymous的URL
     */
    private Set<String> getAnonymousUrls() {
@@ -105,7 +112,7 @@
    /**
     * 身份验证实现
     * 支持用户名密码认证和微信认证
     * 支持用户名密码认证、微信认证和企业微信认证
     */
    @Bean
    public AuthenticationManager authenticationManager()
@@ -116,7 +123,7 @@
        daoAuthenticationProvider.setPasswordEncoder(bCryptPasswordEncoder());
        
        // 返回ProviderManager,支持多种认证方式
        return new ProviderManager(daoAuthenticationProvider, wechatAuthenticationProvider);
        return new ProviderManager(daoAuthenticationProvider, wechatAuthenticationProvider, qyWechatAuthenticationProvider);
    }
    /**