From 1a4350fa1a212cd192bdf1ce059db2b7b85106f0 Mon Sep 17 00:00:00 2001 From: bseayin Date: Fri, 23 Aug 2019 22:03:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=B0=E4=BD=8F=E6=88=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SpringBootShiroRememberMe/.classpath | 36 ++++++++ SpringBootShiroRememberMe/.project | 23 +++++ .../org.eclipse.core.resources.prefs | 7 ++ .../.settings/org.eclipse.jdt.core.prefs | 5 + .../.settings/org.eclipse.m2e.core.prefs | 4 + SpringBootShiroRememberMe/pom.xml | 59 ++++++++++++ .../src/main/java/com/zz/App.java | 21 +++++ .../main/java/com/zz/config/ShiroConfig.java | 86 ++++++++++++++++++ .../main/java/com/zz/config/ShiroRealm.java | 61 +++++++++++++ .../com/zz/controller/LoginController.java | 67 ++++++++++++++ .../src/main/java/com/zz/entity/User.java | 55 +++++++++++ .../src/main/java/com/zz/pojo/ResponseBo.java | 50 ++++++++++ .../com/zz/repository/UserRepository.java | 14 +++ .../main/java/com/zz/service/UserService.java | 29 ++++++ .../src/main/java/com/zz/util/MD5Utils.java | 28 ++++++ .../src/main/resources/application.properties | 12 +++ .../src/main/resources/static/index1.html | 54 +++++++++++ .../src/main/resources/static/login1.html | 47 ++++++++++ .../SpringBootShiroRememberMe/pom.properties | 7 ++ .../zz/SpringBootShiroRememberMe/pom.xml | 59 ++++++++++++ .../target/classes/application.properties | 12 +++ .../target/classes/com/zz/App.class | Bin 0 -> 714 bytes .../classes/com/zz/config/ShiroConfig.class | Bin 0 -> 3404 bytes .../classes/com/zz/config/ShiroRealm.class | Bin 0 -> 2552 bytes .../com/zz/controller/LoginController.class | Bin 0 -> 3276 bytes .../target/classes/com/zz/entity/User.class | Bin 0 -> 1567 bytes .../classes/com/zz/pojo/ResponseBo.class | Bin 0 -> 1912 bytes .../com/zz/repository/UserRepository.class | Bin 0 -> 476 bytes .../classes/com/zz/service/UserService.class | Bin 0 -> 1584 bytes .../target/classes/com/zz/util/MD5Utils.class | Bin 0 -> 1657 bytes .../target/classes/static/index1.html | 54 +++++++++++ .../target/classes/static/login1.html | 47 ++++++++++ pom.xml | 1 + 33 files changed, 838 insertions(+) create mode 100644 SpringBootShiroRememberMe/.classpath create mode 100644 SpringBootShiroRememberMe/.project create mode 100644 SpringBootShiroRememberMe/.settings/org.eclipse.core.resources.prefs create mode 100644 SpringBootShiroRememberMe/.settings/org.eclipse.jdt.core.prefs create mode 100644 SpringBootShiroRememberMe/.settings/org.eclipse.m2e.core.prefs create mode 100644 SpringBootShiroRememberMe/pom.xml create mode 100644 SpringBootShiroRememberMe/src/main/java/com/zz/App.java create mode 100644 SpringBootShiroRememberMe/src/main/java/com/zz/config/ShiroConfig.java create mode 100644 SpringBootShiroRememberMe/src/main/java/com/zz/config/ShiroRealm.java create mode 100644 SpringBootShiroRememberMe/src/main/java/com/zz/controller/LoginController.java create mode 100644 SpringBootShiroRememberMe/src/main/java/com/zz/entity/User.java create mode 100644 SpringBootShiroRememberMe/src/main/java/com/zz/pojo/ResponseBo.java create mode 100644 SpringBootShiroRememberMe/src/main/java/com/zz/repository/UserRepository.java create mode 100644 SpringBootShiroRememberMe/src/main/java/com/zz/service/UserService.java create mode 100644 SpringBootShiroRememberMe/src/main/java/com/zz/util/MD5Utils.java create mode 100644 SpringBootShiroRememberMe/src/main/resources/application.properties create mode 100644 SpringBootShiroRememberMe/src/main/resources/static/index1.html create mode 100644 SpringBootShiroRememberMe/src/main/resources/static/login1.html create mode 100644 SpringBootShiroRememberMe/target/classes/META-INF/maven/zz/SpringBootShiroRememberMe/pom.properties create mode 100644 SpringBootShiroRememberMe/target/classes/META-INF/maven/zz/SpringBootShiroRememberMe/pom.xml create mode 100644 SpringBootShiroRememberMe/target/classes/application.properties create mode 100644 SpringBootShiroRememberMe/target/classes/com/zz/App.class create mode 100644 SpringBootShiroRememberMe/target/classes/com/zz/config/ShiroConfig.class create mode 100644 SpringBootShiroRememberMe/target/classes/com/zz/config/ShiroRealm.class create mode 100644 SpringBootShiroRememberMe/target/classes/com/zz/controller/LoginController.class create mode 100644 SpringBootShiroRememberMe/target/classes/com/zz/entity/User.class create mode 100644 SpringBootShiroRememberMe/target/classes/com/zz/pojo/ResponseBo.class create mode 100644 SpringBootShiroRememberMe/target/classes/com/zz/repository/UserRepository.class create mode 100644 SpringBootShiroRememberMe/target/classes/com/zz/service/UserService.class create mode 100644 SpringBootShiroRememberMe/target/classes/com/zz/util/MD5Utils.class create mode 100644 SpringBootShiroRememberMe/target/classes/static/index1.html create mode 100644 SpringBootShiroRememberMe/target/classes/static/login1.html diff --git a/SpringBootShiroRememberMe/.classpath b/SpringBootShiroRememberMe/.classpath new file mode 100644 index 0000000..16c89cc --- /dev/null +++ b/SpringBootShiroRememberMe/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SpringBootShiroRememberMe/.project b/SpringBootShiroRememberMe/.project new file mode 100644 index 0000000..77a7d00 --- /dev/null +++ b/SpringBootShiroRememberMe/.project @@ -0,0 +1,23 @@ + + + SpringBootShiroRememberMe + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/SpringBootShiroRememberMe/.settings/org.eclipse.core.resources.prefs b/SpringBootShiroRememberMe/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..02595f7 --- /dev/null +++ b/SpringBootShiroRememberMe/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/resources/application.properties=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/=UTF-8 diff --git a/SpringBootShiroRememberMe/.settings/org.eclipse.jdt.core.prefs b/SpringBootShiroRememberMe/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/SpringBootShiroRememberMe/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/SpringBootShiroRememberMe/.settings/org.eclipse.m2e.core.prefs b/SpringBootShiroRememberMe/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/SpringBootShiroRememberMe/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/SpringBootShiroRememberMe/pom.xml b/SpringBootShiroRememberMe/pom.xml new file mode 100644 index 0000000..edde0da --- /dev/null +++ b/SpringBootShiroRememberMe/pom.xml @@ -0,0 +1,59 @@ + + 4.0.0 + + zz + SpringBoot2 + 0.0.1-SNAPSHOT + + SpringBootShiroRememberMe + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-devtools + true + + + + + mysql + mysql-connector-java + 8.0.15 + + + + + org.apache.shiro + shiro-spring + 1.4.0 + + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + + + alimaven + aliyun maven + http://maven.aliyun.com/nexus/content/groups/public/ + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + \ No newline at end of file diff --git a/SpringBootShiroRememberMe/src/main/java/com/zz/App.java b/SpringBootShiroRememberMe/src/main/java/com/zz/App.java new file mode 100644 index 0000000..78a2e87 --- /dev/null +++ b/SpringBootShiroRememberMe/src/main/java/com/zz/App.java @@ -0,0 +1,21 @@ +package com.zz; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; +/** + * 右键--》run as application 运行正启动类的main方法,就可以启动这个springboot项目。 +SpringBoot 自带了 tomcat, 运行这个main方法 的时候,会同时启动tomcat + * @author jiyu + * + */ +@SpringBootApplication +@EnableScheduling +public class App { + + public static void main(String[] args) { + // TODO Auto-generated method stub + SpringApplication.run(App.class, args); + } + +} diff --git a/SpringBootShiroRememberMe/src/main/java/com/zz/config/ShiroConfig.java b/SpringBootShiroRememberMe/src/main/java/com/zz/config/ShiroConfig.java new file mode 100644 index 0000000..b7546ff --- /dev/null +++ b/SpringBootShiroRememberMe/src/main/java/com/zz/config/ShiroConfig.java @@ -0,0 +1,86 @@ +package com.zz.config; + +import java.util.LinkedHashMap; + +import org.apache.shiro.codec.Base64; +import org.apache.shiro.mgt.SecurityManager; +import org.apache.shiro.spring.LifecycleBeanPostProcessor; +import org.apache.shiro.spring.web.ShiroFilterFactoryBean; +import org.apache.shiro.web.mgt.CookieRememberMeManager; +import org.apache.shiro.web.mgt.DefaultWebSecurityManager; +import org.apache.shiro.web.servlet.SimpleCookie; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + + +@Configuration +public class ShiroConfig { + + @Bean + public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager) { + ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean(); + shiroFilterFactoryBean.setSecurityManager(securityManager); + shiroFilterFactoryBean.setLoginUrl("/login"); + shiroFilterFactoryBean.setSuccessUrl("/index"); + shiroFilterFactoryBean.setUnauthorizedUrl("/403"); + + LinkedHashMap filterChainDefinitionMap = new LinkedHashMap<>(); + + filterChainDefinitionMap.put("/css/**", "anon"); + filterChainDefinitionMap.put("/js/**", "anon"); + filterChainDefinitionMap.put("/fonts/**", "anon"); + filterChainDefinitionMap.put("/img/**", "anon"); + filterChainDefinitionMap.put("/druid/**", "anon"); + filterChainDefinitionMap.put("/logout", "logout"); + filterChainDefinitionMap.put("/", "anon"); + filterChainDefinitionMap.put("/**", "user"); + + shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap); + + return shiroFilterFactoryBean; + } + + @Bean + public SecurityManager securityManager(){ + DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); + securityManager.setRealm(shiroRealm()); + securityManager.setRememberMeManager(rememberMeManager()); + return securityManager; + } + + @Bean(name = "lifecycleBeanPostProcessor") + public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() { + return new LifecycleBeanPostProcessor(); + } + + @Bean + public ShiroRealm shiroRealm(){ + ShiroRealm shiroRealm = new ShiroRealm(); + return shiroRealm; + } + + /** + * cookie对象 + * @return + */ + public SimpleCookie rememberMeCookie() { + // 设置cookie名称,对应login.html页面的 + SimpleCookie cookie = new SimpleCookie("rememberMe"); + // 设置cookie的过期时间,单位为秒,这里为一天 + cookie.setMaxAge(86400); + return cookie; + } + + /** + * cookie管理对象 + * @return + */ + public CookieRememberMeManager rememberMeManager() { + CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); + cookieRememberMeManager.setCookie(rememberMeCookie()); + // rememberMe cookie加密的密钥 + cookieRememberMeManager.setCipherKey(Base64.decode("3AvVhmFLUs0KTA3Kprsdag==")); + return cookieRememberMeManager; + } + +} \ No newline at end of file diff --git a/SpringBootShiroRememberMe/src/main/java/com/zz/config/ShiroRealm.java b/SpringBootShiroRememberMe/src/main/java/com/zz/config/ShiroRealm.java new file mode 100644 index 0000000..50de722 --- /dev/null +++ b/SpringBootShiroRememberMe/src/main/java/com/zz/config/ShiroRealm.java @@ -0,0 +1,61 @@ +package com.zz.config; + +import javax.annotation.Resource; + +import org.apache.shiro.authc.AuthenticationException; +import org.apache.shiro.authc.AuthenticationInfo; +import org.apache.shiro.authc.AuthenticationToken; +import org.apache.shiro.authc.IncorrectCredentialsException; +import org.apache.shiro.authc.LockedAccountException; +import org.apache.shiro.authc.SimpleAuthenticationInfo; +import org.apache.shiro.authc.UnknownAccountException; +import org.apache.shiro.authz.AuthorizationInfo; +import org.apache.shiro.realm.AuthorizingRealm; +import org.apache.shiro.subject.PrincipalCollection; +import org.springframework.beans.factory.annotation.Autowired; + +import com.zz.entity.User; +import com.zz.repository.UserRepository; + +//import com.springboot.dao.UserMapper; +//import com.springboot.pojo.User; + +public class ShiroRealm extends AuthorizingRealm { + + @Resource + private UserRepository userRepository; + + /** + * 获取用户角色和权限 + */ + @Override + protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principal) { + return null; + } + + /** + * 登录认证 + */ + @Override + protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { + String userName = (String) token.getPrincipal(); + String password = new String((char[]) token.getCredentials()); + + System.out.println("用户" + userName + "认证-----ShiroRealm.doGetAuthenticationInfo"); +// User user = userMapper.findByUserName(userName); + User user = userRepository.findByName(userName); +// User user=new User(); + if (user == null) { + throw new UnknownAccountException("用户名错误!"); + } + if (!password.equals(user.getPwd())) { + throw new IncorrectCredentialsException("密码错误!"); + } + if (user.getStatus().equals("0")) { + throw new LockedAccountException("账号已被锁定,请联系管理员!"); + } + SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user, password, getName()); + return info; + } + +} \ No newline at end of file diff --git a/SpringBootShiroRememberMe/src/main/java/com/zz/controller/LoginController.java b/SpringBootShiroRememberMe/src/main/java/com/zz/controller/LoginController.java new file mode 100644 index 0000000..b971264 --- /dev/null +++ b/SpringBootShiroRememberMe/src/main/java/com/zz/controller/LoginController.java @@ -0,0 +1,67 @@ +package com.zz.controller; + +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authc.AuthenticationException; +import org.apache.shiro.authc.IncorrectCredentialsException; +import org.apache.shiro.authc.LockedAccountException; +import org.apache.shiro.authc.UnknownAccountException; +import org.apache.shiro.authc.UsernamePasswordToken; +import org.apache.shiro.subject.Subject; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.zz.entity.User; +import com.zz.pojo.ResponseBo; +import com.zz.util.MD5Utils; + + +@Controller +public class LoginController { + + @GetMapping("/login") + public String login() { + return "login1.html"; + } + + @PostMapping("/login") + @ResponseBody + public ResponseBo login(String username, String password, Boolean rememberMe) { + password = MD5Utils.encrypt(username, password); + UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe); + Subject subject = SecurityUtils.getSubject(); + try { + subject.login(token); + return ResponseBo.ok(); + } catch (UnknownAccountException e) { + return ResponseBo.error(e.getMessage()); + } catch (IncorrectCredentialsException e) { + return ResponseBo.error(e.getMessage()); + } catch (LockedAccountException e) { + return ResponseBo.error(e.getMessage()); + } catch (AuthenticationException e) { + return ResponseBo.error("认证失败!"); + } + } + + @RequestMapping("/") + public String redirectIndex() { + return "redirect:/index"; + } + + @RequestMapping("/index") + public String index(Model model) { + User user = (User) SecurityUtils.getSubject().getPrincipal(); + model.addAttribute("user", user); + return "index1.html"; + } + + @PostMapping("/getlogin") + @ResponseBody + public User getLoginUser(){ + return (User) SecurityUtils.getSubject().getPrincipal(); + } +} \ No newline at end of file diff --git a/SpringBootShiroRememberMe/src/main/java/com/zz/entity/User.java b/SpringBootShiroRememberMe/src/main/java/com/zz/entity/User.java new file mode 100644 index 0000000..051af98 --- /dev/null +++ b/SpringBootShiroRememberMe/src/main/java/com/zz/entity/User.java @@ -0,0 +1,55 @@ +package com.zz.entity; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class User implements Serializable{ + @Id + private String id; + private String name; + private String pwd; + private String sex; + private int age; + private String status; + + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getPwd() { + return pwd; + } + public void setPwd(String pwd) { + this.pwd = pwd; + } + public String getSex() { + return sex; + } + public void setSex(String sex) { + this.sex = sex; + } + public int getAge() { + return age; + } + public void setAge(int age) { + this.age = age; + } + +} diff --git a/SpringBootShiroRememberMe/src/main/java/com/zz/pojo/ResponseBo.java b/SpringBootShiroRememberMe/src/main/java/com/zz/pojo/ResponseBo.java new file mode 100644 index 0000000..380b72a --- /dev/null +++ b/SpringBootShiroRememberMe/src/main/java/com/zz/pojo/ResponseBo.java @@ -0,0 +1,50 @@ +package com.zz.pojo; + +import java.util.HashMap; +import java.util.Map; + +public class ResponseBo extends HashMap{ + private static final long serialVersionUID = 1L; + + public ResponseBo() { + put("code", 0); + put("msg", "操作成功"); + } + + public static ResponseBo error() { + return error(1, "操作失败"); + } + + public static ResponseBo error(String msg) { + return error(500, msg); + } + + public static ResponseBo error(int code, String msg) { + ResponseBo ResponseBo = new ResponseBo(); + ResponseBo.put("code", code); + ResponseBo.put("msg", msg); + return ResponseBo; + } + + public static ResponseBo ok(String msg) { + ResponseBo ResponseBo = new ResponseBo(); + ResponseBo.put("msg", msg); + return ResponseBo; + } + + public static ResponseBo ok(Map map) { + ResponseBo ResponseBo = new ResponseBo(); + ResponseBo.putAll(map); + return ResponseBo; + } + + public static ResponseBo ok() { + return new ResponseBo(); + } + + @Override + public ResponseBo put(String key, Object value) { + super.put(key, value); + return this; + } +} diff --git a/SpringBootShiroRememberMe/src/main/java/com/zz/repository/UserRepository.java b/SpringBootShiroRememberMe/src/main/java/com/zz/repository/UserRepository.java new file mode 100644 index 0000000..a35556e --- /dev/null +++ b/SpringBootShiroRememberMe/src/main/java/com/zz/repository/UserRepository.java @@ -0,0 +1,14 @@ +package com.zz.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.repository.CrudRepository; + +import com.zz.entity.User; + +public interface UserRepository extends JpaRepository{ + + public User findByNameAndPwd(String name,String pwd); + public User findByName(String name); + + +} diff --git a/SpringBootShiroRememberMe/src/main/java/com/zz/service/UserService.java b/SpringBootShiroRememberMe/src/main/java/com/zz/service/UserService.java new file mode 100644 index 0000000..9d3dc93 --- /dev/null +++ b/SpringBootShiroRememberMe/src/main/java/com/zz/service/UserService.java @@ -0,0 +1,29 @@ +package com.zz.service; + +import javax.annotation.Resource; + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; + +import com.zz.entity.User; +import com.zz.repository.UserRepository; + +@Service +public class UserService { + @Resource + UserRepository userRepository; + + + public User findByNameAndPwd(String name,String pwd){ + return userRepository.findByNameAndPwd(name, pwd); + }; + + + public Page findAll(String page, String limit){ + Pageable pageable = PageRequest.of(Integer.parseInt(page), Integer.parseInt(limit)); + Page pageinfo=userRepository.findAll(pageable); + return pageinfo; + } +} diff --git a/SpringBootShiroRememberMe/src/main/java/com/zz/util/MD5Utils.java b/SpringBootShiroRememberMe/src/main/java/com/zz/util/MD5Utils.java new file mode 100644 index 0000000..8189e55 --- /dev/null +++ b/SpringBootShiroRememberMe/src/main/java/com/zz/util/MD5Utils.java @@ -0,0 +1,28 @@ +package com.zz.util; + +import org.apache.shiro.crypto.hash.SimpleHash; +import org.apache.shiro.util.ByteSource; + +public class MD5Utils { + private static final String SALT = "mrbird"; + + private static final String ALGORITH_NAME = "md5"; + + private static final int HASH_ITERATIONS = 2; + + public static String encrypt(String pswd) { + String newPassword = new SimpleHash(ALGORITH_NAME, pswd, ByteSource.Util.bytes(SALT), HASH_ITERATIONS).toHex(); + return newPassword; + } + + public static String encrypt(String username, String pswd) { + String newPassword = new SimpleHash(ALGORITH_NAME, pswd, ByteSource.Util.bytes(username + SALT), + HASH_ITERATIONS).toHex(); + return newPassword; + } + public static void main(String[] args) { + + System.out.println(MD5Utils.encrypt("test", "123456")); + } + +} \ No newline at end of file diff --git a/SpringBootShiroRememberMe/src/main/resources/application.properties b/SpringBootShiroRememberMe/src/main/resources/application.properties new file mode 100644 index 0000000..e318f00 --- /dev/null +++ b/SpringBootShiroRememberMe/src/main/resources/application.properties @@ -0,0 +1,12 @@ +server.port=9087 +server.servlet.context-path=/r + +# 数据库的信息 +spring.datasource.url = jdbc:mysql://localhost:3306/java10?useSSL=false&serverTimezone=Asia/Shanghai +spring.datasource.username = root +spring.datasource.password = Java20190713*yy +spring.datasource.driverClassName = com.mysql.cj.jdbc.Driver +spring.jpa.database = MYSQL +# spring.jpa.show-sql = true 表示会在控制台打印执行的sql语句 +spring.jpa.show-sql = true +spring.jpa.hibernate.ddl-auto = update \ No newline at end of file diff --git a/SpringBootShiroRememberMe/src/main/resources/static/index1.html b/SpringBootShiroRememberMe/src/main/resources/static/index1.html new file mode 100644 index 0000000..d07dfb1 --- /dev/null +++ b/SpringBootShiroRememberMe/src/main/resources/static/index1.html @@ -0,0 +1,54 @@ + + + + Bootstrap 实例 + + + + + + + + + +
+

