Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lzh_me
Sureness
提交
e521a02e
Sureness
项目概览
lzh_me
/
Sureness
与 Fork 源项目一致
Fork自
sureness / Sureness
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Sureness
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e521a02e
编写于
3月 20, 2020
作者:
sinat_25235033
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add tom postman json and fix bug
上级
f10a920c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
435 addition
and
3 deletion
+435
-3
sample-tom/sample-tom-postman.json
sample-tom/sample-tom-postman.json
+425
-0
sample-tom/src/main/java/com/usthe/sureness/sample/tom/dao/AuthUserDao.java
...n/java/com/usthe/sureness/sample/tom/dao/AuthUserDao.java
+1
-1
sample-tom/src/main/java/com/usthe/sureness/sample/tom/pojo/dto/Account.java
.../java/com/usthe/sureness/sample/tom/pojo/dto/Account.java
+5
-2
sample-tom/src/main/java/com/usthe/sureness/sample/tom/pojo/dto/Message.java
.../java/com/usthe/sureness/sample/tom/pojo/dto/Message.java
+4
-0
未找到文件。
sample-tom/sample-tom-postman.json
0 → 100644
浏览文件 @
e521a02e
{
"info"
:
{
"_postman_id"
:
"d8ee1dc8-1ea0-4068-8c34-4a4729c0565e"
,
"name"
:
"sureness-sample-tom"
,
"schema"
:
"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item"
:
[
{
"name"
:
"http://localhost:8081/auth/token - use admin account"
,
"request"
:
{
"method"
:
"POST"
,
"header"
:
[
{
"key"
:
"Content-Type"
,
"name"
:
"Content-Type"
,
"type"
:
"text"
,
"value"
:
"application/json"
}
],
"body"
:
{
"mode"
:
"raw"
,
"raw"
:
"{
\n\t\"
username
\"
:
\"
admin
\"
,
\n\t\"
password
\"
:
\"
admin
\"\n
}"
,
"options"
:
{
"raw"
:
{
"language"
:
"json"
}
}
},
"url"
:
{
"raw"
:
"http://localhost:8081/auth/token"
,
"protocol"
:
"http"
,
"host"
:
[
"localhost"
],
"port"
:
"8081"
,
"path"
:
[
"auth"
,
"token"
]
}
},
"response"
:
[]
},
{
"name"
:
"http://localhost:8081/auth/token - use user account"
,
"request"
:
{
"method"
:
"POST"
,
"header"
:
[
{
"key"
:
"Content-Type"
,
"name"
:
"Content-Type"
,
"type"
:
"text"
,
"value"
:
"application/json"
}
],
"body"
:
{
"mode"
:
"raw"
,
"raw"
:
"{
\n\t\"
username
\"
:
\"
user
\"
,
\n\t\"
password
\"
:
\"
user
\"\n
}"
,
"options"
:
{
"raw"
:
{
"language"
:
"json"
}
}
},
"url"
:
{
"raw"
:
"http://localhost:8081/auth/token"
,
"protocol"
:
"http"
,
"host"
:
[
"localhost"
],
"port"
:
"8081"
,
"path"
:
[
"auth"
,
"token"
]
}
},
"response"
:
[]
},
{
"name"
:
"http://localhost:8081/auth/token - use no noRole account"
,
"request"
:
{
"method"
:
"POST"
,
"header"
:
[
{
"key"
:
"Content-Type"
,
"name"
:
"Content-Type"
,
"type"
:
"text"
,
"value"
:
"application/json"
}
],
"body"
:
{
"mode"
:
"raw"
,
"raw"
:
"{
\n\t\"
username
\"
:
\"
noRole
\"
,
\n\t\"
password
\"
:
\"
noRole
\"\n
}"
,
"options"
:
{
"raw"
:
{
"language"
:
"json"
}
}
},
"url"
:
{
"raw"
:
"http://localhost:8081/auth/token"
,
"protocol"
:
"http"
,
"host"
:
[
"localhost"
],
"port"
:
"8081"
,
"path"
:
[
"auth"
,
"token"
]
}
},
"response"
:
[]
},
{
"name"
:
"http://localhost:8081/auth/token - use no guest account"
,
"request"
:
{
"method"
:
"POST"
,
"header"
:
[
{
"key"
:
"Content-Type"
,
"name"
:
"Content-Type"
,
"value"
:
"application/json"
,
"type"
:
"text"
}
],
"body"
:
{
"mode"
:
"raw"
,
"raw"
:
"{
\n\t\"
username
\"
:
\"
guest
\"
,
\n\t\"
password
\"
:
\"
guest
\"\n
}"
,
"options"
:
{
"raw"
:
{
"language"
:
"json"
}
}
},
"url"
:
{
"raw"
:
"http://localhost:8081/auth/token"
,
"protocol"
:
"http"
,
"host"
:
[
"localhost"
],
"port"
:
"8081"
,
"path"
:
[
"auth"
,
"token"
]
}
},
"response"
:
[]
},
{
"name"
:
"http://localhost:8081/role/1/2 - basic- use noRole"
,
"request"
:
{
"auth"
:
{
"type"
:
"basic"
,
"basic"
:
[
{
"key"
:
"password"
,
"value"
:
"noRole"
,
"type"
:
"string"
},
{
"key"
:
"username"
,
"value"
:
"noRole"
,
"type"
:
"string"
}
]
},
"method"
:
"GET"
,
"header"
:
[],
"url"
:
{
"raw"
:
"http://localhost:8081/role/1/2"
,
"protocol"
:
"http"
,
"host"
:
[
"localhost"
],
"port"
:
"8081"
,
"path"
:
[
"role"
,
"1"
,
"2"
]
}
},
"response"
:
[]
},
{
"name"
:
"http://localhost:8081/role/1/2 - baisc auth - use admin"
,
"request"
:
{
"auth"
:
{
"type"
:
"basic"
,
"basic"
:
[
{
"key"
:
"password"
,
"value"
:
"admin"
,
"type"
:
"string"
},
{
"key"
:
"username"
,
"value"
:
"admin"
,
"type"
:
"string"
}
]
},
"method"
:
"GET"
,
"header"
:
[],
"url"
:
{
"raw"
:
"http://localhost:8081/role/1/2"
,
"protocol"
:
"http"
,
"host"
:
[
"localhost"
],
"port"
:
"8081"
,
"path"
:
[
"role"
,
"1"
,
"2"
]
}
},
"response"
:
[]
},
{
"name"
:
"http://localhost:8081/role/1/2 - basic auth - use guest"
,
"request"
:
{
"auth"
:
{
"type"
:
"basic"
,
"basic"
:
[
{
"key"
:
"password"
,
"value"
:
"guest"
,
"type"
:
"string"
},
{
"key"
:
"username"
,
"value"
:
"guest"
,
"type"
:
"string"
}
]
},
"method"
:
"GET"
,
"header"
:
[],
"url"
:
{
"raw"
:
"http://localhost:8081/role/1/2"
,
"protocol"
:
"http"
,
"host"
:
[
"localhost"
],
"port"
:
"8081"
,
"path"
:
[
"role"
,
"1"
,
"2"
]
}
},
"response"
:
[]
},
{
"name"
:
"http://localhost:8081/role - basic auth - use guest"
,
"request"
:
{
"auth"
:
{
"type"
:
"basic"
,
"basic"
:
[
{
"key"
:
"password"
,
"value"
:
"guest"
,
"type"
:
"string"
},
{
"key"
:
"username"
,
"value"
:
"guest"
,
"type"
:
"string"
}
]
},
"method"
:
"POST"
,
"header"
:
[
{
"key"
:
"Content-Type"
,
"name"
:
"Content-Type"
,
"value"
:
"application/json"
,
"type"
:
"text"
}
],
"body"
:
{
"mode"
:
"raw"
,
"raw"
:
"{
\n\t\"
name
\"
:
\"
test_role
\"
,
\n\t\"
code
\"
:
\"
test_role
\"
,
\n\t\"
status
\"
: 1,
\n\t\"
description
\"
:
\"
this is test role add
\"\n
}"
,
"options"
:
{
"raw"
:
{
"language"
:
"json"
}
}
},
"url"
:
{
"raw"
:
"http://localhost:8081/role"
,
"protocol"
:
"http"
,
"host"
:
[
"localhost"
],
"port"
:
"8081"
,
"path"
:
[
"role"
]
}
},
"response"
:
[]
},
{
"name"
:
"http://localhost:8081/role - basic auth - use user"
,
"request"
:
{
"auth"
:
{
"type"
:
"basic"
,
"basic"
:
[
{
"key"
:
"password"
,
"value"
:
"user"
,
"type"
:
"string"
},
{
"key"
:
"username"
,
"value"
:
"user"
,
"type"
:
"string"
}
]
},
"method"
:
"POST"
,
"header"
:
[
{
"key"
:
"Content-Type"
,
"name"
:
"Content-Type"
,
"value"
:
"application/json"
,
"type"
:
"text"
}
],
"body"
:
{
"mode"
:
"raw"
,
"raw"
:
"{
\n\t\"
name
\"
:
\"
test_role
\"
,
\n\t\"
code
\"
:
\"
test_role
\"
,
\n\t\"
status
\"
: 1,
\n\t\"
description
\"
:
\"
this is test role add
\"\n
}"
,
"options"
:
{
"raw"
:
{
"language"
:
"json"
}
}
},
"url"
:
{
"raw"
:
"http://localhost:8081/role"
,
"protocol"
:
"http"
,
"host"
:
[
"localhost"
],
"port"
:
"8081"
,
"path"
:
[
"role"
]
}
},
"response"
:
[]
},
{
"name"
:
"http://localhost:8081/role/1/2 - jwt auth"
,
"request"
:
{
"auth"
:
{
"type"
:
"bearer"
,
"bearer"
:
[
{
"key"
:
"token"
,
"value"
:
"eyJhbGciOiJIUzUxMiIsInppcCI6IkRFRiJ9.eNocjEEOwiAQRe8y65IwCBQ4hlvjotAhVqs1DBoT492l7F5e_vtfuNYFAliUPs3aCrIuCW1nFDHlUaBVqJOLJpkIA_ArtnHd7o0X5s43egim8qayy6lCQOOUd15JHIA-zy4OUo5dlG2lFp46KDjvR0fKhfgCIU8r0-8PAAD__w.f-3klWWDpEO3uDLlx2S53DV2cYernwVEDwcC6z1JexocbZoxRKmASTOuky1qMCxy_hV8-RbuMjDmI3ASa_FQOw"
,
"type"
:
"string"
}
]
},
"method"
:
"GET"
,
"header"
:
[],
"url"
:
{
"raw"
:
"http://localhost:8081/role/1/2"
,
"protocol"
:
"http"
,
"host"
:
[
"localhost"
],
"port"
:
"8081"
,
"path"
:
[
"role"
,
"1"
,
"2"
]
}
},
"response"
:
[]
},
{
"name"
:
"http://localhost:8081/role/1/2 - custom auth"
,
"request"
:
{
"method"
:
"GET"
,
"header"
:
[
{
"key"
:
"username"
,
"value"
:
"admin"
,
"type"
:
"text"
},
{
"key"
:
"password"
,
"value"
:
"admin"
,
"type"
:
"text"
}
],
"url"
:
{
"raw"
:
"http://localhost:8081/role/1/2"
,
"protocol"
:
"http"
,
"host"
:
[
"localhost"
],
"port"
:
"8081"
,
"path"
:
[
"role"
,
"1"
,
"2"
]
}
},
"response"
:
[]
}
],
"protocolProfileBehavior"
:
{}
}
\ No newline at end of file
sample-tom/src/main/java/com/usthe/sureness/sample/tom/dao/AuthUserDao.java
浏览文件 @
e521a02e
...
...
@@ -27,7 +27,7 @@ public interface AuthUserDao extends JpaRepository<AuthUserDO, Long> {
* @param username 账户名称
* @return 角色list
*/
@Query
(
"select ar.
nam
e from AuthRoleDO ar, AuthUserDO au, AuthUserRoleBindDO bind "
+
@Query
(
"select ar.
cod
e from AuthRoleDO ar, AuthUserDO au, AuthUserRoleBindDO bind "
+
"where ar.id = bind.roleId and au.id = bind.userId and au.username = :username"
)
List
<
String
>
findAccountOwnRoles
(
@Param
(
"username"
)
String
username
);
}
sample-tom/src/main/java/com/usthe/sureness/sample/tom/pojo/dto/Account.java
浏览文件 @
e521a02e
package
com.usthe.sureness.sample.tom.pojo.dto
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotBlank
;
...
...
@@ -13,6 +15,8 @@ import javax.validation.constraints.Pattern;
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public
class
Account
{
@NotBlank
(
message
=
"username can not null"
)
...
...
@@ -20,8 +24,7 @@ public class Account {
private
String
username
;
@NotBlank
(
message
=
"password can not null"
)
@Length
(
min
=
6
,
max
=
12
,
message
=
"password length in 6-12"
)
@Pattern
(
regexp
=
"[a-zA-Z0-9]*"
,
message
=
"password must has [a-zA-Z0-9]"
)
@Length
(
min
=
3
,
max
=
100
,
message
=
"password length in 3-100"
)
private
String
password
;
}
sample-tom/src/main/java/com/usthe/sureness/sample/tom/pojo/dto/Message.java
浏览文件 @
e521a02e
package
com.usthe.sureness.sample.tom.pojo.dto
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* 前后端http api统一消息定义协议 Message
...
...
@@ -15,6 +17,8 @@ import lombok.Data;
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public
class
Message
{
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录