Skip to main content

Minimal SAML2 client

Project description

MiniSAML

Code style: black CircleCI Documentation Status

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

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

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

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

minisaml-24.6.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

minisaml-24.6-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file minisaml-24.6.tar.gz.

File metadata

  • Download URL: minisaml-24.6.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for minisaml-24.6.tar.gz
Algorithm Hash digest
SHA256 dacdae7feb90a673052912bb67ee529ab1abda842c8f7d2f59682bb936364ec1
MD5 3a91044cf8d5cb80ffbc5ebc473d570b
BLAKE2b-256 80a9f1e485b3cbad897f40e602a151b1e7955f41998084fc3a887da5f03484fd

See more details on using hashes here.

File details

Details for the file minisaml-24.6-py3-none-any.whl.

File metadata

  • Download URL: minisaml-24.6-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for minisaml-24.6-py3-none-any.whl
Algorithm Hash digest
SHA256 63ff92bc9afbcbbbd64cb2521407b424b5a691e6917433d4bab8ed0666faf6b7
MD5 7ca61694298d1c959caf91efc953d86f
BLAKE2b-256 9cbf5deda20bfdc0f8e673776f076253e852cce5e10e5f667913cc9f99f1c4f0

See more details on using hashes here.

Supported by

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