|
|
|
@ -8,14 +8,15 @@
|
|
|
|
* 版权所有,侵权必究!
|
|
|
|
* 版权所有,侵权必究!
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
package com.yami.shop.admin.security;
|
|
|
|
package com.yami.shop.security.config;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.yami.shop.security.filter.LoginAuthenticationFilter;
|
|
|
|
import com.yami.shop.security.filter.LoginAuthenticationFilter;
|
|
|
|
import com.yami.shop.security.handler.LoginAuthFailedHandler;
|
|
|
|
import com.yami.shop.security.handler.LoginAuthFailedHandler;
|
|
|
|
import com.yami.shop.security.handler.LoginAuthSuccessHandler;
|
|
|
|
import com.yami.shop.security.handler.LoginAuthSuccessHandler;
|
|
|
|
import com.yami.shop.security.provider.AdminAuthenticationProvider;
|
|
|
|
import com.yami.shop.security.provider.AdminAuthenticationProvider;
|
|
|
|
import com.yami.shop.security.service.YamiUserDetailsService;
|
|
|
|
import com.yami.shop.security.provider.MiniAppAuthenticationProvider;
|
|
|
|
|
|
|
|
import lombok.AllArgsConstructor;
|
|
|
|
import lombok.SneakyThrows;
|
|
|
|
import lombok.SneakyThrows;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
@ -30,14 +31,16 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
@Configuration
|
|
|
|
@Order(90)
|
|
|
|
@Order(90)
|
|
|
|
|
|
|
|
@AllArgsConstructor
|
|
|
|
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
|
|
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private final LoginAuthSuccessHandler loginAuthSuccessHandler;
|
|
|
|
private LoginAuthSuccessHandler loginAuthSuccessHandler;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private final LoginAuthFailedHandler loginAuthFailedHandler;
|
|
|
|
private LoginAuthFailedHandler loginAuthFailedHandler;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private final AdminAuthenticationProvider adminAuthenticationProvider;
|
|
|
|
private AdminAuthenticationProvider adminAuthenticationProvider;
|
|
|
|
|
|
|
|
|
|
|
|
private final MiniAppAuthenticationProvider miniAppAuthenticationProvider;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
@ -53,6 +56,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void configure(AuthenticationManagerBuilder auth) {
|
|
|
|
public void configure(AuthenticationManagerBuilder auth) {
|
|
|
|
auth.authenticationProvider(adminAuthenticationProvider);
|
|
|
|
auth.authenticationProvider(adminAuthenticationProvider);
|
|
|
|
|
|
|
|
auth.authenticationProvider(miniAppAuthenticationProvider);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|