Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xxl-job
Project
Project
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
刘晓滨
xxl-job
Commits
de411ea1
Commit
de411ea1
authored
Oct 09, 2021
by
chengcheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(xxl-job):登录用户名密码由数据库查询认证
parent
1925024a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
20 deletions
+22
-20
PermissionInterceptor.java
...b/admin/controller/interceptor/PermissionInterceptor.java
+12
-15
application.properties
xxl-job-admin/src/main/resources/application.properties
+2
-2
XxlJobAdminMapper.xml
...n/src/main/resources/mybatis-mapper/XxlJobAdminMapper.xml
+2
-1
JobInfoControllerTest.java
...a/com/xxl/job/admin/controller/JobInfoControllerTest.java
+6
-2
No files found.
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java
View file @
de411ea1
...
@@ -25,27 +25,24 @@ public class PermissionInterceptor extends HandlerInterceptorAdapter {
...
@@ -25,27 +25,24 @@ public class PermissionInterceptor extends HandlerInterceptorAdapter {
public
static
final
String
LOGIN_IDENTITY_KEY
=
"XXL_JOB_LOGIN_IDENTITY"
;
public
static
final
String
LOGIN_IDENTITY_KEY
=
"XXL_JOB_LOGIN_IDENTITY"
;
private
static
String
LOGIN_IDENTITY_TOKEN
;
private
static
String
LOGIN_IDENTITY_TOKEN
;
public
static
String
getLoginIdentityToken
()
{
public
static
String
getLoginIdentityToken
()
{
if
(
LOGIN_IDENTITY_TOKEN
==
null
)
{
XxlJobAdminDao
xxlJobAdminDao
=
XxlJobAdminConfig
.
getAdminConfig
().
getXxlJobAdminDao
();
XxlJobAdminDao
xxlJobAdminDao
=
XxlJobAdminConfig
.
getAdminConfig
().
getXxlJobAdminDao
();
XxlJobAdmin
admin
=
xxlJobAdminDao
.
findOne
();
XxlJobAdmin
admin
=
xxlJobAdminDao
.
findOne
();
if
(
admin
==
null
)
{
if
(
admin
==
null
)
{
return
LOGIN_IDENTITY_TOKEN
;
return
LOGIN_IDENTITY_TOKEN
;
}
}
String
username
=
admin
.
getUsername
();
String
username
=
admin
.
getUsername
();
String
password
=
admin
.
getPassword
();
String
password
=
admin
.
getPassword
();
// login token
// login token
String
tokenTmp
=
DigestUtils
.
md5DigestAsHex
(
String
.
valueOf
(
username
+
"_"
+
password
).
getBytes
());
//.getBytes("UTF-8")
String
tokenTmp
=
DigestUtils
.
md5DigestAsHex
(
String
.
valueOf
(
username
+
"_"
+
password
).
getBytes
());
//.getBytes("UTF-8")
tokenTmp
=
new
BigInteger
(
1
,
tokenTmp
.
getBytes
()).
toString
(
16
);
tokenTmp
=
new
BigInteger
(
1
,
tokenTmp
.
getBytes
()).
toString
(
16
);
LOGIN_IDENTITY_TOKEN
=
tokenTmp
;
return
tokenTmp
;
}
return
LOGIN_IDENTITY_TOKEN
;
}
}
public
static
boolean
login
(
HttpServletResponse
response
,
String
username
,
String
password
,
boolean
ifRemember
){
public
static
boolean
login
(
HttpServletResponse
response
,
String
username
,
String
password
,
boolean
ifRemember
){
// login token
// login token
String
tokenTmp
=
DigestUtils
.
md5DigestAsHex
(
String
.
valueOf
(
username
+
"_"
+
password
).
getBytes
());
String
tokenTmp
=
DigestUtils
.
md5DigestAsHex
(
String
.
valueOf
(
username
+
"_"
+
password
).
getBytes
());
tokenTmp
=
new
BigInteger
(
1
,
tokenTmp
.
getBytes
()).
toString
(
16
);
tokenTmp
=
new
BigInteger
(
1
,
tokenTmp
.
getBytes
()).
toString
(
16
);
...
...
xxl-job-admin/src/main/resources/application.properties
View file @
de411ea1
...
@@ -36,8 +36,8 @@ xxl.job.mail.password=Chyezaq1234
...
@@ -36,8 +36,8 @@ xxl.job.mail.password=Chyezaq1234
xxl.job.mail.sendNick
=
XXL-JOB
xxl.job.mail.sendNick
=
XXL-JOB
### xxl-job login
### xxl-job login
xxl.job.login.username
=
admin
#
xxl.job.login.username=admin
xxl.job.login.password
=
123456
#
xxl.job.login.password=123456
### xxl-job, access token
### xxl-job, access token
xxl.job.accessToken
=
xxl.job.accessToken
=
...
...
xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobAdminMapper.xml
View file @
de411ea1
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
<select
id=
"findOne"
resultMap=
"XxlJobAdmin"
>
<select
id=
"findOne"
resultMap=
"XxlJobAdmin"
>
SELECT
<include
refid=
"Base_Column_List"
/>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM XXL_JOB_QRTZ_ADMIN AS t
FROM XXL_JOB_QRTZ_ADMIN AS t
ORDER BY t.
order
ASC LIMIT 1
ORDER BY t.
id
ASC LIMIT 1
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
xxl-job-admin/src/test/java/com/xxl/job/admin/controller/JobInfoControllerTest.java
View file @
de411ea1
...
@@ -2,6 +2,8 @@ package com.xxl.job.admin.controller;
...
@@ -2,6 +2,8 @@ package com.xxl.job.admin.controller;
import
com.xxl.job.admin.controller.interceptor.PermissionInterceptor
;
import
com.xxl.job.admin.controller.interceptor.PermissionInterceptor
;
import
com.xxl.job.admin.core.conf.XxlJobAdminConfig
;
import
com.xxl.job.admin.core.conf.XxlJobAdminConfig
;
import
com.xxl.job.admin.core.model.XxlJobAdmin
;
import
com.xxl.job.admin.dao.XxlJobAdminDao
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.MediaType
;
...
@@ -19,11 +21,13 @@ public class JobInfoControllerTest extends AbstractSpringMvcTest {
...
@@ -19,11 +21,13 @@ public class JobInfoControllerTest extends AbstractSpringMvcTest {
@Before
@Before
public
void
login
()
throws
Exception
{
public
void
login
()
throws
Exception
{
XxlJobAdminDao
xxlJobAdminDao
=
XxlJobAdminConfig
.
getAdminConfig
().
getXxlJobAdminDao
();
XxlJobAdmin
admin
=
xxlJobAdminDao
.
findOne
();
MvcResult
ret
=
mockMvc
.
perform
(
MvcResult
ret
=
mockMvc
.
perform
(
post
(
"/login"
)
post
(
"/login"
)
.
contentType
(
MediaType
.
APPLICATION_FORM_URLENCODED
)
.
contentType
(
MediaType
.
APPLICATION_FORM_URLENCODED
)
.
param
(
"userName"
,
XxlJobAdminConfig
.
getAdminConfig
().
getLogin
Username
())
.
param
(
"userName"
,
admin
.
get
Username
())
.
param
(
"password"
,
XxlJobAdminConfig
.
getAdminConfig
().
getLogin
Password
())
.
param
(
"password"
,
admin
.
get
Password
())
).
andReturn
();
).
andReturn
();
cookie
=
ret
.
getResponse
().
getCookie
(
PermissionInterceptor
.
LOGIN_IDENTITY_KEY
);
cookie
=
ret
.
getResponse
().
getCookie
(
PermissionInterceptor
.
LOGIN_IDENTITY_KEY
);
}
}
...
...
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