Skip to content

Commit 9908223

Browse files
authored
Merge pull request #195 from Julien-cpsn/digest-auth
Added digest auth
2 parents b4a3b88 + aa51459 commit 9908223

File tree

31 files changed

+2056
-207
lines changed

31 files changed

+2056
-207
lines changed

Cargo.lock

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ crokey = "=1.1.2"
4444
tui-big-text = "=0.7.3"
4545
## Display tree-like lists. Used for displaying the collections.
4646
tui-tree-widget = "=0.23.1"
47+
## Display scrollable panels
48+
tui-scrollview = "0.5.3"
4749
## Text area that handle a lot of features. Used for editing request body.
4850
tui-textarea = { version = "=0.7.0", features = ["ratatui"] }
4951
## Display loading UI elements. Used when request is pending.
@@ -81,6 +83,8 @@ directories = "=6.0.0"
8183
arboard = { version = "=3.6.1", features = ["wayland-data-control"], optional = true }
8284
## Create and encode JSON Web Tokens (JWT)
8385
jsonwebtoken = { version = "10.2.0", features = ["rust_crypto"] }
86+
## Digest auth
87+
digest_auth = "0.3.1"
8488

8589
# Async
8690
## Handle asynchronous requests

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@ cargo run -- -h
178178
| Authentication | Partial | :white_check_mark: | :white_check_mark: |
179179
| - Basic auth | :white_check_mark: | :white_check_mark: | :white_check_mark: |
180180
| - Bearer token | :white_check_mark: | :white_check_mark: | :white_check_mark: |
181+
| - Digest | :white_check_mark: | :white_check_mark: | :white_check_mark: |
181182
| - JWT | :white_check_mark: | :white_check_mark: | :white_check_mark: |
182-
| - Digest, OAuth1-2, AWS | :x: :soon: | :white_check_mark: | :white_check_mark: |
183+
| - OAuth1-2, AWS | :x: :soon: | :white_check_mark: | :white_check_mark: |
183184
| Headers | :white_check_mark: | :white_check_mark: | :white_check_mark: |
184185
| Body | :white_check_mark: | :white_check_mark: | :white_check_mark: |
185186
| - Multipart form | :white_check_mark: | :white_check_mark: | :white_check_mark: |
@@ -331,6 +332,7 @@ You can read more about it here: https://github.com/Julien-cpsn/ATAC/releases/ta
331332
| [directories](https://github.com/soc/directories-rs) | 6.0.0 | Use system files |
332333
| [arboard](https://github.com/1Password/arboard) | 3.6.1 | Copy response body to clipboard |
333334
| [jsonwebtoken](https://github.com/Keats/jsonwebtoken) | 10.2.0 | Create and encode JSON Web Tokens (JWT) |
335+
| [digest_auth](https://git.ondrovo.com/packages/digest_auth_rs) | 0.3.1 | Decode www-authenticate header and format digest auth authorization |
334336
| **Async** | | |
335337
| [tokio](https://github.com/tokio-rs/tokio) | 1.48.0 | Handle asynchronous requests |
336338
| [parking_lot](https://github.com/Amanieu/parking_lot) | 0.12.5 | Smaller, faster and more flexible implementation of RwLock and Mutex. Used everywhere. |

example_resources/collections/auth.json

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,81 @@
268268
"method": "GET",
269269
"body": "no_body"
270270
}
271+
},
272+
{
273+
"name": "Test Digest auth",
274+
"url": "https://httpbin.org/digest-auth/auth/user/1234/SHA-256",
275+
"params": [],
276+
"headers": [
277+
{
278+
"enabled": true,
279+
"data": [
280+
"cache-control",
281+
"no-cache"
282+
]
283+
},
284+
{
285+
"enabled": true,
286+
"data": [
287+
"user-agent",
288+
"ATAC/v0.22.1"
289+
]
290+
},
291+
{
292+
"enabled": true,
293+
"data": [
294+
"accept",
295+
"*/*"
296+
]
297+
},
298+
{
299+
"enabled": true,
300+
"data": [
301+
"accept-encoding",
302+
"gzip, deflate, br"
303+
]
304+
},
305+
{
306+
"enabled": true,
307+
"data": [
308+
"connection",
309+
"keep-alive"
310+
]
311+
}
312+
],
313+
"auth": {
314+
"digest": {
315+
"username": "",
316+
"password": "",
317+
"domains": "",
318+
"realm": "",
319+
"nonce": "",
320+
"opaque": "",
321+
"stale": false,
322+
"algorithm": "MD5",
323+
"qop": "None",
324+
"user_hash": false,
325+
"charset": "ASCII"
326+
}
327+
},
328+
"scripts": {
329+
"pre_request_script": null,
330+
"post_request_script": null
331+
},
332+
"settings": {
333+
"use_config_proxy": true,
334+
"allow_redirects": true,
335+
"timeout": 30000,
336+
"store_received_cookies": true,
337+
"pretty_print_response_content": true,
338+
"accept_invalid_certs": false,
339+
"accept_invalid_hostnames": false
340+
},
341+
"protocol": {
342+
"type": "http",
343+
"method": "GET",
344+
"body": "no_body"
345+
}
271346
}
272347
]
273348
}

src/app/app.rs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,28 +88,52 @@ pub struct App<'a> {
8888

8989
pub url_text_input: TextInput,
9090

91+
/* Query params */
92+
9193
pub query_params_table: StatefulCustomTable,
9294

95+
/* Auth */
96+
9397
pub auth_text_input_selection: TextInputSelection,
98+
9499
pub auth_basic_username_text_input: TextInput,
95100
pub auth_basic_password_text_input: TextInput,
101+
96102
pub auth_bearer_token_text_input: TextInput,
103+
97104
pub auth_jwt_secret_text_input: TextInput,
98105
pub auth_jwt_payload_text_area: TextArea<'a>,
99106
pub auth_jwt_payload_text_area_vim_emulation: Vim,
100107

108+
pub auth_digest_username_text_input: TextInput,
109+
pub auth_digest_password_text_input: TextInput,
110+
pub auth_digest_domains_text_input: TextInput,
111+
pub auth_digest_realm_text_input: TextInput,
112+
pub auth_digest_nonce_text_input: TextInput,
113+
pub auth_digest_opaque_text_input: TextInput,
114+
115+
/* Headers */
116+
101117
pub headers_table: StatefulCustomTable,
102118

119+
/* Body */
120+
103121
pub body_file_text_input: TextInput,
104122
pub body_form_table: StatefulCustomTable,
105123
pub body_text_area: TextArea<'a>,
106124
pub body_text_area_vim_emulation: Vim,
107125

126+
/* WS message */
127+
108128
pub message_text_area: TextArea<'a>,
109129
pub message_text_area_vim_emulation: Vim,
110130

131+
/* Settings */
132+
111133
pub request_settings_popup: SettingsPopup,
112134

135+
/* Response */
136+
113137
pub received_response: Arc<Mutex<bool>>,
114138

115139
pub result_throbber_state: ThrobberState,
@@ -118,6 +142,8 @@ pub struct App<'a> {
118142

119143
pub last_messages_area_size: (u16, u16),
120144

145+
/* Scripts */
146+
121147
pub script_console: ScriptConsole<'a>,
122148

123149
/* Others */
@@ -189,28 +215,52 @@ impl App<'_> {
189215

190216
url_text_input: TextInput::default(),
191217

218+
/* Query params */
219+
192220
query_params_table: StatefulCustomTable::default(),
193221

222+
/* Auth */
223+
194224
auth_text_input_selection: TextInputSelection::default(),
225+
195226
auth_basic_username_text_input: TextInput::default(),
196227
auth_basic_password_text_input: TextInput::default(),
228+
197229
auth_bearer_token_text_input: TextInput::default(),
230+
198231
auth_jwt_secret_text_input: TextInput::default(),
199232
auth_jwt_payload_text_area: TextArea::default(),
200233
auth_jwt_payload_text_area_vim_emulation: Vim::default(),
201234

235+
auth_digest_username_text_input: TextInput::default(),
236+
auth_digest_password_text_input: TextInput::default(),
237+
auth_digest_domains_text_input: TextInput::default(),
238+
auth_digest_realm_text_input: TextInput::default(),
239+
auth_digest_nonce_text_input: TextInput::default(),
240+
auth_digest_opaque_text_input: TextInput::default(),
241+
242+
/* Headers */
243+
202244
headers_table: StatefulCustomTable::default(),
203245

246+
/* Body */
247+
204248
body_file_text_input: TextInput::default(),
205249
body_form_table: StatefulCustomTable::default(),
206250
body_text_area: TextArea::default(),
207251
body_text_area_vim_emulation: Vim::default(),
208252

253+
/* WS message */
254+
209255
message_text_area: TextArea::default(),
210256
message_text_area_vim_emulation: Vim::default(),
211257

258+
/* Settings */
259+
212260
request_settings_popup: SettingsPopup::default(),
213261

262+
/* Response */
263+
214264
result_throbber_state: ThrobberState::default(),
215265
received_response: Arc::new(Mutex::new(false)),
216266
result_vertical_scrollbar: StatefulScrollbar::default(),

src/app/business_logic/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
pub mod request;
22
pub mod collection;
33
pub mod environment;
4-
pub mod key_value;
4+
pub mod key_value;
5+
mod utils;

0 commit comments

Comments
 (0)