基础表格

+

+ + + + + + + + + + + + + + + + + + + + + + + + + +
FirstnameLastnameEmail
JohnDoejohn@example.com
MaryMoemary@example.com
JulyDooleyjuly@example.com
+
+ + + \ No newline at end of file diff --git a/SpringBootShiroRememberMe/src/main/resources/static/login1.html b/SpringBootShiroRememberMe/src/main/resources/static/login1.html new file mode 100644 index 0000000..51dd64e --- /dev/null +++ b/SpringBootShiroRememberMe/src/main/resources/static/login1.html @@ -0,0 +1,47 @@ + + + + Bootstrap 实例 + + + + + + + + + +
+

堆叠表单

+
+
+ + +
+
+ + +
+
+ +
+ +
+
+ + + \ No newline at end of file diff --git a/SpringBootShiroRememberMe/target/classes/META-INF/maven/zz/SpringBootShiroRememberMe/pom.properties b/SpringBootShiroRememberMe/target/classes/META-INF/maven/zz/SpringBootShiroRememberMe/pom.properties new file mode 100644 index 0000000..8036acf --- /dev/null +++ b/SpringBootShiroRememberMe/target/classes/META-INF/maven/zz/SpringBootShiroRememberMe/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Fri Aug 23 21:28:18 CST 2019 +version=0.0.1-SNAPSHOT +groupId=zz +m2e.projectName=SpringBootShiroRememberMe +m2e.projectLocation=C\:\\bsea\\wp\\2019\\07\\04\\SpringBoot2\\SpringBootShiroRememberMe +artifactId=SpringBootShiroRememberMe diff --git a/SpringBootShiroRememberMe/target/classes/META-INF/maven/zz/SpringBootShiroRememberMe/pom.xml b/SpringBootShiroRememberMe/target/classes/META-INF/maven/zz/SpringBootShiroRememberMe/pom.xml new file mode 100644 index 0000000..edde0da --- /dev/null +++ b/SpringBootShiroRememberMe/target/classes/META-INF/maven/zz/SpringBootShiroRememberMe/pom.xml @@ -0,0 +1,59 @@ + + 4.0.0 + + zz + SpringBoot2 + 0.0.1-SNAPSHOT + + SpringBootShiroRememberMe + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-devtools + true + + + + + mysql + mysql-connector-java + 8.0.15 + + + + + org.apache.shiro + shiro-spring + 1.4.0 + + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + + + alimaven + aliyun maven + http://maven.aliyun.com/nexus/content/groups/public/ + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + \ No newline at end of file diff --git a/SpringBootShiroRememberMe/target/classes/application.properties b/SpringBootShiroRememberMe/target/classes/application.properties new file mode 100644 index 0000000..e318f00 --- /dev/null +++ b/SpringBootShiroRememberMe/target/classes/application.properties @@ -0,0 +1,12 @@ +server.port=9087 +server.servlet.context-path=/r + +# 数据库的信息 +spring.datasource.url = jdbc:mysql://localhost:3306/java10?useSSL=false&serverTimezone=Asia/Shanghai +spring.datasource.username = root +spring.datasource.password = Java20190713*yy +spring.datasource.driverClassName = com.mysql.cj.jdbc.Driver +spring.jpa.database = MYSQL +# spring.jpa.show-sql = true 表示会在控制台打印执行的sql语句 +spring.jpa.show-sql = true +spring.jpa.hibernate.ddl-auto = update \ No newline at end of file diff --git a/SpringBootShiroRememberMe/target/classes/com/zz/App.class b/SpringBootShiroRememberMe/target/classes/com/zz/App.class new file mode 100644 index 0000000000000000000000000000000000000000..1fb25e863f3aaf3919f09a325268671d8b032f0d GIT binary patch literal 714 zcmZuvO;6)65PdF%mTdXhmXBqD1Gmxxz923|NKnBk0*Rt>*pm}XFeG;6ILnHE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uWx^~Qh@Yw7O5s9ED%)^qH$`y$%F?p4D6(YSyDxbgw#pr zdAOLCIU+uD@4Kxp(p%}fnQwl0u)4CfcBd(`p3bbSZvVWoz4rC?&FfpYzI4cnpj|?Y zK`D`CT#v=+PN3%Ws4a<3<0X-pGU5WaM7YI?dl7{tDuo#AC_MWdg9Yj@w&bgc%G(xw zkD;l!Bp>__n|@N9HE>#}ci zo?^v8)RK=Ibrjo$!%jT5)Qr3cbO5=x@4@0T(*m_3l4VwSke4Z#0eZ&E|S{3KJ=W?g;DUkng=T z)J8N$xq)b?-rXEb!ARpuXL)_O*j$;jxl=?25Fqw~XrOzd9WCg^ zN%T|G9K~r|rf)BjK5U%9HFV$xb#FmoHxWu3%M)>nRwRiCFFwUpED#k9G%nJwGKx2X lB`gz3H)!?&J|tQ`BJceudx%j9jn4mMZ5{bvBfAS9{{x(^;E@0T literal 0 HcmV?d00001 diff --git a/SpringBootShiroRememberMe/target/classes/com/zz/controller/LoginController.class b/SpringBootShiroRememberMe/target/classes/com/zz/controller/LoginController.class new file mode 100644 index 0000000000000000000000000000000000000000..702c0386295f3d87f92822c6d16e0086d42cef96 GIT binary patch literal 3276 zcma)8X>$`t5Pf4yS|N)|Trm*9=JLHji~|-&j4_8Jfw7GVkc6yOgT1!2D|T0a$;p2q zUlXWGfk{%Se9r$!72om?lDt{1CE1pYtF)S#-R_<@-LJdnuYZ621Hd4D(9j~#VLC5OE&qZ*YghM-KxEX( z%LH1nDTydz0$VedEpL>IIq6Otxq=i(WgOEe%owhv*5S*DKWBLYhcoX5k`{;-6gGjK zUEP@)qAB0C>{)(ppDf$HRg^Q9XK{xS+je}zw;Y=r3}zg6R`*Iu^r34M+As+#p064hi(BKo}*%oRhjYXSt4Ul>IqVzwJraW?&`^&tq`% z)6Rml6X?Vd4TlA`*8(1TFo~l$CXmck96D2p6zO;`frIE$JnR1RIkC>*zq#Ju`%96^oBralW#Wz{$dB!Yj!VpH1xP(#WuXJ67f>%Y9z%`|QU7){-I?K|6%&$I49G|j?z5D6KyPu!` z{o>WTUw-`O_vae2&0VrGBvk+c@p4FQRRe1@uGX!1DWp6d=gOi~H8abiv!hOUxoXgf zzDf+jXhw~OiNva+g?tp~T&ud8s{(=uPOKGNH~ieCQiB@g_qtJ{A{$TR!q7NA)M$#X zNhGMUdCE7;1=jbV{b=}dMQ^J_gi_>@r3iK1&daAPcmcGHG>=L7s4VMCve4r&Nu*_q z!#dlIvKbA>Q&v3Lo z+8%j}6D?T6>6gQ?_SkErm+(nAyG>@YjUDWL6owf((*~BlRkDC1$$3Sr2hk=EO@Vq<)Zs2C% zq6yA#^33YpElhH+T}WdJ(*dp_+{TQ$L|_x{;4|($7|iZ+b}^XU<7}MI9o*;t=d{y< z$bWp;}@RXG8S)EzDv?$?5E`K1Nl1+-Uk-vj>x DYwcx8 literal 0 HcmV?d00001 diff --git a/SpringBootShiroRememberMe/target/classes/com/zz/entity/User.class b/SpringBootShiroRememberMe/target/classes/com/zz/entity/User.class new file mode 100644 index 0000000000000000000000000000000000000000..5db8f5e059fd1757efb88889986ab742dfb5c108 GIT binary patch literal 1567 zcmZ{kZBG+H5XWcxaJBUigi=I6ELd$pIKkpWFeJoa(xgFSmG{?nQ+)^9&^f&9?lWb9w1VFI3?t=Y1gi z8A=J7Idwm}PS^E1&gY=s%J1m(3?`A$RjmD^R9ZnG-|B~%-g>LW=b>?^OcFKF@Y z0EK(lv0H6#b4>9AK%q`ULt2VkL!_n+>O&tk?$&H@cCGaq z34Q^pRH+iLNW9SZB2^74qT;!~qoDqPK36?6JMk_gLF~iq&fR;@xgTfdumAq|6Tlf< z$-oepYWth@J9p|mf5WeT<@9^L*LN=Y8Kea!Htbt=eGt0c`W3r>_mwZaj%W(@P^xGUVCu}j5tBy2LdzY*CcX$$p8G|qkn$; zMb=s_U=9_5`EoN+lrD2mEP>iCU3rbWxf5Knk8$!%fqX0)0mHv3P|@&8I26s^{T0Zq zx*g9B2Lao+@=DyoPTqt?&u(#VbeZIt0?y(bWk@+Jb-SF=DR9rcIr_ zJkZ;{?V+B1+4T)GmAYS$`utend~yc5mYvllRj!?w?M>%4RijRW6kU7}v`Yq;cu-?= zq=*c7Ruk69nFCz)2SMAp>`Dn2<7u9h00I{hrRrPY4a>#596(B51DL@G_VJzJ&OjD9 ze)ITqEzq(;FTwXgYYU^6Sxh~~#P2w8-7;s*L-OO13OmBpM4D@kYaT@cOcS6)OCbUv z<$LP?9FA)66C{*RCT$*jj1#}|(}0AM`G6oLWs#tBuyoLA`pCc83GuJBOVnh7l$Qjm z^p)`y9p7O^vhqVuAimu~?P|>|&giOY=4@3KRf|)Jsye{NOk7{@$! zgi}<4e*1Bfl^P_i50kz|Z&|CUNn2HO){;!sm}yKQ9wx#OqLviPR1~Gl$g;B%n`e{Q zr}*!EVj4KDM)e)PBu8<`L52?$K}vNsA~;HdV;IHp1VIrW;ygpMR6#^=fxBpM^4~|? zNy_cPl@$^FHC0?hG&xIQ%VdPS^0`VaeaQl4=W|xIwuQ!ZD-O#mz&hzqsnDpqIjtE< xzQ{oemBvMU0%Lqho>dJzuYpIc>N70Wo?)4-jlrXw#4slVpApEwW!=8d{|Ej5k0Ss8 literal 0 HcmV?d00001 diff --git a/SpringBootShiroRememberMe/target/classes/com/zz/repository/UserRepository.class b/SpringBootShiroRememberMe/target/classes/com/zz/repository/UserRepository.class new file mode 100644 index 0000000000000000000000000000000000000000..0488c042aaaca04fd12b037b5a86adffecf1cbc2 GIT binary patch literal 476 zcmX^0Z`VEs1_l!bes%^XMh1oC{9OI2D*d9=g8bsllKi4d{m|mnq98bzoq>gsK_Dx! zEKxrvF)v-;KPf9UxrCj8jgi4LzbIY5xS%LAFFma&F*mh5zbIQjC9xz?KdT@S*+j2` zM1+Ar)6z2YQk*LNfLa{$QUc0T7#XZId=ORymw=44#uU-?fx0#|uOzbs;!rN9v6#k|y6v_(aB2o$psMrgzqIhEo37VMHG?lc<|7km|gY9nJor2{Bd>u_p z1b_GdK9upyb}1NZtcgEn=bV#szVBT2%=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cmV?d00001 diff --git a/SpringBootShiroRememberMe/target/classes/static/index1.html b/SpringBootShiroRememberMe/target/classes/static/index1.html new file mode 100644 index 0000000..d07dfb1 --- /dev/null +++ b/SpringBootShiroRememberMe/target/classes/static/index1.html @@ -0,0 +1,54 @@ + + + + Bootstrap 实例 + + + + + + + + + +
+

基础表格

+

+ + + + + + + + + + + + + + + + + + + + + + + + + +
FirstnameLastnameEmail
JohnDoejohn@example.com
MaryMoemary@example.com
JulyDooleyjuly@example.com
+
+ + + \ No newline at end of file diff --git a/SpringBootShiroRememberMe/target/classes/static/login1.html b/SpringBootShiroRememberMe/target/classes/static/login1.html new file mode 100644 index 0000000..51dd64e --- /dev/null +++ b/SpringBootShiroRememberMe/target/classes/static/login1.html @@ -0,0 +1,47 @@ + + + + Bootstrap 实例 + + + + + + + + + +
+

堆叠表单

+
+
+ + +
+
+ + +
+
+ +
+ +
+
+ + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 8f41d37..c6d1a46 100644 --- a/pom.xml +++ b/pom.xml @@ -19,6 +19,7 @@ SpringBootFile SpringBootHomework SpringBootSwagger2 + SpringBootShiroRememberMe