Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

httpie-asap-auth

PyPi Package PyPi Versions Build Status Coverage Status Code style: black

ASAP Auth plugin for HTTPie.

Installation

pip install httpie-asap-auth

You should now see asap and asapenv under --auth-type in the $ http --help output.

Usage

http --auth-type=asap --auth=path/to/asap.config http://example.com/

OR, to read from environment variables:

http --auth-type=asapenv --auth=audience[:subject] http://example.com/

Separate multiple audiences with a comma.

Example ASAP Config

Store your ASAP config in a file following this format:

{
    "issuer": "webapp/admin",
    "kid": "webapp/admin/dev.pem",
    "audience": [
        "webapp"
    ],
    "sub": "administration",
    "privateKey": "-----BEGIN RSA PRIVATE KEY-----\n ... \n-----END RSA PRIVATE KEY-----"
}

NB. the subject (sub field) is optional.

Example Environment Variables

ASAP_PRIVATE_KEY=data:application/pkcs8;kid=webapp;base64,...
ASAP_ISSUER=webapp/admin

Generate a Data URI

Generate a data URI, with the key in PKCS8 from an RSA private key PEM file:

#!/bin/sh

# Usage: $0 privatekey.pem

KID=$(echo "$1" | sed 's|/|%2F|g')
KEY=$(openssl pkcs8 -topk8 -inform PEM -outform DER -in "$1" -nocrypt | base64 | tr '\n' ' ' | sed 's| ||g')

echo "data:application/pkcs8;kid=$KID;base64,$KEY"

(thanks to Brian McKenna)

About

ASAP Auth plugin for HTTPie.

Topics

Resources

License

Releases

No releases published

Packages

No packages published