Metadata-Version: 2.4
Name: python-adfs
Version: 1.0.0
Summary: Python module for interacting with Microsoft ADFS and OIDC at ease
Author-email: Yedidya Rosenstark <yedidya.rosenstark@gmail.com>
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
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: Topic :: Software Development :: Libraries
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Requires-Dist: pyjwt>=2.12.0
Requires-Dist: aiohttp
Requires-Dist: cryptography
Requires-Dist: pydantic-settings
Requires-Dist: pydantic>=2.0
Requires-Dist: typing_extensions>=4.0.0; python_version < "3.10"
Provides-Extra: dev
Requires-Dist: bandit; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: isort; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: pylint; extra == "dev"
Requires-Dist: pytest-asyncio; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Dynamic: license-file

# 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

```bash
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._

```python
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](https://www.jwt.io/) (jwt playground)
- [JWT RFC7519](https://datatracker.ietf.org/doc/html/rfc7519)
- [microsoft example openid-configuration](https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration)

\
**Created by Yedidya.R**
\
Copyright &copy; Yedidya Rosenstark. All rights reserved.
