| 1 |
Metadata-Version: 2.1 |
| 2 |
Name: httpie-aws-authv4 |
| 3 |
Version: 0.3.0 |
| 4 |
Summary: AWS auth v4 plugin for HTTPie. |
| 5 |
Home-page: https://github.com/aidan-/httpie-aws-authv4 |
| 6 |
Download-URL: https://github.com/aidan-/httpie-aws-authv4 |
| 7 |
Author: Aidan Rowe |
| 8 |
Author-email: [email protected] |
| 9 |
License: MIT |
| 10 |
Platform: UNKNOWN |
| 11 |
Classifier: Development Status :: 5 - Production/Stable |
| 12 |
Classifier: Programming Language :: Python |
| 13 |
Classifier: Programming Language :: Python :: 3 |
| 14 |
Classifier: Programming Language :: Python :: 3.4 |
| 15 |
Classifier: Programming Language :: Python :: 3.5 |
| 16 |
Classifier: Programming Language :: Python :: 3.6 |
| 17 |
Classifier: Programming Language :: Python :: 3.7 |
| 18 |
Classifier: Environment :: Plugins |
| 19 |
Classifier: License :: OSI Approved :: BSD License |
| 20 |
Classifier: Topic :: Internet :: WWW/HTTP |
| 21 |
Classifier: Topic :: Utilities |
| 22 |
Description-Content-Type: text/markdown |
| 23 |
License-File: LICENSE.md |
| 24 |
|
| 25 |
# httpie-aws-authv4 |
| 26 |
AWS / Amazon Signature v4 Signing Process authentication plugin for [HTTPie](https://httpie.org/). |
| 27 |
|
| 28 |
## Installation |
| 29 |
|
| 30 |
``` |
| 31 |
$ pip install --upgrade httpie-aws-authv4 |
| 32 |
``` |
| 33 |
|
| 34 |
You should now see `aws4` under `--auth-type / -A` in `$ http --help` output. |
| 35 |
|
| 36 |
## Simple Usage |
| 37 |
|
| 38 |
### Credentials in default profile/environment variables/instance profile |
| 39 |
This authentication plugin looks for credentials in the same [precedence that the AWS CLI tool](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#config-settings-and-precedence) does. |
| 40 |
|
| 41 |
``` |
| 42 |
$ http --auth-type aws4 https://asdf123a9sas.execute-api.ap-southeast-2.amazonaws.com/dev/test |
| 43 |
``` |
| 44 |
|
| 45 |
### Extra arguments |
| 46 |
Using the `--auth` parameter, you can specify explicit parameters to be used in the calculation of the Sigv4 signature. |
| 47 |
|
| 48 |
``` |
| 49 |
$ http --auth-type aws4 --auth access_key=AWSACCESSKEYXXX,secret_key=AWSSECRETKEYXXX,service=execute-api,region=ap-southeast-2 https://asdf123a9sas.execute-api.ap-southeast-2.amazonaws.com/dev/test |
| 50 |
``` |
| 51 |
|
| 52 |
#### Auth options |
| 53 |
The following arguments are supported via the `--auth` flag. They can be referenced via their full or short name for convenience. |
| 54 |
|
| 55 |
* access_key (ak) - AWS Access Key. |
| 56 |
* secret_key (sk) - AWS Secret Key. |
| 57 |
* profile (p) - AWS profile to use. |
| 58 |
* domain (d) - Domain name to use when signing the request. |
| 59 |
* service (s) - AWS service name to use when signing the request (ie, `execute-api`). |
| 60 |
* region (r) - AWS region the endpoint is located in. |
| 61 |
|
| 62 |
#### Specify credentials profile on the CLI |
| 63 |
You can specify another profile than the default profile: |
| 64 |
|
| 65 |
``` |
| 66 |
$ http --auth-type aws4 --auth profile=XXX https://asdf123a9sas.execute-api.ap-southeast-2.amazonaws.com/dev/test |
| 67 |
``` |
| 68 |
|
| 69 |
### Specify service and region |
| 70 |
If for some reason you are not hitting the AWS endpoint directly (common with API Gateway), you will need to specify the AWS provided service and region: |
| 71 |
|
| 72 |
``` |
| 73 |
$ http --auth-type aws4 --auth s=execute-api,r=eu-west-1 https://api.awesomeservice.net/dev/test |
| 74 |
$ http --auth-type aws4 --auth service=execute-api,region=eu-west-1 https://api.awesomeservice.net/dev/test |
| 75 |
``` |
| 76 |
### Specify endpoint |
| 77 |
Instead of specifying service and region you can specify domain which is then parsed. |
| 78 |
|
| 79 |
``` |
| 80 |
$ http --auth-type aws4 --auth d=asdf123a9sas.execute-api.ap-southeast-2.amazonaws.com https://api.awesomeservice.net/dev/test |
| 81 |
$ http --auth-type aws4 --auth domain=asdf123a9sas.execute-api.ap-southeast-2.amazonaws.com https://api.awesomeservice.net/dev/test |
| 82 |
``` |
| 83 |
### Specify credentials and endpoint |
| 84 |
|
| 85 |
``` |
| 86 |
$ http --auth-type aws4 --auth ak=ACCESSKEYXXX,sk=AWSSECRETKEYXXX,d=asdf123a9sas.execute-api.ap-southeast-2.amazonaws.com https://api.awesomeservice.net/dev/test |
| 87 |
$ http --auth-type aws4 --auth access_key=ACCESSKEYXXX,secret_key=AWSSECRETKEYXXX,domain=asdf123a9sas.execute-api.ap-southeast-2.amazonaws.com https://api.awesomeservice.net/dev/test |
| 88 |
``` |
| 89 |
|
| 90 |
### Specify credentials profile and endpoint |
| 91 |
|
| 92 |
``` |
| 93 |
$ http --auth-type aws4 --auth p=XXX,d=asdf123a9sas.execute-api.ap-southeast-2.amazonaws.com https://api.awesomeservice.net/dev/test |
| 94 |
$ http --auth-type aws4 --auth profile=XXX,domain=asdf123a9sas.execute-api.ap-southeast-2.amazonaws.com https://api.awesomeservice.net/dev/test |
| 95 |
``` |
| 96 |
|
| 97 |
### Calling AWS services that require extra information |
| 98 |
|
| 99 |
Many AWS services do not require any extra information to be passed other than the URL, such as the following call to the |
| 100 |
S3 service which will list all S3 Buckets in the given AWS account: |
| 101 |
|
| 102 |
``` |
| 103 |
http -A aws4 s3.us-east-1.amazonaws.com |
| 104 |
``` |
| 105 |
|
| 106 |
However, some AWS services will require extra information to be passed using query string parameters. By default, ``httpie`` passes |
| 107 |
extra parameters as a JSON body. ``httpie`` can be told to pass extra parameters as form fields using the ``-f`` flag like so: |
| 108 |
|
| 109 |
``` |
| 110 |
$ http -f -A aws4 ec2.us-east-1.amazonaws.com Action=DescribeVpcs Version=2015-10-01 |
| 111 |
``` |
| 112 |
|
| 113 |
where the *Action* and *Version* parameters were passed to the EC2 service to call the **DescribeVpcs** API. |
| 114 |
|
| 115 |
Alternatively instead of using the ``-f`` flag, ``==`` can be used for each parameter like so: |
| 116 |
|
| 117 |
``` |
| 118 |
$ http -A aws4 ec2.us-east-1.amazonaws.com Action==DescribeVpcs Version==2015-10-01 |
| 119 |
``` |
| 120 |
|
| 121 |
## Credits |
| 122 |
|
| 123 |
All of the heavy lifting (the signing process) is handled by [aws-requests-auth](https://github.com/DavidMuller/aws-requests-auth) |
| 124 |
|
| 125 |
|