Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cash-loan-flow-boss
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QG
cash-loan-flow-boss
Commits
891751f9
Commit
891751f9
authored
Aug 21, 2019
by
WeiWei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录接口有boolean类型改为返回session id
parent
cf9b4269
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
21 deletions
+8
-21
LogController.java
...up/cashloanflowboss/api/log/controller/LogController.java
+5
-4
LogService.java
...antgroup/cashloanflowboss/api/log/service/LogService.java
+2
-15
TomcatConfiguration.java
...hloanflowboss/core/configuration/TomcatConfiguration.java
+1
-2
No files found.
src/main/java/cn/quantgroup/cashloanflowboss/api/log/controller/LogController.java
View file @
891751f9
...
@@ -7,7 +7,10 @@ import cn.quantgroup.cashloanflowboss.component.security.annotiation.Security;
...
@@ -7,7 +7,10 @@ import cn.quantgroup.cashloanflowboss.component.security.annotiation.Security;
import
cn.quantgroup.cashloanflowboss.core.base.Result
;
import
cn.quantgroup.cashloanflowboss.core.base.Result
;
import
cn.quantgroup.cashloanflowboss.core.dictionary.ApplicationStatus
;
import
cn.quantgroup.cashloanflowboss.core.dictionary.ApplicationStatus
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
...
@@ -26,9 +29,8 @@ public class LogController {
...
@@ -26,9 +29,8 @@ public class LogController {
* @param loginFormModel
* @param loginFormModel
* @return
* @return
*/
*/
@CrossOrigin
(
allowCredentials
=
"true"
)
@PostMapping
(
"/login"
)
@PostMapping
(
"/login"
)
public
Result
<
Boolean
>
login
(
@RequestBody
@Valid
LoginFormModel
loginFormModel
)
{
public
Result
<
String
>
login
(
@RequestBody
@Valid
LoginFormModel
loginFormModel
)
{
return
new
Result
<>(
ApplicationStatus
.
SUCCESS
,
this
.
logService
.
login
(
loginFormModel
.
getUsername
(),
loginFormModel
.
getPassword
()));
return
new
Result
<>(
ApplicationStatus
.
SUCCESS
,
this
.
logService
.
login
(
loginFormModel
.
getUsername
(),
loginFormModel
.
getPassword
()));
}
}
...
@@ -37,7 +39,6 @@ public class LogController {
...
@@ -37,7 +39,6 @@ public class LogController {
*
*
* @return
* @return
*/
*/
@CrossOrigin
(
allowCredentials
=
"true"
)
@DeleteMapping
(
"/logout"
)
@DeleteMapping
(
"/logout"
)
@Security
(
authorityId
=
"Log.logout"
,
authorities
=
Authority
.
READ
)
@Security
(
authorityId
=
"Log.logout"
,
authorities
=
Authority
.
READ
)
public
Result
<
Boolean
>
logout
()
{
public
Result
<
Boolean
>
logout
()
{
...
...
src/main/java/cn/quantgroup/cashloanflowboss/api/log/service/LogService.java
View file @
891751f9
...
@@ -13,9 +13,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -13,9 +13,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpSession
;
import
javax.servlet.http.HttpSession
;
/**
/**
...
@@ -31,9 +29,6 @@ public class LogService {
...
@@ -31,9 +29,6 @@ public class LogService {
@Autowired
@Autowired
private
HttpServletRequest
request
;
private
HttpServletRequest
request
;
@Autowired
private
HttpServletResponse
response
;
/**
/**
* 登入
* 登入
*
*
...
@@ -41,7 +36,7 @@ public class LogService {
...
@@ -41,7 +36,7 @@ public class LogService {
* @param password 密码(明文)
* @param password 密码(明文)
* @return
* @return
*/
*/
public
boolean
login
(
String
username
,
String
password
)
{
public
String
login
(
String
username
,
String
password
)
{
User
user
=
this
.
userService
.
getUser
(
username
);
User
user
=
this
.
userService
.
getUser
(
username
);
...
@@ -66,15 +61,7 @@ public class LogService {
...
@@ -66,15 +61,7 @@ public class LogService {
session
.
setAttribute
(
ApplicationDictionary
.
PRINCIPAL
,
JSONTools
.
serialize
(
principal
));
session
.
setAttribute
(
ApplicationDictionary
.
PRINCIPAL
,
JSONTools
.
serialize
(
principal
));
// Cookie cookie = new Cookie("JSESSIONID", session.getId());
return
session
.
getId
();
// log.info("登录客户端IP:{}", request.getRemoteAddr());
// cookie.setHttpOnly(false);
// cookie.setDomain(request.getRemoteAddr());
// cookie.setPath("/");
//
// this.response.addCookie(cookie);
return
true
;
}
}
...
...
src/main/java/cn/quantgroup/cashloanflowboss/core/configuration/TomcatConfiguration.java
View file @
891751f9
...
@@ -18,8 +18,7 @@ public class TomcatConfiguration {
...
@@ -18,8 +18,7 @@ public class TomcatConfiguration {
return
container
->
{
return
container
->
{
if
(
container
instanceof
TomcatEmbeddedServletContainerFactory
)
{
if
(
container
instanceof
TomcatEmbeddedServletContainerFactory
)
{
((
TomcatEmbeddedServletContainerFactory
)
container
)
((
TomcatEmbeddedServletContainerFactory
)
container
).
addContextCustomizers
((
TomcatContextCustomizer
)
context
->
context
.
setCookieProcessor
(
new
LegacyCookieProcessor
()));
.
addContextCustomizers
((
TomcatContextCustomizer
)
context
->
context
.
setCookieProcessor
(
new
LegacyCookieProcessor
()));
}
}
};
};
...
...
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