1
0
mirror of https://github.com/httpie/cli.git synced 2025-12-01 23:03:25 +02:00

Extend auth plugin API

This extends the `AuthPlugin` API by the following attributes:

* `auth_require`: set to `False` to make `--auth, -a` optional
* `auth_parse`: set to `False` to disable `username:password` parsing
  (access the raw value passed to `-a` via `self.raw_auth`).
* `prompt_password`: set to`False` to disable password prompt when
   no password provided (only relevant when `auth_parse == True`)

 These changes should be 100% backwards-compatible.

 What needs more testing is auth support in sessions.

Close #433
Close #431
Close #378
Ping teracyhq/httpie-jwt-auth#3
This commit is contained in:
Jakub Roztocil
2016-11-23 22:01:58 +01:00
parent b879d38b07
commit a49774d3ab
10 changed files with 226 additions and 50 deletions

View File

@@ -145,11 +145,6 @@ def get_requests_kwargs(args, base_headers=None):
headers.update(args.headers)
headers = finalize_headers(headers)
credentials = None
if args.auth:
auth_plugin = plugin_manager.get_auth_plugin(args.auth_type)()
credentials = auth_plugin.get_auth(args.auth.key, args.auth.value)
cert = None
if args.cert:
cert = args.cert
@@ -168,7 +163,7 @@ def get_requests_kwargs(args, base_headers=None):
}.get(args.verify, args.verify),
'cert': cert,
'timeout': args.timeout,
'auth': credentials,
'auth': args.auth,
'proxies': dict((p.key, p.value) for p in args.proxy),
'files': args.files,
'allow_redirects': args.follow,