forked from jjoe64/shiroexample
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
141 lines (105 loc) · 4.57 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# shiro-hibernate-mysql-eclipse-example by sbecker11
I have updated the tutorial provided by jjoe64 at
http://www.jjoe64.com/2014/01/apache-shiro-with-hibernatesql-full.html
to work nicely with Eclipse-kepler by making the following changes:
1. Refactored the source files to follow the standard maven layout:
/shiroexample
src
main
java
com
jjoe64
auth
*.java
daos
*.java
models
*.java
utils
*.java
resources
hibernate.cfg.xml
2. Made the following additions to the pom.xml file
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
...
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
3. Updated HibernateUtil.java per the suggestions made at
http://stackoverflow.com/questions/8621906/
is-buildsessionfactory-deprecated-in-hibernate-4
4. Fixed deprecation WARNINGs of using positional Hibernate query parameters
in UserDAO and UserRoleDAO by changing them to use named parameters instead.
5. Added /scripts directory with shared eclipse launch script named
"shiroexample clean compile package.launch"
6. Added user-define PASSWORD marker to
* /src/main/resources/hibernate.cfg.xml
* /WebContent/WEB-INF/shiro.ini
7. Wrapped the request.message attribute with in-line java in
* /WebContent/includes/login.jsp
* /WebContent/includes/register.jsp
<%
Object message = request.getAttribute("message");
if( message != null )
out.println(message.toString());
%>
How to clone, build and test this project on Mac OSX
First time only:
1. go to my fork of jjoe64's original project in github
open https://github.com/sbecker11/shiroexample
2. copy the HTTPS clone URL and paste it into your terminal window
$ cd <eclipse workspace>
$ git clone https://github.com/sbecker11/shiroexample.git
3. go into new project folder
$ cd <eclipse workspace>/shiroexample
4. verify remote master
$ git remote -v
5. eclipsify the project
mvn eclipse:eclipse
6. open Eclipse-kepler and import the new shiroexample maven project
Eclipse > Import... > Existing maven project and
open <eclipse workspace>/shiroexample
7. Update the shiroexample project from Project Explorer
Right-click on shiroexample > Maven > Update Project...
8. Fix the build path
Right-click on shiroexample > Build Path > Configure Build Path...
in Libraries tab
remove all but 1.7 JRE System Library
click "Add Library" and select "Maven Managed Dependencies"
9. Update the shiroexample project again
Right-click on project name > Maven > Update Project...
10. Start mysql server and create a new schema named "shiroexample"
11. Upload the sql dump file into shiroexample
$ mysql -h localhost -u root --password=PASSWORD shiroexample < dump.sql
12. Compile and package the webapp using Eclipse > Run Configurations...
and select shiroexample clean compile package
13. Start the local tomcat7 server
$ /usr/local/apache-tomcat/bin/startup.sh
14. Open the local tomcat7 manager
$ open http://localhost:8080/manager/html
15. In WAR file to deploy, Select WAR file to upload "Browse..." and Open
<eclipse workspace>/shiroexample/target/shiroexample-0.0.1-SNAPSHOT.war
and then click "Deploy"
16. Test the shiroexample web app by going first to the register page
$ open http://localhost:8080/shiroexample-0.0.1-SNAPSHOT/register
17. Then submit an E-Mail and Password for a new AMIN user
18. Click the Login link and then the Admin link and then Logout
19. Commit all local changes
$ git add .
$ git commit -m 'First commit'
20. Push local origin changes to remote master
$ git push origin master
21. After making any more local changes commit them to local origin
$ git add .
$ git commit -m 'message'
22. And then push local origin changes to remote master
$ git push origin master
Enjoy,
Shawn Becker (sbecker11)
2015-03-24T14:55:36.000-0400