# MiniSAML
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![CircleCI](https://circleci.com/gh/HENNGE/minisaml.svg?style=svg)](https://circleci.com/gh/HENNGE/minisaml)
[![Documentation Status](https://readthedocs.org/projects/minisaml/badge/?version=latest)](https://minisaml.readthedocs.io/en/latest/?badge=latest)
Absolutely minimalistic SAML 2 client. Does not support the full SAML 2 specification, on purpose.
It only supports requests via HTTP Redirect and responses via HTTP POST.
## Usage
### Create a SAML Request
```python
from minisaml.request import get_request_redirect_url
url = get_request_redirect_url(
saml_endpoint="https://your-idp.invalid/sso-endpoint/",
expected_audience="Your SAML Issuer",
acs_url="https://you.web-site.invalid/saml/acs/"
)
# This line depends on your web framework/server
redirect_user_to_url(url)
```
### Validate and parse the SAML Response
```python
from minisaml.response import validate_response
# This line depends on your web framework/server
saml_response = get_SAMLResponse_form_data_as_bytes()
# Load the x509 certificate as a cryptography.x509.Certificate somehow
certificate = ...
try:
response = validate_response(
data=saml_response,
certificate=certificate,
expected_audience="Your SAML Issuer",
idp_issuer="https://your-idp.invalid/issuer/"
)
except:
handle_invalid_response_somehow()
# response is a minisaml.response.Response object
```
Raw data
{
"_id": null,
"home_page": "https://github.com/HENNGE/minisaml",
"name": "minisaml",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Jonas Obrist",
"author_email": "jonas.obrist@hennge.com",
"download_url": "",
"platform": null,
"description": "# MiniSAML\n\n\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![CircleCI](https://circleci.com/gh/HENNGE/minisaml.svg?style=svg)](https://circleci.com/gh/HENNGE/minisaml)\n[![Documentation Status](https://readthedocs.org/projects/minisaml/badge/?version=latest)](https://minisaml.readthedocs.io/en/latest/?badge=latest)\n\n\n\nAbsolutely minimalistic SAML 2 client. Does not support the full SAML 2 specification, on purpose.\nIt only supports requests via HTTP Redirect and responses via HTTP POST.\n\n\n## Usage\n\n\n### Create a SAML Request\n\n```python\nfrom minisaml.request import get_request_redirect_url\n\nurl = get_request_redirect_url(\n saml_endpoint=\"https://your-idp.invalid/sso-endpoint/\",\n expected_audience=\"Your SAML Issuer\",\n acs_url=\"https://you.web-site.invalid/saml/acs/\"\n)\n\n# This line depends on your web framework/server\nredirect_user_to_url(url)\n```\n\n### Validate and parse the SAML Response\n\n```python\nfrom minisaml.response import validate_response\n\n# This line depends on your web framework/server\nsaml_response = get_SAMLResponse_form_data_as_bytes()\n\n# Load the x509 certificate as a cryptography.x509.Certificate somehow\ncertificate = ...\n\ntry:\n response = validate_response(\n data=saml_response,\n certificate=certificate,\n expected_audience=\"Your SAML Issuer\",\n idp_issuer=\"https://your-idp.invalid/issuer/\"\n )\nexcept:\n handle_invalid_response_somehow()\n\n# response is a minisaml.response.Response object\n```\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Minimal SAML2 client",
"version": "23.1",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6663670c588baceeb1488ee4a2533c1debe20e680753840bb0a4da44445c5618",
"md5": "830b3cbf65ba295e3bd7264ad42147fc",
"sha256": "bac41428173c6cc0751735645c5f19650342fd215e8dd696022ed4110647436e"
},
"downloads": -1,
"filename": "minisaml-23.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "830b3cbf65ba295e3bd7264ad42147fc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 7790,
"upload_time": "2023-01-05T09:25:37",
"upload_time_iso_8601": "2023-01-05T09:25:37.150605Z",
"url": "https://files.pythonhosted.org/packages/66/63/670c588baceeb1488ee4a2533c1debe20e680753840bb0a4da44445c5618/minisaml-23.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-05 09:25:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "HENNGE",
"github_project": "minisaml",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "minisaml"
}