Commit 8213843
Initial pbench user authentication model implementation (distributed-system-analysis#1937)
This implements 5 basic user APIs
1. Register User
Handles Pbench User registration via JSON request
POST /v1/register
2. Login User:
POST /v1/login
Returns a valid pbench auth token
User is allowed to issue multiple login requests and thus generating multiple auth tokens,
Each token is stored in a active_tokens table and has its own expiry
User is authenticated for subsequest API calls if token not expired and present in the active_tokens table
3. Logout user:
POST /v1/logout
Deletes the auth_token from the active_tokens table.
Once logged out user can not use the same auth token for other API access.
4. Get User:
GET /v1/user/<string:username>
Returns the user's self information that was registered, the username must be provided in the url
If the Auth header does not belong to the username, reject the request unless auth token belongs to the admin
5. Delete User:
DELETE /v1/user/<string:username>"
An API for a user to delete himself from the pbench database.
A user can only perform delete action on himself unless the auth token belongs to the admin user.
6. Updare User:
PUT /v1/user/<string:username>
An API for updating the User registration fields, the username must be provided in the url
Update is not allowed on registerd_on field1 parent ad09077 commit 8213843
File tree
16 files changed
+1575
-8
lines changed- lib/pbench
- server
- api
- resources
- database
- alembic
- models
- test/unit/server
- server
- lib/config
16 files changed
+1575
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
20 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
21 | 31 | | |
22 | 32 | | |
23 | 33 | | |
24 | 34 | | |
25 | 35 | | |
26 | 36 | | |
27 | 37 | | |
28 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
29 | 45 | | |
30 | 46 | | |
31 | 47 | | |
32 | 48 | | |
33 | | - | |
| 49 | + | |
34 | 50 | | |
35 | 51 | | |
36 | | - | |
| 52 | + | |
37 | 53 | | |
38 | 54 | | |
39 | 55 | | |
40 | 56 | | |
41 | | - | |
| 57 | + | |
42 | 58 | | |
43 | 59 | | |
44 | | - | |
| 60 | + | |
45 | 61 | | |
46 | 62 | | |
47 | 63 | | |
48 | 64 | | |
49 | | - | |
| 65 | + | |
50 | 66 | | |
51 | 67 | | |
52 | 68 | | |
53 | 69 | | |
54 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
55 | 86 | | |
56 | 87 | | |
57 | 88 | | |
| |||
74 | 105 | | |
75 | 106 | | |
76 | 107 | | |
77 | | - | |
78 | 108 | | |
79 | 109 | | |
80 | 110 | | |
81 | 111 | | |
82 | 112 | | |
83 | 113 | | |
84 | 114 | | |
| 115 | + | |
| 116 | + | |
85 | 117 | | |
86 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
87 | 129 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
0 commit comments