Skip to main content

Extra utilities for Lexmount Python SDK projects.

Project description

lexmount-extra

Extra utilities for Lexmount Python SDK projects.

Install

pip install lexmount-extra

The package uses ntlm-auth for non-Windows NTLM credentials, pyspnego[kerberos] for SPNEGO/Kerberos and Windows integrated NTLM, and pycryptodome as an MD4 fallback for Python/OpenSSL builds that do not expose hashlib.new("md4").

On Debian/Ubuntu images, installing the Kerberos dependency may also require the system package that provides krb5-config:

sudo apt-get install libkrb5-dev

Usage

from lexmount_extra import (
    createKerberosAuthCallback,
    createNTLMAuthCallback,
    generateKerberosToken,
    generateNTLMChallengeToken,
    generateNTLMResponseToken,
)

type1_token = generateNTLMChallengeToken("web.lab.local", "LAB")

type3_token = generateNTLMResponseToken(
    "http://web.lab.local/",
    "web.lab.local",
    "LAB",
    "NTLM <server-type2-token>",
    "alice",
    "P@ssw0rd123!",
)

kerberos_token = generateKerberosToken(
    "HTTP@web.lab.test",
    "server-token",
)

Pythonic snake_case aliases are available for every Node-compatible camelCase function.

Lexmount authentication callbacks

from lexmount import register_integrated_auth_callback
from lexmount_extra import createKerberosAuthCallback, createNTLMAuthCallback

ntlm_auth = createNTLMAuthCallback({
    "hostname": "web.lab.local",
    "domain": "LAB",
})

kerberos_auth = createKerberosAuthCallback({
    "hostname": "web.lab.test",
})

register_integrated_auth_callback(session, ntlm_auth)
register_integrated_auth_callback(session, kerberos_auth)

Both callback factories can be called without options. NTLM defaults to USERDNSDOMAIN and USERDOMAIN when those environment variables exist. Kerberos derives the HTTP@host service principal from the authentication challenge origin when neither spn nor hostname is provided.

NTLM integrated authentication

Windows NTLM generation uses SSPI through pyspnego. Type 1 and Type 3 tokens both support explicit username/password credentials, and Type 3 can also use the current Windows logon session when credentials are omitted. The Lexmount callback keeps the SSPI context between Type 1 and Type 3 by using the request's frameId and requestId.

Non-Windows platforms use ntlm-auth. They support Type 1 and Type 3 with explicit username/password credentials; Type 3 without credentials returns an empty token.

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

lexmount_extra-0.1.1.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

lexmount_extra-0.1.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file lexmount_extra-0.1.1.tar.gz.

File metadata

  • Download URL: lexmount_extra-0.1.1.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lexmount_extra-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8a3b7e04f2e6500bae175aa3cbb17ff1b7fe6bbdb50ad79b42975eb3b18a7cee
MD5 723cf9197d4bd5788013a5b5579cb4ad
BLAKE2b-256 9b177316aecf7b846edb64a7a06a9c3fdb1e22cea9a36a1fc7e7f12c777a3dff

See more details on using hashes here.

Provenance

The following attestation bundles were made for lexmount_extra-0.1.1.tar.gz:

Publisher: publish.yml on lexmount/lexmount-python-sdk-extra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lexmount_extra-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: lexmount_extra-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lexmount_extra-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 27e45eeb15652ce84d7e080182ee71d80eafac05743f62696fa8fe1b965845b0
MD5 5b75d4ed0d3c4891d1d480d6a91ecf72
BLAKE2b-256 e167a97e6d140420002e4093cb52482b5ca1d80505ba43cd34f352e5e474d13a

See more details on using hashes here.

Provenance

The following attestation bundles were made for lexmount_extra-0.1.1-py3-none-any.whl:

Publisher: publish.yml on lexmount/lexmount-python-sdk-extra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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