Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
saasio
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
reyun
saasio
Commits
d9ec8c00
Commit
d9ec8c00
authored
May 04, 2018
by
carrieyzzhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demo
parent
78cfa186
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
1 deletion
+87
-1
DemoController.java
src/main/java/com/reyun/controller/DemoController.java
+87
-0
AuthorizationInterceptor.java
.../reyun/security/interceptor/AuthorizationInterceptor.java
+0
-1
No files found.
src/main/java/com/reyun/controller/DemoController.java
0 → 100644
View file @
d9ec8c00
package
com
.
reyun
.
controller
;
import
com.google.common.collect.Maps
;
import
com.reyun.model.Account
;
import
com.reyun.repository.AccountRepository
;
import
com.reyun.repository.BussinessManRepository
;
import
com.reyun.security.RedisLoginStatusManager
;
import
com.reyun.security.TokenManager
;
import
com.reyun.service.*
;
import
com.reyun.util.CipherUtil
;
import
com.reyun.util.ResultModel
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Map
;
@Controller
@RequestMapping
(
"demo"
)
public
class
DemoController
{
protected
Logger
logger
=
LoggerFactory
.
getLogger
(
DemoController
.
class
);
@Autowired
private
DemoAppointmentService
demoAppointmentService
;
@Autowired
LoginService
loginService
;
@Autowired
TokenManager
tokenManager
;
@Autowired
AccountRepository
accountRepository
;
@Autowired
UserLogService
userLogService
;
@Autowired
ConfigParamService
configParamService
;
@Autowired
RedisLoginStatusManager
redisLoginStatusManager
;
@Autowired
BussinessManRepository
bussinessManRepository
;
@Autowired
AuthService
authService
;
@RequestMapping
(
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResultModel
demologin
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
String
email
=
"demo@reyun.com"
;
String
password
=
"111111"
;
Account
account
=
loginService
.
login
(
email
,
password
);
Map
<
String
,
Object
>
rtnMap
=
Maps
.
newHashMap
();
if
(
account
!=
null
)
{
//存储token
String
token
=
tokenManager
.
createToken
(
String
.
valueOf
(
account
.
getId
()));
//存储登陆密码
redisLoginStatusManager
.
createLoginStatus
(
token
,
account
.
getIsMasterLogin
()
?
CipherUtil
.
generatePassword
(
configParamService
.
generateMasterPwd
())
:
account
.
getPassword
());
rtnMap
.
put
(
"code"
,
200
);
rtnMap
.
put
(
"token"
,
token
);
rtnMap
.
put
(
"account"
,
account
);
return
ResultModel
.
OK
(
rtnMap
);
}
else
{
// 没有此账号
rtnMap
.
put
(
"code"
,
205
);
rtnMap
.
put
(
"msg"
,
"用户名或密码不正确"
);
return
ResultModel
.
OK
(
rtnMap
);
}
}
}
src/main/java/com/reyun/security/interceptor/AuthorizationInterceptor.java
View file @
d9ec8c00
...
...
@@ -86,7 +86,6 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
||
request
.
getRequestURI
().
startsWith
(
"/api/demo"
)
||
request
.
getRequestURI
().
startsWith
(
"/api/messagecode"
)
||
request
.
getRequestURI
().
startsWith
(
"/api/report/all/home"
)){
System
.
out
.
println
(
request
.
getRequestURI
());
return
true
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment