springSecurity的使用整合ssm
2021-03-02 16:28
标签:group 12px ref 跨域 any logo disable schema ota 一.导入坐标 四.由于controlle层的实现控制都教给了security框架,只要写一个service业务 1.public interface IUserService extends UserDetailsService 定义一个service接口继承UserDetailsService 2.service的实现,重写loadUserByUsername方法
springSecurity的使用整合ssm 标签:group 12px ref 跨域 any logo disable schema ota 原文地址:https://www.cnblogs.com/jerrybu/p/14404285.html
spring-security-web
spring-security-config
spring-security-core
spring-security-taglibs
二.web.xml中配置三.编写springSecurity.xml
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd">
login-processing-url="/login.do"
default-target-url="/index.jsp"
authentication-failure-url="/failer.jsp"
authentication-success-forward-url="/pages/main.jsp"
/>@Service("userServices")//绑定 user-service-ref
@Transactional
public class IUserServiceImpl implements IUserService {
@Autowired
private IUserDao iUserDao;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
UsersInfo usersInfo = iUserDao.findName(username);//获取自己的user类对象属性
//处理自己的对象封装成UserDetails对象,使用UserDetails的实现类User类进行处理
User user =new User(usersInfo.getUsername(),usersInfo.getPassword(),"权限认证的方法");
return user;
}
}
文章标题:springSecurity的使用整合ssm
文章链接:http://soscw.com/index.php/essay/59108.html