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