liusheng
2023-06-28 993579dcbc5d87755ff8dc0cc95f53a50387b94c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.ruoyi.framework.wxopenidConfig;
 
import com.ruoyi.framework.web.service.WxOpenIDUserDetailsServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.DefaultSecurityFilterChain;
import org.springframework.stereotype.Component;
 
@Component
public class WxOpenIDAuthenticationSecurityConfig extends SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity> {
    @Autowired
    private WxOpenIDUserDetailsServiceImpl userDetailsService;
 
    @Override
    public void configure(HttpSecurity http) throws Exception {
 
        WxOpenIDAuthenticationProvider wxopenidAuthenticationProvider = new  WxOpenIDAuthenticationProvider();
        wxopenidAuthenticationProvider.setUserDetailsService(userDetailsService);
 
        http.authenticationProvider(wxopenidAuthenticationProvider);
 
    }
}