【SSM项目实战讲解】汽车租赁管理系统项目功能演示与课程说明
配置模板页面
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <% String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/"; %> <html> <head> <title>管理员登录页面</title> <link rel="stylesheet" href="<%=basePath%>layui/css/layui.css"/> <script type="text/javascript" src="<%=basePath%>js/jquery.js"></script> <script type="text/javascript" src="<%=basePath%>layui/layui.js"></script> </head> <body> <div> </div> </body>
``
******在 shiro课程讲解中有完整的讲解过 Realm的定义****
```javascript
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException { log.info("========登录授权认证========"); // 1 、取得用户名 String username = (String) authenticationToken.getPrincipal(); try { Admin vo = this.adminServiceBack.login(username); if (vo == null) { throw new UnknownAccountException("用户不存在!"); } else { // 2 、取得登录密码 String password = (new String((char[]) authenticationToken.getCredentials())); if (vo.getPassword().equals(password)) { AuthenticationInfo auth = new SimpleAuthenticationInfo(username, password, "adminRealm"); return auth; } else { throw new IncorrectCredentialsException("密码错误!");
**课程问题答疑:**