Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
notes2.0
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zjm
notes2.0
Commits
2483b44e
提交
2483b44e
authored
3月 10, 2020
作者:
gongwenjie
浏览文件
操作
浏览文件
下载
差异文件
合并分支 'gwj' 到 'master'
Gwj 查看合并请求
!45
上级
92b2054a
59541e38
流水线
#66
已取消 于阶段
变更
5
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
38 行增加
和
10 行删除
+38
-10
MyUserDetailsServiceImpl.java
...com/zjty/tynotes/pas/config/MyUserDetailsServiceImpl.java
+2
-2
MySuccessHandler.java
...com/zjty/tynotes/pas/config/handler/MySuccessHandler.java
+11
-0
Init.java
notes-pas/src/main/java/com/zjty/tynotes/pas/task/Init.java
+22
-4
application.properties
notes-union/src/main/resources/application.properties
+2
-2
UserManageServiceImpl.java
...es/weekly/subject/service/impl/UserManageServiceImpl.java
+1
-2
没有找到文件。
notes-pas/src/main/java/com/zjty/tynotes/pas/config/MyUserDetailsServiceImpl.java
浏览文件 @
2483b44e
...
@@ -54,7 +54,7 @@ public class MyUserDetailsServiceImpl implements UserDetailsService {
...
@@ -54,7 +54,7 @@ public class MyUserDetailsServiceImpl implements UserDetailsService {
if
(
username
.
equals
(
"root"
)){
if
(
username
.
equals
(
"root"
)){
User
root
=
init
.
root
;
User
root
=
init
.
root
;
// root.setPassword("root");
// root.setPassword("root");
//
root.setPassword(bCryptPasswordEncoder.encode("root"));
root
.
setPassword
(
bCryptPasswordEncoder
.
encode
(
"root"
));
List
<
SimpleGrantedAuthority
>
authorityList
=
new
ArrayList
<>();
List
<
SimpleGrantedAuthority
>
authorityList
=
new
ArrayList
<>();
List
<
Role
>
roles
=
root
.
getRoles
();
List
<
Role
>
roles
=
root
.
getRoles
();
Role
role
=
roles
.
get
(
0
);
Role
role
=
roles
.
get
(
0
);
...
@@ -77,7 +77,7 @@ public class MyUserDetailsServiceImpl implements UserDetailsService {
...
@@ -77,7 +77,7 @@ public class MyUserDetailsServiceImpl implements UserDetailsService {
}
}
}
}
user
.
setUsername
(
username
);
user
.
setUsername
(
username
);
user
.
setPassword
(
bCryptPasswordEncoder
.
encode
(
user
.
getPassword
()));
//
user.setPassword(bCryptPasswordEncoder.encode(user.getPassword()));
ArrayList
<
SimpleGrantedAuthority
>
list
=
new
ArrayList
<>();
ArrayList
<
SimpleGrantedAuthority
>
list
=
new
ArrayList
<>();
List
<
Role
>
roles
=
roleDao
.
findAllByIdIn
(
roleIds
);
List
<
Role
>
roles
=
roleDao
.
findAllByIdIn
(
roleIds
);
List
<
RoleAuthority
>
roleAuthorities
=
roleAuthorityDao
.
findAllByRoleIdIn
(
roleIds
);
List
<
RoleAuthority
>
roleAuthorities
=
roleAuthorityDao
.
findAllByRoleIdIn
(
roleIds
);
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/config/handler/MySuccessHandler.java
浏览文件 @
2483b44e
...
@@ -82,6 +82,8 @@ public class MySuccessHandler implements AuthenticationSuccessHandler {
...
@@ -82,6 +82,8 @@ public class MySuccessHandler implements AuthenticationSuccessHandler {
String
value
=
cookies
[
0
].
getValue
();
String
value
=
cookies
[
0
].
getValue
();
List
<
Object
>
o
=
sessionRegistry
.
getAllPrincipals
();
List
<
Object
>
o
=
sessionRegistry
.
getAllPrincipals
();
User
user
=
(
User
)
authentication
.
getPrincipal
();
User
user
=
(
User
)
authentication
.
getPrincipal
();
String
encode
=
bCryptPasswordEncoder
.
encode
(
user
.
getPassword
());
user
.
setPassword
(
encode
);
for
(
Object
principal
:
o
)
{
for
(
Object
principal
:
o
)
{
User
cacheUser
=
(
User
)
principal
;
User
cacheUser
=
(
User
)
principal
;
if
(
cacheUser
.
getUsername
().
equals
(
user
.
getUsername
()))
{
if
(
cacheUser
.
getUsername
().
equals
(
user
.
getUsername
()))
{
...
@@ -125,4 +127,13 @@ public class MySuccessHandler implements AuthenticationSuccessHandler {
...
@@ -125,4 +127,13 @@ public class MySuccessHandler implements AuthenticationSuccessHandler {
httpServletResponse
.
setContentType
(
"application/json; charset=utf-8"
);
httpServletResponse
.
setContentType
(
"application/json; charset=utf-8"
);
httpServletResponse
.
getWriter
().
println
(
new
ObjectMapper
().
writeValueAsString
(
user
));
httpServletResponse
.
getWriter
().
println
(
new
ObjectMapper
().
writeValueAsString
(
user
));
}
}
public
static
void
main
(
String
[]
args
)
{
String
s
=
"qwer1234"
;
BCryptPasswordEncoder
bCryptPasswordEncoder
=
new
BCryptPasswordEncoder
();
String
encode
=
bCryptPasswordEncoder
.
encode
(
s
);
System
.
out
.
println
(
encode
);
String
encode1
=
bCryptPasswordEncoder
.
encode
(
encode
);
System
.
out
.
println
(
encode1
);
}
}
}
notes-pas/src/main/java/com/zjty/tynotes/pas/task/Init.java
浏览文件 @
2483b44e
package
com
.
zjty
.
tynotes
.
pas
.
task
;
package
com
.
zjty
.
tynotes
.
pas
.
task
;
import
com.zjty.tynotes.pas.dao.AuthorityDao
;
import
com.zjty.tynotes.pas.dao.*
;
import
com.zjty.tynotes.pas.dao.PasUserDao
;
import
com.zjty.tynotes.pas.dao.RoleDao
;
import
com.zjty.tynotes.pas.dao.UserRoleDao
;
import
com.zjty.tynotes.pas.entity.*
;
import
com.zjty.tynotes.pas.entity.*
;
import
com.zjty.tynotes.pas.service.IAuthorityService
;
import
com.zjty.tynotes.pas.service.IAuthorityService
;
import
com.zjty.tynotes.pas.service.IDepartmentService
;
import
com.zjty.tynotes.pas.service.IDepartmentService
;
...
@@ -39,6 +36,8 @@ public class Init implements CommandLineRunner {
...
@@ -39,6 +36,8 @@ public class Init implements CommandLineRunner {
private
RoleDao
roleDao
;
private
RoleDao
roleDao
;
@Autowired
@Autowired
private
UserRoleDao
userRoleDao
;
private
UserRoleDao
userRoleDao
;
@Autowired
private
RoleAuthorityDao
roleAuthorityDao
;
public
User
root
;
public
User
root
;
...
@@ -80,8 +79,25 @@ public class Init implements CommandLineRunner {
...
@@ -80,8 +79,25 @@ public class Init implements CommandLineRunner {
// iRoleService.deleteAll();
// iRoleService.deleteAll();
User
user
=
pasUserDao
.
findByUsername
(
"root"
);
User
user
=
pasUserDao
.
findByUsername
(
"root"
);
System
.
out
.
println
(
user
);
System
.
out
.
println
(
user
);
if
(
user
!=
null
){
if
(
user
!=
null
){
List
<
UserRole
>
userRoles
=
userRoleDao
.
findAllByUserId
(
user
.
getId
());
List
<
String
>
roleIds
=
new
ArrayList
<>();
for
(
UserRole
userRole
:
userRoles
)
{
roleIds
.
add
(
userRole
.
getRoleId
());
}
List
<
Role
>
roleList
=
roleDao
.
findAllByIdIn
(
roleIds
);
for
(
Role
role
:
roleList
)
{
List
<
RoleAuthority
>
roleAuthorities
=
roleAuthorityDao
.
findAllByRoleId
(
role
.
getId
());
List
<
String
>
authorityIds
=
new
ArrayList
<>();
for
(
RoleAuthority
roleAuthority
:
roleAuthorities
)
{
authorityIds
.
add
(
roleAuthority
.
getAuthorityId
());
}
List
<
Authority
>
authorities
=
authorityDao
.
findAllByIdIn
(
authorityIds
);
role
.
setAuthorities
(
authorities
);
}
user
.
setRoles
(
roleList
);
root
=
user
;
root
=
user
;
}
else
{
}
else
{
System
.
out
.
println
(
"77777777777777777"
);
System
.
out
.
println
(
"77777777777777777"
);
...
@@ -117,9 +133,11 @@ public class Init implements CommandLineRunner {
...
@@ -117,9 +133,11 @@ public class Init implements CommandLineRunner {
for
(
Authority
authority
:
authorities2
)
{
for
(
Authority
authority
:
authorities2
)
{
roleAuthorities
.
add
(
new
RoleAuthority
(
null
,
id
,
authority
.
getId
()));
roleAuthorities
.
add
(
new
RoleAuthority
(
null
,
id
,
authority
.
getId
()));
}
}
roleAuthorityDao
.
saveAll
(
roleAuthorities
);
User
save
=
pasUserDao
.
save
(
this
.
root
);
User
save
=
pasUserDao
.
save
(
this
.
root
);
UserRole
userRole
=
new
UserRole
(
null
,
save
.
getId
(),
id
);
UserRole
userRole
=
new
UserRole
(
null
,
save
.
getId
(),
id
);
userRoleDao
.
save
(
userRole
);
userRoleDao
.
save
(
userRole
);
this
.
root
.
setPassword
(
bCryptPasswordEncoder
.
encode
(
root
.
getPassword
()));
this
.
root
.
setPassword
(
bCryptPasswordEncoder
.
encode
(
root
.
getPassword
()));
}
}
...
...
notes-union/src/main/resources/application.properties
浏览文件 @
2483b44e
...
@@ -2,7 +2,7 @@ spring.application.name=workbook
...
@@ -2,7 +2,7 @@ spring.application.name=workbook
# https端口号.
#
#
https端口号.
server.port
=
8289
server.port
=
8289
# 证书的路径.
# 证书的路径.
server.ssl.key-store
=
classpath:2586377_workbook.zjtys.com.cn.pfx
server.ssl.key-store
=
classpath:2586377_workbook.zjtys.com.cn.pfx
...
@@ -14,7 +14,7 @@ server.ssl.keyStoreType=PKCS12
...
@@ -14,7 +14,7 @@ server.ssl.keyStoreType=PKCS12
server.ssl.keyAlias
=
alias
server.ssl.keyAlias
=
alias
#mongodb configuration
#mongodb configuration
spring.data.mongodb.uri
=
mongodb://localhost:27017/
test2
spring.data.mongodb.uri
=
mongodb://localhost:27017/
note
# servlet configuration
# servlet configuration
spring.servlet.multipart.max-file-size
=
100MB
spring.servlet.multipart.max-file-size
=
100MB
spring.servlet.multipart.max-request-size
=
1000MB
spring.servlet.multipart.max-request-size
=
1000MB
...
...
notes-weekly/src/main/java/com/zjty/tynotes/weekly/subject/service/impl/UserManageServiceImpl.java
浏览文件 @
2483b44e
...
@@ -236,8 +236,7 @@ public class UserManageServiceImpl implements UserManageService {
...
@@ -236,8 +236,7 @@ public class UserManageServiceImpl implements UserManageService {
@Override
@Override
public
boolean
updatePas
(
User
user
)
{
public
boolean
updatePas
(
User
user
)
{
String
encode
=
bCryptPasswordEncoder
.
encode
(
user
.
getPassword
());
user
.
setPassword
(
user
.
getPassword
());
user
.
setPassword
(
encode
);
pasUserDao
.
save
(
user
);
pasUserDao
.
save
(
user
);
return
true
;
return
true
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论