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 for Windows SSPI-backed Kerberos/NTLM, pyspnego[kerberos] for non-Windows Kerberos, and pycryptodome as an MD4 fallback for Python/OpenSSL builds that do not expose hashlib.new("md4").

On non-Windows 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 off Windows or HTTP/host on Windows from the authentication challenge origin when neither spn nor hostname is provided.

Kerberos integrated authentication

Windows Kerberos generation uses SSPI through pyspnego, avoiding the non-Windows gssapi dependency. Non-Windows platforms continue to use gssapi through pyspnego[kerberos].

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.2.tar.gz (9.9 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.2-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lexmount_extra-0.1.2.tar.gz
  • Upload date:
  • Size: 9.9 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.2.tar.gz
Algorithm Hash digest
SHA256 8f35b27fa4c1e3e92fb2da8453652b7fe2d6618726ab2ff7dadfd5625e2b083f
MD5 1b02beea3ccd35b82fa03f0855801b5a
BLAKE2b-256 71af7ac18cae1533903900b4b71ae29ab353a8f0a7315f89b43ca7d9e126aaff

See more details on using hashes here.

Provenance

The following attestation bundles were made for lexmount_extra-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: lexmount_extra-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 991e4ea17ae4c0f47ca2921f2f30cbe81815e146bbd5a9770df54882d01e1a9a
MD5 8af6f34a02048d08a3ed9a84ce260157
BLAKE2b-256 14786c98c6cc0973c13c39c0f13eac8f18f2ca061fa3cee2c69a2eba1230f012

See more details on using hashes here.

Provenance

The following attestation bundles were made for lexmount_extra-0.1.2-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