You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package com.teaching.backend.config;
|
|
|
|
|
|
|
|
|
|
|
|
import com.teaching.backend.service.umsAdmin.UmsUserService;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* mall-security模块相关配置
|
|
|
|
* Created by macro on 2019/11/9.
|
|
|
|
*/
|
|
|
|
@Configuration
|
|
|
|
public class MallSecurityConfig {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private UmsUserService umsadminService;
|
|
|
|
// @Autowired
|
|
|
|
// private UmsResourceService resourceService;
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
public UserDetailsService userDetailsService() {
|
|
|
|
//获取登录用户信息
|
|
|
|
return username -> umsadminService.loadUserByUsername(username);
|
|
|
|
}
|
|
|
|
|
|
|
|
// @Bean
|
|
|
|
// public DynamicSecurityService dynamicSecurityService() {
|
|
|
|
// return new DynamicSecurityService() {
|
|
|
|
// @Override
|
|
|
|
// public Map<String, ConfigAttribute> loadDataSource() {
|
|
|
|
// Map<String, ConfigAttribute> map = new ConcurrentHashMap<>();
|
|
|
|
// List<UmsResource> resourceList = resourceService.listAll();
|
|
|
|
// for (UmsResource resource : resourceList) {
|
|
|
|
// map.put(resource.getUrl(), new org.springframework.security.access.SecurityConfig(resource.getId() + ":" + resource.getName()));
|
|
|
|
// }
|
|
|
|
// return map;
|
|
|
|
// }
|
|
|
|
// };
|
|
|
|
// }
|
|
|
|
}
|