Python module for interacting with Microsoft ADFS and OIDC at ease
Project description
python-adfs
Python module for interacting with Microsoft ADFS and OIDC for authentication and authorization, simplified, type-safe and production-ready.
Installation
Install the module using pip
pip install pyadfs
See pyproject.toml for more information and changelog.md for updates.
Usage
It is recommended that you read the microsoft docs for foundational knowledge on ADFS authentication.
See microsoft docs and OWASP regarding ADFS best practices.
all methods have matching async functions and classes for use in async environments.
from pyadfs import ADFSClient, TokenModel, generate_token
raw_token = generate_token(
grant_type="password",
username="didi45R@example.local",
password="top-secret",
)
client = ADFSClient() # Use env variables or pass vars directly at init (see config.py)
token_model = client.validate_token(raw_token.access_token)
upn = token_model.user_principle_name
email = token_model.email_address
print(f"{upn}'s token expires at: {token_model.exp_readable_timestamp}")
Useful links
- jwt.io (jwt playground)
- JWT RFC7519
- microsoft example openid-configuration
Created by Yedidya.R
Copyright © Yedidya Rosenstark. All rights reserved.
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 python_adfs-1.0.0.tar.gz.
File metadata
- Download URL: python_adfs-1.0.0.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e15a7e32aaece381dfb26397071200016afbc95c642588ee4a7ed774f7a076f
|
|
| MD5 |
39e1a3b849a1dc3ffdae0811dda377ac
|
|
| BLAKE2b-256 |
74a100e432c19c5cc60ce15557392f4cafd53be883bd3b9a837aec048171fbde
|
File details
Details for the file python_adfs-1.0.0-py3-none-any.whl.
File metadata
- Download URL: python_adfs-1.0.0-py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e562be4273f83d6d5221e1ac609da42853e615c587232258a937947ca8002e5
|
|
| MD5 |
5514df2a21ffae7d9ff5d5e2f769ab67
|
|
| BLAKE2b-256 |
544e9eed162578c077aeff9e9c396ddb07f4bbba4e076c609a06d0a06f1abc47
|