Metadata-Version: 2.4
Name: httpie-asap-auth
Version: 0.4.2
Summary: ASAP Auth plugin for HTTPie.
Author-email: Jason Friedland <jason@friedland.id.au>
License: MIT License
        
        Copyright (c) 2017 Jason Friedland
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/jasonfriedland/httpie-asap-auth
Project-URL: Download, https://github.com/jasonfriedland/httpie-asap-auth
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Environment :: Plugins
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: atlassian-jwt-auth>=10.1.0
Requires-Dist: httpie>=3.1.0
Dynamic: license-file

# httpie-asap-auth

[![PyPi Package](https://img.shields.io/pypi/v/httpie-asap-auth.svg)](https://pypi.python.org/pypi/httpie-asap-auth)
[![PyPi Versions](https://pypi-camo.freetls.fastly.net/73d938bb8ffa2fa754351c502e49417e987e6a2e/68747470733a2f2f696d672e736869656c64732e696f2f707970692f707976657273696f6e732f6874747069652d617361702d617574682e737667)](https://pypi.python.org/pypi/httpie-asap-auth)
[![Actions Status](https://github.com/jasonfriedland/httpie-asap-auth/workflows/test/badge.svg)](https://github.com/jasonfriedland/httpie-asap-auth/actions)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)

[ASAP](https://s2sauth.bitbucket.io/) Auth plugin for [HTTPie](https://httpie.org/).

## Installation

Python 3.8 through Python 3.15 are supported.

    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:

    ```json
    {
        "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)

## Development

[Install uv](https://docs.astral.sh/uv/getting-started/installation/), then create
the development environment from the committed lockfile:

    make sync

Run the test suite and formatter with the locked dependencies:

    make test
    make fmt

The formatter runs on Python 3.14 while preserving Python 3.8-compatible
syntax.

Upgrade all dependencies and review the resulting lockfile with:

    make upgrade

Build the source and wheel distributions with:

    make build

Maintainers can publish the built distributions after configuring uv's PyPI
credentials:

    make publish
