| | |
| | | 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; |
| | |
| | | private WechatAuthenticationProvider wechatAuthenticationProvider; |
| | | |
| | | /** |
| | | * 企业微信认证提供者 |
| | | */ |
| | | @Autowired |
| | | private QyWechatAuthenticationProvider qyWechatAuthenticationProvider; |
| | | |
| | | /** |
| | | * 获取所有标注了@Anonymous的URL |
| | | */ |
| | | private Set<String> getAnonymousUrls() { |
| | |
| | | |
| | | /** |
| | | * 身份验证实现 |
| | | * 支持用户名密码认证和微信认证 |
| | | * 支持用户名密码认证、微信认证和企业微信认证 |
| | | */ |
| | | @Bean |
| | | public AuthenticationManager authenticationManager() |
| | |
| | | daoAuthenticationProvider.setPasswordEncoder(bCryptPasswordEncoder()); |
| | | |
| | | // 返回ProviderManager,支持多种认证方式 |
| | | return new ProviderManager(daoAuthenticationProvider, wechatAuthenticationProvider); |
| | | return new ProviderManager(daoAuthenticationProvider, wechatAuthenticationProvider, qyWechatAuthenticationProvider); |
| | | } |
| | | |
| | | /** |