diff --git a/.classpath b/.classpath
index a8f0ce5..2edc7d3 100644
--- a/.classpath
+++ b/.classpath
@@ -20,16 +20,7 @@
+
-
-
-
-
-
-
-
-
-
-
diff --git a/WebRoot/css/signin.css b/WebRoot/css/signin.css
new file mode 100644
index 0000000..995df48
--- /dev/null
+++ b/WebRoot/css/signin.css
@@ -0,0 +1,40 @@
+body {
+ padding-top: 40px;
+ padding-bottom: 40px;
+ background-color: #eee;
+}
+
+.form-signin {
+ max-width: 330px;
+ padding: 15px;
+ margin: 0 auto;
+}
+.form-signin .form-signin-heading,
+.form-signin .checkbox {
+ margin-bottom: 10px;
+}
+.form-signin .checkbox {
+ font-weight: normal;
+}
+.form-signin .form-control {
+ position: relative;
+ height: auto;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ padding: 10px;
+ font-size: 16px;
+}
+.form-signin .form-control:focus {
+ z-index: 2;
+}
+.form-signin input[type="email"] {
+ margin-bottom: -1px;
+ border-bottom-right-radius: 0;
+ border-bottom-left-radius: 0;
+}
+.form-signin input[type="password"] {
+ margin-bottom: 10px;
+ border-top-left-radius: 0;
+ border-top-right-radius: 0;
+}
diff --git a/WebRoot/WEB-INF/error/error.jsp b/WebRoot/error/error.jsp
similarity index 100%
rename from WebRoot/WEB-INF/error/error.jsp
rename to WebRoot/error/error.jsp
diff --git a/WebRoot/index.jsp b/WebRoot/index.jsp
new file mode 100644
index 0000000..cbf8e33
--- /dev/null
+++ b/WebRoot/index.jsp
@@ -0,0 +1,72 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+
+
+
+
+
+
+ 首页
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WebRoot/profile/admin.jsp b/WebRoot/profile/admin.jsp
new file mode 100644
index 0000000..e0c6c40
--- /dev/null
+++ b/WebRoot/profile/admin.jsp
@@ -0,0 +1,27 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+ pageEncoding="UTF-8"%>
+
+
+
+
+
+
+ 主页
+
+
+
+
+
+
+
+ 管理员主页
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WebRoot/profile/user.jsp b/WebRoot/profile/user.jsp
new file mode 100644
index 0000000..d23c0de
--- /dev/null
+++ b/WebRoot/profile/user.jsp
@@ -0,0 +1,27 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+ pageEncoding="UTF-8"%>
+
+
+
+
+
+
+ 主页
+
+
+
+
+
+
+
+ 用户主页
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WebRoot/signin.jsp b/WebRoot/signin.jsp
new file mode 100644
index 0000000..3afe077
--- /dev/null
+++ b/WebRoot/signin.jsp
@@ -0,0 +1,46 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+
+
+
+
+
+
+ 登陆
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WebRoot/signup.jsp b/WebRoot/signup.jsp
new file mode 100644
index 0000000..7898ec2
--- /dev/null
+++ b/WebRoot/signup.jsp
@@ -0,0 +1,29 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+pageEncoding="UTF-8"%>
+
+
+
+
+
+
+ 注册
+
+
+
+
+
+
+
+
+ sign up
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 5d652ac..b6a6cf8 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,10 +1,22 @@
import org.gradle.plugins.ide.eclipse.model.Facet
import org.gradle.plugins.ide.eclipse.model.SourceFolder
+import org.akhikhl.gretty.TomcatStartTask
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+
+ dependencies {
+ classpath 'org.akhikhl.gretty:gretty:+'
+ }
+}
apply plugin: 'java'
apply plugin: 'war'
+apply plugin: 'eclipse'
apply plugin: 'eclipse-wtp'
-apply plugin: 'jetty'
+apply plugin: 'org.akhikhl.gretty'
sourceCompatibility = 1.7
targetCompatibility = 1.7
@@ -12,14 +24,16 @@ compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
webAppDirName = 'WebRoot'
-httpPort = 8080
-stopPort = 9451
-stopKey = 'fireply'
-
task wrapper(type: Wrapper) {
gradleVersion = '2.13'
}
+gretty {
+ servletContainer = 'tomcat8'
+ httpPort = 9080
+// springBoot = true
+}
+
repositories {
mavenCentral()
}
@@ -28,8 +42,12 @@ dependencies {
providedCompile 'javax.servlet:servlet-api:2.5'
runtime 'javax.servlet:jstl:1.2'
- compile 'org.apache.struts:struts2-core:2.3.28.1'
- compile 'org.apache.struts:struts2-spring-plugin:2.3.28.1'
+ compile('org.apache.struts:struts2-core:2.3.28.1') {
+ exclude module:'javassist'
+ }
+ compile('org.apache.struts:struts2-spring-plugin:2.3.28.1') {
+ exclude module:'javassist'
+ }
compile 'org.springframework:spring-context:4.2.6.RELEASE'
compile 'org.springframework:spring-web:4.2.6.RELEASE'
compile 'org.springframework:spring-webmvc:4.2.6.RELEASE'
diff --git a/src/main/java/org/fireply/enter/action/LoginAction.java b/src/main/java/org/fireply/enter/action/LoginAction.java
new file mode 100644
index 0000000..1cfd091
--- /dev/null
+++ b/src/main/java/org/fireply/enter/action/LoginAction.java
@@ -0,0 +1,113 @@
+package org.fireply.enter.action;
+
+import static org.fireply.enter.constant.ResultConstants.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts2.interceptor.ServletRequestAware;
+import org.apache.struts2.interceptor.ServletResponseAware;
+import org.apache.struts2.interceptor.SessionAware;
+import org.fireply.enter.security.Md5;
+import org.fireply.enter.security.Sign;
+import org.fireply.enter.service.LoginService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Controller;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+@Controller
+public class LoginAction extends ActionSupport implements ServletRequestAware, ServletResponseAware, SessionAware {
+
+ @Autowired
+ @Qualifier("loginServiceImpl")
+ private LoginService loginService;
+
+ private HttpServletRequest request;
+ private HttpServletResponse response;
+ private Map session;
+
+ private String userId; // 登录页面填写的 userId
+ private String userPassword; // 登录页面填写的 userPassword
+
+ @Override
+ public String execute() throws Exception {
+
+ Cookie[] cookies = request.getCookies();
+ String remoteAddr = request.getRemoteAddr();
+ String actionPath = request.getServletPath();
+ boolean success = false;
+
+ if (userId != null && userPassword != null) {
+ String signedPassword = Md5.sign(userPassword);
+ success = loginService.loginByPassword(userId, signedPassword, remoteAddr);
+ } else if (cookies != null) { // 使用 Cookie 登录
+ String cookieUserId = null;
+ String cookieSequence = null;
+ String cookieToken = null;
+ boolean found = false;
+
+ for (Cookie cookie : cookies) {
+ if (cookie != null) {
+ if ("userId".equals(cookie.getName())) {
+ cookieUserId = cookie.getValue();
+ found = true;
+ } else if ("sequence".equals(cookie.getName())) {
+ cookieSequence = cookie.getValue();
+ found = true;
+ } else if ("token".equals(cookie.getName())) {
+ cookieToken= cookie.getValue();
+ found = true;
+ }
+ }
+ }
+
+ if (found) {
+ success = loginService.loginByCookie(cookieUserId, cookieSequence, cookieToken, remoteAddr);
+ } else {
+ return LOGIN;
+ }
+ }
+
+ // 如果登录成功
+ if (success) {
+ if (actionPath != null && actionPath.length() > 0 && !"/login".equals(actionPath)) {
+ return actionPath;
+ } else {
+ return PROFILE_USER;
+ }
+ } else {
+ return LOGIN_FAILURE;
+ }
+ }
+
+ @Override
+ public void setServletRequest(HttpServletRequest request) {
+ this.request = request;
+ }
+
+ @Override
+ public void setSession(Map session) {
+ this.session = session;
+ }
+
+ @Override
+ public void setServletResponse(HttpServletResponse response) {
+ this.response = response;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public void setUserPassword(String userPassword) {
+ this.userPassword = userPassword;
+ }
+
+}
diff --git a/src/main/java/org/fireply/enter/constant/ResultConstants.java b/src/main/java/org/fireply/enter/constant/ResultConstants.java
new file mode 100644
index 0000000..77c5264
--- /dev/null
+++ b/src/main/java/org/fireply/enter/constant/ResultConstants.java
@@ -0,0 +1,12 @@
+package org.fireply.enter.constant;
+
+public class ResultConstants {
+
+ public static final String PROFILE_USER = "profile_user";
+ public static final String PROFILE_ADMIN = "profile_admin";
+ public static final String LOGIN_FAILURE = "login_failure";
+
+ public static final String INDEX = "index";
+ public static final String LOGIN_ACTION = "login_action";
+
+}
diff --git a/src/main/java/org/fireply/enter/dao/Dao.java b/src/main/java/org/fireply/enter/dao/Dao.java
new file mode 100644
index 0000000..7c19001
--- /dev/null
+++ b/src/main/java/org/fireply/enter/dao/Dao.java
@@ -0,0 +1,38 @@
+package org.fireply.enter.dao;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+import org.hibernate.HibernateException;
+
+public interface Dao {
+
+ void persist(Object object);
+ Serializable save(Object object);
+ void delete(Object object);
+ Object merge(Object object);
+
+ Object get(Class> clazz, Serializable id);
+ Object get(String modelName, Serializable id);
+ List> getAll(Class> clazz);
+ List> getAll(String modeName);
+
+ List> get(Class> clazz, String fieldName, Object fieldValue);
+ List> get(String modelName, String fieldName, Object fieldValue);
+ List> get(Class> clazz, Map fieldsMap);
+
+ List> executeQuery(String hql);
+ List> executeQuery(String hql,int firstResult,int maxResults);
+ List> executeSqlQuery(String sql);
+ List> executeSqlQuery(String sql,int firstResult,int maxResults);
+
+ List> executeUpdate(String hql);
+ List> executeUpdate(String hql,int firstResult,int maxResults);
+ List> executeSqlUpdate(String sql);
+ List> executeSqlUpdate(String sql,int firstResult,int maxResults);
+
+// Object findById(String id);
+// List> findByExample(Object object);
+
+}
diff --git a/src/main/java/org/fireply/enter/dao/impl/DaoImpl.java b/src/main/java/org/fireply/enter/dao/impl/DaoImpl.java
new file mode 100644
index 0000000..6a283df
--- /dev/null
+++ b/src/main/java/org/fireply/enter/dao/impl/DaoImpl.java
@@ -0,0 +1,136 @@
+package org.fireply.enter.dao.impl;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+import org.fireply.enter.dao.Dao;
+import org.hibernate.HibernateException;
+import org.hibernate.Query;
+import org.hibernate.SessionFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+
+@Repository
+@SuppressWarnings("rawtypes") // 本类所有返回类型为 List 的方法返回的 List 都是调用 Hibernate 的方法后返回的
+public class DaoImpl implements Dao {
+
+ @Autowired
+ private SessionFactory sessionFactory;
+
+ @Override
+ public void persist(Object object) {
+ sessionFactory.getCurrentSession().persist(object);
+ }
+
+ @Override
+ public Serializable save(Object object) {
+ return sessionFactory.getCurrentSession().save(object);
+ }
+
+ @Override
+ public void delete(Object object) {
+ sessionFactory.getCurrentSession().delete(object);
+ }
+
+ @Override
+ public Object merge(Object object) {
+ return sessionFactory.getCurrentSession().merge(object);
+ }
+
+ @Override
+ public Object get(Class> clazz, Serializable id) throws HibernateException {
+ return sessionFactory.getCurrentSession().get(clazz, id);
+ }
+
+ @Override
+ public Object get(String modelName, Serializable id) {
+ return sessionFactory.getCurrentSession().get(modelName, id);
+ }
+
+ @Override
+ public List get(Class> clazz, String fieldName, Object fieldValue) {
+ String hql = "from" + clazz.getSimpleName() + "where" + fieldName + "'" + fieldValue + "'";
+ return executeQuery(hql);
+ }
+
+ @Override
+ public List get(Class> clazz, Map fieldsMap) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List get(String modelName, String fieldName, Object fieldValue) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List> getAll(Class> clazz) {
+ String hql = "from" + clazz.getSimpleName();
+ return executeQuery(hql);
+ }
+
+ @Override
+ public List> getAll(String modeName) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List executeQuery(String hql) {
+ return executeQuery(hql, -1, -1);
+ }
+
+ @Override
+ public List executeQuery(String hql, int firstResult, int maxResults) {
+ Query query = sessionFactory.getCurrentSession().createQuery(hql);
+ if (firstResult >= 0 && maxResults >= 0) {
+ query.setFirstResult(firstResult);
+ query.setMaxResults(maxResults);
+ }
+ return query.list();
+ }
+
+ @Override
+ public List executeSqlQuery(String sql) {
+ executeSqlQuery(sql, -1, -1);
+ return null;
+ }
+
+ @Override
+ public List executeSqlQuery(String sql, int firstResult, int maxResults) {
+ Query query = sessionFactory.getCurrentSession().createSQLQuery(sql);
+ if (firstResult >= 0 && maxResults >= 0) {
+ query.setFirstResult(firstResult);
+ query.setMaxResults(maxResults);
+ }
+ return query.list();
+ }
+
+ @Override
+ public List executeUpdate(String hql) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List executeUpdate(String hql, int firstResult, int maxResults) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List executeSqlUpdate(String sql) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List executeSqlUpdate(String sql, int firstResult, int maxResults) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/src/main/java/org/fireply/enter/entity/Account.java b/src/main/java/org/fireply/enter/model/Account.java
similarity index 87%
rename from src/main/java/org/fireply/enter/entity/Account.java
rename to src/main/java/org/fireply/enter/model/Account.java
index 09d0850..902f445 100644
--- a/src/main/java/org/fireply/enter/entity/Account.java
+++ b/src/main/java/org/fireply/enter/model/Account.java
@@ -1,5 +1,5 @@
-package org.fireply.enter.entity;
-// Generated 2016-5-19 7:55:16 by Hibernate Tools 4.3.1.Final
+package org.fireply.enter.model;
+// Generated 2016-5-22 15:15:44 by Hibernate Tools 4.3.1.Final
import java.util.HashSet;
import java.util.Set;
diff --git a/src/main/java/org/fireply/enter/model/Authorization.java b/src/main/java/org/fireply/enter/model/Authorization.java
new file mode 100644
index 0000000..764b651
--- /dev/null
+++ b/src/main/java/org/fireply/enter/model/Authorization.java
@@ -0,0 +1,68 @@
+package org.fireply.enter.model;
+// Generated 2016-5-22 15:15:44 by Hibernate Tools 4.3.1.Final
+
+import java.util.Date;
+
+/**
+ * Authorization generated by hbm2java
+ */
+public class Authorization implements java.io.Serializable {
+
+ private String id;
+ private User user;
+ private String sequence;
+ private String token;
+ private Date lastTime;
+
+ public Authorization() {
+ }
+
+ public Authorization(String id, User user, String sequence, String token, Date lastTime) {
+ this.id = id;
+ this.user = user;
+ this.sequence = sequence;
+ this.token = token;
+ this.lastTime = lastTime;
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public User getUser() {
+ return this.user;
+ }
+
+ public void setUser(User user) {
+ this.user = user;
+ }
+
+ public String getSequence() {
+ return this.sequence;
+ }
+
+ public void setSequence(String sequence) {
+ this.sequence = sequence;
+ }
+
+ public String getToken() {
+ return this.token;
+ }
+
+ public void setToken(String token) {
+ this.token = token;
+ }
+
+ public Date getLastTime() {
+ return this.lastTime;
+ }
+
+ public void setLastTime(Date lastTime) {
+ this.lastTime = lastTime;
+ }
+
+}
diff --git a/src/main/java/org/fireply/enter/entity/Category.java b/src/main/java/org/fireply/enter/model/Category.java
similarity index 87%
rename from src/main/java/org/fireply/enter/entity/Category.java
rename to src/main/java/org/fireply/enter/model/Category.java
index 56097f4..dabce78 100644
--- a/src/main/java/org/fireply/enter/entity/Category.java
+++ b/src/main/java/org/fireply/enter/model/Category.java
@@ -1,5 +1,5 @@
-package org.fireply.enter.entity;
-// Generated 2016-5-19 7:55:16 by Hibernate Tools 4.3.1.Final
+package org.fireply.enter.model;
+// Generated 2016-5-22 15:15:44 by Hibernate Tools 4.3.1.Final
import java.util.HashSet;
import java.util.Set;
diff --git a/src/main/java/org/fireply/enter/entity/Commit.java b/src/main/java/org/fireply/enter/model/Commit.java
similarity index 89%
rename from src/main/java/org/fireply/enter/entity/Commit.java
rename to src/main/java/org/fireply/enter/model/Commit.java
index 4c5a414..fe35041 100644
--- a/src/main/java/org/fireply/enter/entity/Commit.java
+++ b/src/main/java/org/fireply/enter/model/Commit.java
@@ -1,5 +1,5 @@
-package org.fireply.enter.entity;
-// Generated 2016-5-19 7:55:16 by Hibernate Tools 4.3.1.Final
+package org.fireply.enter.model;
+// Generated 2016-5-22 15:15:44 by Hibernate Tools 4.3.1.Final
import java.util.Date;
diff --git a/src/main/java/org/fireply/enter/model/Login.java b/src/main/java/org/fireply/enter/model/Login.java
new file mode 100644
index 0000000..f22cdb1
--- /dev/null
+++ b/src/main/java/org/fireply/enter/model/Login.java
@@ -0,0 +1,126 @@
+package org.fireply.enter.model;
+// Generated 2016-5-22 15:15:44 by Hibernate Tools 4.3.1.Final
+
+import java.util.Date;
+
+/**
+ * Login generated by hbm2java
+ */
+public class Login implements java.io.Serializable {
+
+ private String id;
+ private User user;
+ private int ip;
+ private Date lastTime;
+ private Short passwordSuccess;
+ private Short passwordFailure;
+ private Short cookieSuccess;
+ private Short sequenceFailure;
+ private Short multiDeviceFactor;
+ private Short ipFactor;
+
+ public Login() {
+ }
+
+ public Login(String id, User user, int ip, Date lastTime) {
+ this.id = id;
+ this.user = user;
+ this.ip = ip;
+ this.lastTime = lastTime;
+ }
+
+ public Login(String id, User user, int ip, Date lastTime, Short passwordSuccess, Short passwordFailure,
+ Short cookieSuccess, Short sequenceFailure, Short multiDeviceFactor, Short ipFactor) {
+ this.id = id;
+ this.user = user;
+ this.ip = ip;
+ this.lastTime = lastTime;
+ this.passwordSuccess = passwordSuccess;
+ this.passwordFailure = passwordFailure;
+ this.cookieSuccess = cookieSuccess;
+ this.sequenceFailure = sequenceFailure;
+ this.multiDeviceFactor = multiDeviceFactor;
+ this.ipFactor = ipFactor;
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public User getUser() {
+ return this.user;
+ }
+
+ public void setUser(User user) {
+ this.user = user;
+ }
+
+ public int getIp() {
+ return this.ip;
+ }
+
+ public void setIp(int ip) {
+ this.ip = ip;
+ }
+
+ public Date getLastTime() {
+ return this.lastTime;
+ }
+
+ public void setLastTime(Date lastTime) {
+ this.lastTime = lastTime;
+ }
+
+ public Short getPasswordSuccess() {
+ return this.passwordSuccess;
+ }
+
+ public void setPasswordSuccess(Short passwordSuccess) {
+ this.passwordSuccess = passwordSuccess;
+ }
+
+ public Short getPasswordFailure() {
+ return this.passwordFailure;
+ }
+
+ public void setPasswordFailure(Short passwordFailure) {
+ this.passwordFailure = passwordFailure;
+ }
+
+ public Short getCookieSuccess() {
+ return this.cookieSuccess;
+ }
+
+ public void setCookieSuccess(Short cookieSuccess) {
+ this.cookieSuccess = cookieSuccess;
+ }
+
+ public Short getSequenceFailure() {
+ return this.sequenceFailure;
+ }
+
+ public void setSequenceFailure(Short sequenceFailure) {
+ this.sequenceFailure = sequenceFailure;
+ }
+
+ public Short getMultiDeviceFactor() {
+ return this.multiDeviceFactor;
+ }
+
+ public void setMultiDeviceFactor(Short multiDeviceFactor) {
+ this.multiDeviceFactor = multiDeviceFactor;
+ }
+
+ public Short getIpFactor() {
+ return this.ipFactor;
+ }
+
+ public void setIpFactor(Short ipFactor) {
+ this.ipFactor = ipFactor;
+ }
+
+}
diff --git a/src/main/java/org/fireply/enter/entity/News.java b/src/main/java/org/fireply/enter/model/News.java
similarity index 90%
rename from src/main/java/org/fireply/enter/entity/News.java
rename to src/main/java/org/fireply/enter/model/News.java
index b4fd51e..3dd8ff4 100644
--- a/src/main/java/org/fireply/enter/entity/News.java
+++ b/src/main/java/org/fireply/enter/model/News.java
@@ -1,5 +1,5 @@
-package org.fireply.enter.entity;
-// Generated 2016-5-19 7:55:16 by Hibernate Tools 4.3.1.Final
+package org.fireply.enter.model;
+// Generated 2016-5-22 15:15:44 by Hibernate Tools 4.3.1.Final
import java.util.Date;
import java.util.HashSet;
diff --git a/src/main/java/org/fireply/enter/entity/Order.java b/src/main/java/org/fireply/enter/model/Order.java
similarity index 90%
rename from src/main/java/org/fireply/enter/entity/Order.java
rename to src/main/java/org/fireply/enter/model/Order.java
index 083af44..ae84257 100644
--- a/src/main/java/org/fireply/enter/entity/Order.java
+++ b/src/main/java/org/fireply/enter/model/Order.java
@@ -1,5 +1,5 @@
-package org.fireply.enter.entity;
-// Generated 2016-5-19 7:55:16 by Hibernate Tools 4.3.1.Final
+package org.fireply.enter.model;
+// Generated 2016-5-22 15:15:44 by Hibernate Tools 4.3.1.Final
import java.util.Date;
diff --git a/src/main/java/org/fireply/enter/entity/Production.java b/src/main/java/org/fireply/enter/model/Production.java
similarity index 92%
rename from src/main/java/org/fireply/enter/entity/Production.java
rename to src/main/java/org/fireply/enter/model/Production.java
index 8dee2fc..54f8723 100644
--- a/src/main/java/org/fireply/enter/entity/Production.java
+++ b/src/main/java/org/fireply/enter/model/Production.java
@@ -1,5 +1,5 @@
-package org.fireply.enter.entity;
-// Generated 2016-5-19 7:55:16 by Hibernate Tools 4.3.1.Final
+package org.fireply.enter.model;
+// Generated 2016-5-22 15:15:44 by Hibernate Tools 4.3.1.Final
import java.util.HashSet;
import java.util.Set;
diff --git a/src/main/java/org/fireply/enter/entity/ProductionGallery.java b/src/main/java/org/fireply/enter/model/ProductionGallery.java
similarity index 86%
rename from src/main/java/org/fireply/enter/entity/ProductionGallery.java
rename to src/main/java/org/fireply/enter/model/ProductionGallery.java
index 6a30387..40328b4 100644
--- a/src/main/java/org/fireply/enter/entity/ProductionGallery.java
+++ b/src/main/java/org/fireply/enter/model/ProductionGallery.java
@@ -1,5 +1,5 @@
-package org.fireply.enter.entity;
-// Generated 2016-5-19 7:55:16 by Hibernate Tools 4.3.1.Final
+package org.fireply.enter.model;
+// Generated 2016-5-22 15:15:44 by Hibernate Tools 4.3.1.Final
/**
* ProductionGallery generated by hbm2java
diff --git a/src/main/java/org/fireply/enter/entity/Proxy.java b/src/main/java/org/fireply/enter/model/Proxy.java
similarity index 91%
rename from src/main/java/org/fireply/enter/entity/Proxy.java
rename to src/main/java/org/fireply/enter/model/Proxy.java
index 3f3df3d..7957a6e 100644
--- a/src/main/java/org/fireply/enter/entity/Proxy.java
+++ b/src/main/java/org/fireply/enter/model/Proxy.java
@@ -1,5 +1,5 @@
-package org.fireply.enter.entity;
-// Generated 2016-5-19 7:55:16 by Hibernate Tools 4.3.1.Final
+package org.fireply.enter.model;
+// Generated 2016-5-22 15:15:44 by Hibernate Tools 4.3.1.Final
import java.util.HashSet;
import java.util.Set;
diff --git a/src/main/java/org/fireply/enter/entity/Qrcode.java b/src/main/java/org/fireply/enter/model/Qrcode.java
similarity index 89%
rename from src/main/java/org/fireply/enter/entity/Qrcode.java
rename to src/main/java/org/fireply/enter/model/Qrcode.java
index 8fbded1..d5de8f7 100644
--- a/src/main/java/org/fireply/enter/entity/Qrcode.java
+++ b/src/main/java/org/fireply/enter/model/Qrcode.java
@@ -1,5 +1,5 @@
-package org.fireply.enter.entity;
-// Generated 2016-5-19 7:55:16 by Hibernate Tools 4.3.1.Final
+package org.fireply.enter.model;
+// Generated 2016-5-22 15:15:44 by Hibernate Tools 4.3.1.Final
import java.util.HashSet;
import java.util.Set;
diff --git a/src/main/java/org/fireply/enter/entity/User.java b/src/main/java/org/fireply/enter/model/User.java
similarity index 79%
rename from src/main/java/org/fireply/enter/entity/User.java
rename to src/main/java/org/fireply/enter/model/User.java
index a23cb24..fad6cdf 100644
--- a/src/main/java/org/fireply/enter/entity/User.java
+++ b/src/main/java/org/fireply/enter/model/User.java
@@ -1,5 +1,5 @@
-package org.fireply.enter.entity;
-// Generated 2016-5-19 7:55:16 by Hibernate Tools 4.3.1.Final
+package org.fireply.enter.model;
+// Generated 2016-5-22 15:15:44 by Hibernate Tools 4.3.1.Final
import java.util.HashSet;
import java.util.Set;
@@ -21,10 +21,12 @@ public class User implements java.io.Serializable {
private String email;
private String userDesc;
private String headThumb;
+ private Set logins = new HashSet(0);
private Set newses = new HashSet(0);
private Set proxies = new HashSet(0);
private Set orders = new HashSet(0);
private Set commits = new HashSet(0);
+ private Set authorizations = new HashSet(0);
public User() {
}
@@ -35,7 +37,8 @@ public User(String id) {
public User(String id, Account account, Qrcode qrcode, String password, String name, Boolean sex,
String nativePlace, String birthday, String mobile, String email, String userDesc, String headThumb,
- Set newses, Set proxies, Set orders, Set commits) {
+ Set logins, Set newses, Set proxies, Set orders, Set commits,
+ Set authorizations) {
this.id = id;
this.account = account;
this.qrcode = qrcode;
@@ -48,10 +51,12 @@ public User(String id, Account account, Qrcode qrcode, String password, String n
this.email = email;
this.userDesc = userDesc;
this.headThumb = headThumb;
+ this.logins = logins;
this.newses = newses;
this.proxies = proxies;
this.orders = orders;
this.commits = commits;
+ this.authorizations = authorizations;
}
public String getId() {
@@ -150,6 +155,14 @@ public void setHeadThumb(String headThumb) {
this.headThumb = headThumb;
}
+ public Set getLogins() {
+ return this.logins;
+ }
+
+ public void setLogins(Set logins) {
+ this.logins = logins;
+ }
+
public Set getNewses() {
return this.newses;
}
@@ -182,4 +195,12 @@ public void setCommits(Set commits) {
this.commits = commits;
}
+ public Set getAuthorizations() {
+ return this.authorizations;
+ }
+
+ public void setAuthorizations(Set authorizations) {
+ this.authorizations = authorizations;
+ }
+
}
diff --git a/src/main/java/org/fireply/enter/security/AesException.java b/src/main/java/org/fireply/enter/security/AesException.java
new file mode 100644
index 0000000..e50e155
--- /dev/null
+++ b/src/main/java/org/fireply/enter/security/AesException.java
@@ -0,0 +1,59 @@
+package org.fireply.enter.security;
+
+@SuppressWarnings("serial")
+public class AesException extends Exception {
+
+ public final static int OK = 0;
+ public final static int ValidateSignatureError = -40001;
+ public final static int ParseXmlError = -40002;
+ public final static int ComputeSignatureError = -40003;
+ public final static int IllegalAesKey = -40004;
+ public final static int ValidateAppidError = -40005;
+ public final static int EncryptAESError = -40006;
+ public final static int DecryptAESError = -40007;
+ public final static int IllegalBuffer = -40008;
+ //public final static int EncodeBase64Error = -40009;
+ //public final static int DecodeBase64Error = -40010;
+ //public final static int GenReturnXmlError = -40011;
+
+ private int code;
+
+ private static String getMessage(int code) {
+ switch (code) {
+ case ValidateSignatureError:
+ return "签名验证错误";
+ case ParseXmlError:
+ return "xml解析失败";
+ case ComputeSignatureError:
+ return "sha加密生成签名失败";
+ case IllegalAesKey:
+ return "SymmetricKey非法";
+ case ValidateAppidError:
+ return "appid校验失败";
+ case EncryptAESError:
+ return "aes加密失败";
+ case DecryptAESError:
+ return "aes解密失败";
+ case IllegalBuffer:
+ return "解密后得到的buffer非法";
+// case EncodeBase64Error:
+// return "base64加密错误";
+// case DecodeBase64Error:
+// return "base64解密错误";
+// case GenReturnXmlError:
+// return "xml生成失败";
+ default:
+ return null; // cannot be
+ }
+ }
+
+ public int getCode() {
+ return code;
+ }
+
+ AesException(int code) {
+ super(getMessage(code));
+ this.code = code;
+ }
+
+}
diff --git a/src/main/java/org/fireply/enter/security/Md5.java b/src/main/java/org/fireply/enter/security/Md5.java
new file mode 100644
index 0000000..8ae0a91
--- /dev/null
+++ b/src/main/java/org/fireply/enter/security/Md5.java
@@ -0,0 +1,43 @@
+package org.fireply.enter.security;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Arrays;
+
+/**
+ * SHA1 签名生成类
+ *
+ */
+public class Md5 {
+
+ /**
+ * 用 SHA1算法生成安全签名
+ * @param unsign 待签名字符串
+ * @return 安全签名
+ * @throws AesException
+ *
+ */
+ public static String sign(String unsign) throws AesException {
+ try {
+ // SHA1签名生成
+ MessageDigest md = MessageDigest.getInstance("MD5");
+ md.update(unsign.getBytes());
+ byte[] digest = md.digest();
+
+ StringBuffer hexStr = new StringBuffer();
+ String shaHex = "";
+ for (int i = 0; i < digest.length; i++) {
+ shaHex = Integer.toHexString(digest[i] & 0xFF);
+ if (shaHex.length() < 2) {
+ hexStr.append(0);
+ }
+ hexStr.append(shaHex);
+ }
+ return hexStr.toString();
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new AesException(AesException.ComputeSignatureError);
+ }
+ }
+
+}
diff --git a/src/main/java/org/fireply/enter/security/Sign.java b/src/main/java/org/fireply/enter/security/Sign.java
new file mode 100644
index 0000000..02923cc
--- /dev/null
+++ b/src/main/java/org/fireply/enter/security/Sign.java
@@ -0,0 +1,43 @@
+package org.fireply.enter.security;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+public class Sign {
+
+ public static String encrypt(List unEncrypted) {
+ String encrypted = null;
+
+ if (unEncrypted == null) {
+ unEncrypted = new ArrayList<>();
+ }
+
+ String currentTime = Long.toString(System.currentTimeMillis());
+ unEncrypted.add(currentTime);
+ unEncrypted.add(getRandomStr());
+
+ Object[] unEncryptedArray = unEncrypted.toArray();
+ Arrays.sort(unEncryptedArray);
+
+ try {
+ encrypted = Md5.sign(unEncryptedArray.toString());
+ } catch (AesException e) {
+ e.printStackTrace();
+ }
+
+ return encrypted;
+ }
+
+ public static String getRandomStr() {
+ String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+ Random random = new Random();
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < 16; i++) {
+ int number = random.nextInt(base.length());
+ sb.append(base.charAt(number));
+ }
+ return sb.toString();
+ }
+}
diff --git a/src/main/java/org/fireply/enter/service/BaseService.java b/src/main/java/org/fireply/enter/service/BaseService.java
new file mode 100644
index 0000000..cf59a61
--- /dev/null
+++ b/src/main/java/org/fireply/enter/service/BaseService.java
@@ -0,0 +1,19 @@
+package org.fireply.enter.service;
+
+import java.io.Serializable;
+
+public interface BaseService {
+
+ void persist(Object object);
+
+ Serializable save(Object object);
+
+ void delete(Object object);
+
+ Object merge(Object object);
+
+ Object get(Class> clazz, Serializable id);
+
+ Object get(String entityName, Serializable id);
+
+}
diff --git a/src/main/java/org/fireply/enter/service/LoginService.java b/src/main/java/org/fireply/enter/service/LoginService.java
new file mode 100644
index 0000000..4abbc76
--- /dev/null
+++ b/src/main/java/org/fireply/enter/service/LoginService.java
@@ -0,0 +1,13 @@
+package org.fireply.enter.service;
+
+import javax.servlet.http.Cookie;
+
+public interface LoginService extends BaseService {
+
+ boolean loginByPassword(String userId, String signedPassword, String remoteAddr);
+
+ boolean loginByCookie(String userId, String sequence, String token, String remoteAddr);
+
+ boolean allowsLogin(String userId, String remoteAddr);
+
+}
diff --git a/src/main/java/org/fireply/enter/service/impl/BaseServiceImpl.java b/src/main/java/org/fireply/enter/service/impl/BaseServiceImpl.java
new file mode 100644
index 0000000..214a87b
--- /dev/null
+++ b/src/main/java/org/fireply/enter/service/impl/BaseServiceImpl.java
@@ -0,0 +1,107 @@
+package org.fireply.enter.service.impl;
+
+import java.io.Serializable;
+
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import org.fireply.enter.dao.Dao;
+import org.fireply.enter.service.BaseService;
+import org.hibernate.HibernateException;
+
+@Service
+@Transactional(readOnly=true)
+public class BaseServiceImpl implements BaseService {
+
+// private static final Logger logger = LoggerFactory.getLogger(BaseServiceImpl.class);
+
+ @Autowired
+ @Qualifier("daoImpl")
+ private Dao dao;
+
+ @Override
+ @Transactional
+ public void persist(Object object) {
+ if (object != null) {
+ dao.persist(object);
+// logger.debug("persist {} successful", object);
+ } else {
+// logger.error("persist failed, caused by: null object");
+ }
+ }
+
+ @Override
+ @Transactional
+ public Serializable save(Object object) {
+ Serializable result;
+ if (object != null) {
+ result = dao.save(object);
+// logger.debug("save successful");
+ } else {
+ result = null;
+// logger.error("save failed, caused by: null object");
+ }
+ return result;
+ }
+
+ @Override
+ @Transactional
+ public void delete(Object object) {
+ if (object != null) {
+ dao.delete(object);
+// logger.debug("delete successful");
+ } else {
+// logger.error("delete failed. caused by: null object");
+ }
+ }
+
+ @Override
+ @Transactional
+ public Object merge(Object object) {
+ Object result;
+ if (object != null) {
+ result = dao.merge(object);
+// logger.debug("merge successful");
+ } else {
+ result = null;
+// logger.error("merge failded, caused by: null object");
+ }
+ return result;
+ }
+
+ @Override
+ public Object get(Class> clazz, Serializable id) {
+ Object result = null;
+ if (clazz == null || id == null) {
+ result = null;
+// logger.error("get entity failed, caused by: null in parameters");
+ } else {
+ try {
+ result = dao.get(clazz, id);
+ } catch (HibernateException e) {
+ System.out.println("BaseService:get:");
+ e.printStackTrace();
+ }
+// logger.debug("get entity successful");
+ }
+ return result;
+ }
+
+ @Override
+ public Object get(String entityName, Serializable id) {
+ Object result;
+ if (entityName == null || id == null) {
+ result = null;
+// logger.error("get entity failed, caused by: null in parameters");
+ } else {
+ result = dao.get(entityName, id);
+// logger.debug("get entity successful");
+ }
+ return result;
+ }
+
+}
diff --git a/src/main/java/org/fireply/enter/service/impl/LoginServiceImpl.java b/src/main/java/org/fireply/enter/service/impl/LoginServiceImpl.java
new file mode 100644
index 0000000..783e1e0
--- /dev/null
+++ b/src/main/java/org/fireply/enter/service/impl/LoginServiceImpl.java
@@ -0,0 +1,48 @@
+package org.fireply.enter.service.impl;
+
+import org.fireply.enter.dao.Dao;
+import org.fireply.enter.model.User;
+import org.fireply.enter.service.LoginService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional
+public class LoginServiceImpl extends BaseServiceImpl implements LoginService {
+
+ @Autowired
+ @Qualifier("daoImpl")
+ private Dao dao;
+
+ @Override
+ public boolean loginByPassword(String userId, String signedPassword, String remoteAddr) {
+ User user = (User) dao.get(User.class, userId);
+ if (signedPassword != null && user != null && signedPassword.equals(user.getPassword())) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public boolean loginByCookie(String userId, String sequence, String token, String remoteAddr) {
+ // TODO loginByCookie
+ /*if (loginService != null && user != null && signedPassword.equals(user.getPassword())) {
+ List unEncrypted = new ArrayList<>();
+ unEncrypted.add(userId);
+ unEncrypted.add(signedPassword);
+
+ sequence = Sign.encrypt(unEncrypted);
+ token = Sign.encrypt(unEncrypted);
+ }*/
+ return true;
+ }
+
+ @Override
+ public boolean allowsLogin(String userId, String remoteAddr) {
+ return true;
+ }
+
+}
diff --git a/src/main/resources/applicationContext.xml b/src/main/resources/applicationContext.xml
index 6e6c489..0ebd863 100644
--- a/src/main/resources/applicationContext.xml
+++ b/src/main/resources/applicationContext.xml
@@ -38,7 +38,7 @@ http://www.springframework.org/schema/context/spring-context-4.2.xsd
-
+
${hibernate.dialect}
diff --git a/src/main/resources/enter/entity/Account.hbm.xml b/src/main/resources/enter/model/Account.hbm.xml
similarity index 74%
rename from src/main/resources/enter/entity/Account.hbm.xml
rename to src/main/resources/enter/model/Account.hbm.xml
index 136a936..23ca318 100644
--- a/src/main/resources/enter/entity/Account.hbm.xml
+++ b/src/main/resources/enter/model/Account.hbm.xml
@@ -1,9 +1,9 @@
-
+
-
+
@@ -18,7 +18,7 @@
-
+
diff --git a/src/main/resources/enter/model/Authorization.hbm.xml b/src/main/resources/enter/model/Authorization.hbm.xml
new file mode 100644
index 0000000..871ae4a
--- /dev/null
+++ b/src/main/resources/enter/model/Authorization.hbm.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/enter/entity/Category.hbm.xml b/src/main/resources/enter/model/Category.hbm.xml
similarity index 71%
rename from src/main/resources/enter/entity/Category.hbm.xml
rename to src/main/resources/enter/model/Category.hbm.xml
index 6e55bd4..1d4dd2c 100644
--- a/src/main/resources/enter/entity/Category.hbm.xml
+++ b/src/main/resources/enter/model/Category.hbm.xml
@@ -1,9 +1,9 @@
-
+
-
+
@@ -15,7 +15,7 @@
-
+
diff --git a/src/main/resources/enter/entity/Commit.hbm.xml b/src/main/resources/enter/model/Commit.hbm.xml
similarity index 67%
rename from src/main/resources/enter/entity/Commit.hbm.xml
rename to src/main/resources/enter/model/Commit.hbm.xml
index b0f65fb..3e6c45b 100644
--- a/src/main/resources/enter/entity/Commit.hbm.xml
+++ b/src/main/resources/enter/model/Commit.hbm.xml
@@ -1,17 +1,17 @@
-
+
-
+
-
+
-
+
diff --git a/src/main/resources/enter/model/Login.hbm.xml b/src/main/resources/enter/model/Login.hbm.xml
new file mode 100644
index 0000000..15e20c5
--- /dev/null
+++ b/src/main/resources/enter/model/Login.hbm.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/enter/entity/News.hbm.xml b/src/main/resources/enter/model/News.hbm.xml
similarity index 74%
rename from src/main/resources/enter/entity/News.hbm.xml
rename to src/main/resources/enter/model/News.hbm.xml
index b13be05..1acfd65 100644
--- a/src/main/resources/enter/entity/News.hbm.xml
+++ b/src/main/resources/enter/model/News.hbm.xml
@@ -1,14 +1,14 @@
-
+
-
+
-
+
@@ -24,7 +24,7 @@
-
+
diff --git a/src/main/resources/enter/entity/Order.hbm.xml b/src/main/resources/enter/model/Order.hbm.xml
similarity index 71%
rename from src/main/resources/enter/entity/Order.hbm.xml
rename to src/main/resources/enter/model/Order.hbm.xml
index 592242f..a630a0d 100644
--- a/src/main/resources/enter/entity/Order.hbm.xml
+++ b/src/main/resources/enter/model/Order.hbm.xml
@@ -1,20 +1,20 @@
-
+
-
+
-
+
-
+
-
+
diff --git a/src/main/resources/enter/entity/Production.hbm.xml b/src/main/resources/enter/model/Production.hbm.xml
similarity index 74%
rename from src/main/resources/enter/entity/Production.hbm.xml
rename to src/main/resources/enter/model/Production.hbm.xml
index 386f682..a6c9e0b 100644
--- a/src/main/resources/enter/entity/Production.hbm.xml
+++ b/src/main/resources/enter/model/Production.hbm.xml
@@ -1,14 +1,14 @@
-
+
-
+
-
+
@@ -27,13 +27,13 @@
-
+
-
+
diff --git a/src/main/resources/enter/entity/ProductionGallery.hbm.xml b/src/main/resources/enter/model/ProductionGallery.hbm.xml
similarity index 72%
rename from src/main/resources/enter/entity/ProductionGallery.hbm.xml
rename to src/main/resources/enter/model/ProductionGallery.hbm.xml
index 646fc41..6954667 100644
--- a/src/main/resources/enter/entity/ProductionGallery.hbm.xml
+++ b/src/main/resources/enter/model/ProductionGallery.hbm.xml
@@ -1,14 +1,14 @@
-
+
-
+
-
+
diff --git a/src/main/resources/enter/entity/Proxy.hbm.xml b/src/main/resources/enter/model/Proxy.hbm.xml
similarity index 74%
rename from src/main/resources/enter/entity/Proxy.hbm.xml
rename to src/main/resources/enter/model/Proxy.hbm.xml
index 6a63c63..2cb4f04 100644
--- a/src/main/resources/enter/entity/Proxy.hbm.xml
+++ b/src/main/resources/enter/model/Proxy.hbm.xml
@@ -1,17 +1,17 @@
-
+
-
+
-
+
-
+
@@ -33,7 +33,7 @@
-
+
diff --git a/src/main/resources/enter/entity/Qrcode.hbm.xml b/src/main/resources/enter/model/Qrcode.hbm.xml
similarity index 74%
rename from src/main/resources/enter/entity/Qrcode.hbm.xml
rename to src/main/resources/enter/model/Qrcode.hbm.xml
index 62e130f..cb7a18b 100644
--- a/src/main/resources/enter/entity/Qrcode.hbm.xml
+++ b/src/main/resources/enter/model/Qrcode.hbm.xml
@@ -1,9 +1,9 @@
-
+
-
+
@@ -18,13 +18,13 @@
-
+
-
+
diff --git a/src/main/resources/enter/entity/User.hbm.xml b/src/main/resources/enter/model/User.hbm.xml
similarity index 65%
rename from src/main/resources/enter/entity/User.hbm.xml
rename to src/main/resources/enter/model/User.hbm.xml
index 1b719ab..9888c82 100644
--- a/src/main/resources/enter/entity/User.hbm.xml
+++ b/src/main/resources/enter/model/User.hbm.xml
@@ -1,17 +1,17 @@
-
+
-
+
-
+
-
+
@@ -41,29 +41,41 @@
+
+
+
+
+
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
diff --git a/src/main/resources/struts.xml b/src/main/resources/struts.xml
index 59c622a..cb01282 100644
--- a/src/main/resources/struts.xml
+++ b/src/main/resources/struts.xml
@@ -5,10 +5,37 @@
+
+
+
+ /signin.jsp
error/error.jsp
+
+
+ /index.jsp
+
+
+
+ profile/user.jsp
+ profile/admin.jsp
+ error/error.jsp
+
+
+
+ profile/user.jsp
+
+
\ No newline at end of file
diff --git a/src/test/java/org/fireply/enter/test/security/SignTest.java b/src/test/java/org/fireply/enter/test/security/SignTest.java
new file mode 100644
index 0000000..3dbdfea
--- /dev/null
+++ b/src/test/java/org/fireply/enter/test/security/SignTest.java
@@ -0,0 +1,23 @@
+package org.fireply.enter.test.security;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.fireply.enter.security.Sign;
+import org.fireply.enter.test.BaseSpringJunit4Test;
+import org.junit.Test;
+import static org.junit.Assert.assertNotNull;
+
+public class SignTest {
+
+ @Test
+ public void signTest() {
+ List unEncrypt = new ArrayList<>();
+ unEncrypt.add("userId");
+ unEncrypt.add("userPassword");
+
+ String token = Sign.encrypt(unEncrypt);
+ System.out.println(token);
+ assertNotNull(token);
+ }
+}
diff --git a/src/test/java/org/fireply/enter/test/service/ServiceAutowiredTest.java b/src/test/java/org/fireply/enter/test/service/ServiceAutowiredTest.java
new file mode 100644
index 0000000..bb943a8
--- /dev/null
+++ b/src/test/java/org/fireply/enter/test/service/ServiceAutowiredTest.java
@@ -0,0 +1,32 @@
+package org.fireply.enter.test.service;
+
+import static org.junit.Assert.*;
+
+import org.fireply.enter.service.BaseService;
+import org.fireply.enter.service.LoginService;
+import org.fireply.enter.test.BaseSpringJunit4Test;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+
+public class ServiceAutowiredTest extends BaseSpringJunit4Test {
+
+ @Autowired
+ @Qualifier("baseServiceImpl")
+ BaseService baseService;
+
+ @Autowired
+ @Qualifier("loginServiceImpl")
+ LoginService loginService;
+
+ @Test
+ public void baseServiceAutowiredTest() {
+ assertNotNull(baseService);
+ }
+
+ @Test
+ public void loginServiceAutowiredTest() {
+ assertNotNull(loginService);
+ }
+
+}