提交 e521a02e 编写于 作者: sinat_25235033's avatar sinat_25235033

add tom postman json and fix bug

上级 f10a920c
{
"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
......@@ -27,7 +27,7 @@ public interface AuthUserDao extends JpaRepository<AuthUserDO, Long> {
* @param username 账户名称
* @return 角色list
*/
@Query("select ar.name from AuthRoleDO ar, AuthUserDO au, AuthUserRoleBindDO bind " +
@Query("select ar.code 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);
}
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;
}
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.
先完成此消息的编辑!
想要评论请 注册