minisaml


Nameminisaml JSON
Version 24.6 PyPI version JSON
download
home_pagehttps://github.com/HENNGE/minisaml
SummaryMinimal SAML2 client
upload_time2024-06-10 07:49:20
maintainerNone
docs_urlNone
authorJonas Obrist
requires_python<4.0,>=3.8
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Jonas Obrist",
    "author_email": "jonas.obrist@hennge.com",
    "download_url": "https://files.pythonhosted.org/packages/80/a9/f1e485b3cbad897f40e602a151b1e7955f41998084fc3a887da5f03484fd/minisaml-24.6.tar.gz",
    "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": "24.6",
    "project_urls": {
        "Documentation": "https://minisaml.readthedocs.io",
        "Homepage": "https://github.com/HENNGE/minisaml",
        "Repository": "https://github.com/HENNGE/minisaml"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9cbf5deda20bfdc0f8e673776f076253e852cce5e10e5f667913cc9f99f1c4f0",
                "md5": "7ca61694298d1c959caf91efc953d86f",
                "sha256": "63ff92bc9afbcbbbd64cb2521407b424b5a691e6917433d4bab8ed0666faf6b7"
            },
            "downloads": -1,
            "filename": "minisaml-24.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7ca61694298d1c959caf91efc953d86f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 7780,
            "upload_time": "2024-06-10T07:49:18",
            "upload_time_iso_8601": "2024-06-10T07:49:18.073178Z",
            "url": "https://files.pythonhosted.org/packages/9c/bf/5deda20bfdc0f8e673776f076253e852cce5e10e5f667913cc9f99f1c4f0/minisaml-24.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "80a9f1e485b3cbad897f40e602a151b1e7955f41998084fc3a887da5f03484fd",
                "md5": "3a91044cf8d5cb80ffbc5ebc473d570b",
                "sha256": "dacdae7feb90a673052912bb67ee529ab1abda842c8f7d2f59682bb936364ec1"
            },
            "downloads": -1,
            "filename": "minisaml-24.6.tar.gz",
            "has_sig": false,
            "md5_digest": "3a91044cf8d5cb80ffbc5ebc473d570b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 6395,
            "upload_time": "2024-06-10T07:49:20",
            "upload_time_iso_8601": "2024-06-10T07:49:20.416469Z",
            "url": "https://files.pythonhosted.org/packages/80/a9/f1e485b3cbad897f40e602a151b1e7955f41998084fc3a887da5f03484fd/minisaml-24.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-10 07:49:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "HENNGE",
    "github_project": "minisaml",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "minisaml"
}
        
Elapsed time: 5.00766s