Skip to main content

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


Created by Yedidya.R
Copyright © Yedidya Rosenstark. All rights reserved.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_adfs-1.0.1.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_adfs-1.0.1-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file python_adfs-1.0.1.tar.gz.

File metadata

  • Download URL: python_adfs-1.0.1.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

Hashes for python_adfs-1.0.1.tar.gz
Algorithm Hash digest
SHA256 99f7e2b7db0b5ef4b11db63879d7232398b4724645a70fefd7ea3bbdaa78a316
MD5 276a2d1efb74caf73a46f37e87654275
BLAKE2b-256 52100c74c70ac175b384a71485d23576981075cd2f216ad534069453b8dbf31a

See more details on using hashes here.

File details

Details for the file python_adfs-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: python_adfs-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for python_adfs-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e31915015beb8d130b617a4c4a23d7447d3d44dd1cd8e5759f47f18a740cb8bc
MD5 a5393bc11ffe79564ceefff1d3a19ce9
BLAKE2b-256 3b57cd13f143f738714456819fb0b176ee5245cc7063bd4383999e54b3dfe944

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page