Library of common utils for interacting with Identity-Aware Proxies
Project description
IAP Toolkit
A library of utils to ease programmatic authentication with Google IAP (and ideally other IAPs in future).
PyPi
https://pypi.org/project/iaptoolkit/
Installation
With Poetry:
poetry add iaptoolkit
With pip:
pip install iaptoolkit
Quick Start / Example Usage
import requests
from iaptoolkit import IAPToolkit
iaptk = IAPToolkit(google_iap_client_id="EXAMPLE_ID_123456789ABCDEF")
allowed_domains = ["example.com", ]
# Example #1 - Combined Calls
def example1(url: str):
headers = dict()
result = iaptk.check_url_and_add_token_header(
url=url,
request_headers=headers,
valid_domains=allowed_domains
)
# result.token_added (bool) indicates if the token was added, depending on whether or not URL was valid
# headers dict now contains the appropriate Bearer Token header for Google IAP
# Make HTTP GET request with requests lib, with our headers containing bearer token to auth with IAP
response = requests.request("GET", url, headers=headers)
# Example #2 - Separate Calls - Functionally the same as Example 1 but more flexibility in URL validation
def example1(url: str):
is_url_safe: bool = iaptk.is_url_safe_for_token(url=url, valid_domains=valid_domains)
if not is_url_safe:
raise ExampleBadURLException("This URL isn't safe to send token headers to!")
headers = dict()
token_is_fresh: bool = iaptk.get_token_and_add_to_headers(request_headers=headers)
# token_is_fresh indicates if token was newly retrieved (True), or if a cached token was reused (False)
# headers dict now contains the appropriate Bearer Token header for Google IAP
# Make HTTP GET request with requests lib, with our headers containing bearer token to auth with IAP
response = requests.request("GET", url, headers=headers)
Disclaimer
This project is not affiliated with Google. No trademark infringement intended.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iaptoolkit-0.3.11.tar.gz.
File metadata
- Download URL: iaptoolkit-0.3.11.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfe342338cc7c1f3165b2b174f8ef9a86ecec306274cf3d8bbd4a259a66895d1
|
|
| MD5 |
6f741b4abf8c71897f0455424966c537
|
|
| BLAKE2b-256 |
d00b0d62b5c65c40fc8626d6b9928bc2f772d08b300463a91abb360ecc589379
|
Provenance
The following attestation bundles were made for iaptoolkit-0.3.11.tar.gz:
Publisher:
publish.yml on RAVoigt/iaptoolkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iaptoolkit-0.3.11.tar.gz -
Subject digest:
bfe342338cc7c1f3165b2b174f8ef9a86ecec306274cf3d8bbd4a259a66895d1 - Sigstore transparency entry: 831360035
- Sigstore integration time:
-
Permalink:
RAVoigt/iaptoolkit@2c13e0706d078651f79f21b8767fed68ce68745c -
Branch / Tag:
refs/tags/0.3.11 - Owner: https://github.com/RAVoigt
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2c13e0706d078651f79f21b8767fed68ce68745c -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file iaptoolkit-0.3.11-py3-none-any.whl.
File metadata
- Download URL: iaptoolkit-0.3.11-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57f3e119c61cb240d26a6d89e7fe896e5be0c5e55fb36daec6421eda2e78113e
|
|
| MD5 |
5628db9d20bd9bc196097827d2c0f6d3
|
|
| BLAKE2b-256 |
f558889aa78b22874364f843ab9715668738cfc69c72f6c5d40616ec37a1053c
|
Provenance
The following attestation bundles were made for iaptoolkit-0.3.11-py3-none-any.whl:
Publisher:
publish.yml on RAVoigt/iaptoolkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iaptoolkit-0.3.11-py3-none-any.whl -
Subject digest:
57f3e119c61cb240d26a6d89e7fe896e5be0c5e55fb36daec6421eda2e78113e - Sigstore transparency entry: 831360044
- Sigstore integration time:
-
Permalink:
RAVoigt/iaptoolkit@2c13e0706d078651f79f21b8767fed68ce68745c -
Branch / Tag:
refs/tags/0.3.11 - Owner: https://github.com/RAVoigt
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2c13e0706d078651f79f21b8767fed68ce68745c -
Trigger Event:
workflow_dispatch
-
Statement type: