This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

High level interface to SSPI for Kerberos client auth

Project Description

About

A native Kerberos SSPI client implementation. This module mimics the API of pykerberos to implement Kerberos SSPI authentication on Microsoft Windows. It supports Python 2.6, 2.7, and 3.3+.

Installation

WinKerberos is in the Python Package Index (pypi). Use pip to install it:

python -m pip install winkerberos

Building and installing from source

You must have the correct version of VC++ installed for your version of Python:

  • Python 2.6 - Visual Studio 2008 (Professional for 64bit)
  • Python 2.7 - Visual Studio 2008 (Professional for 64bit)
  • Python 3.3 - Visual Studio 2010 (Professional for 64bit)
  • Python 3.4 - Visual Studio 2010 (Professional for 64bit)
  • Python 3.5+ - Visual Studio 2015 (Any version)

The Microsoft Visual C++ Compiler for Python 2.7 could also be used to build for Python 2.6 and 2.7.

Once you have the required compiler installed, run the following command from the root directory of the WinKerberos source:

python setup.py install

Building HTML documentation

First install Sphinx:

python -m pip install Sphinx

Then run the following command from the root directory of the WinKerberos source:

python setup.py doc

Examples

This is a simplified example of a complete authentication session following RFC-4752, section 3.1:

import winkerberos as kerberos

def send_response_and_receive_challenge(response):
    # Your server communication code here...
    pass

def authenticate_kerberos(service, user):
    # Initialize the context object with a service principal.
    status, ctx = kerberos.authGSSClientInit(service)

    # GSSAPI is a "client goes first" SASL mechanism. Send the
    # first "response" to the server and recieve its first
    # challenge.
    status = kerberos.authGSSClientStep(ctx, "")
    response = kerberos.authGSSClientResponse(ctx)
    challenge = send_response_and_receive_challenge(response)

    # Keep processing challenges and sending responses until
    # authGSSClientStep reports AUTH_GSS_COMPLETE.
    while status == kerberos.AUTH_GSS_CONTINUE:
        status = kerberos.authGSSClientStep(ctx, challenge)
        response = kerberos.authGSSClientResponse(ctx) or ''
        challenge = send_response_and_receive_challenge(response)

    # Decrypt the server's last challenge
    kerberos.authGSSClientUnwrap(ctx, challenge)
    data = kerberos.authGSSClientResponse(ctx)
    # Encrypt a response including the user principal to authorize.
    kerberos.authGSSClientWrap(ctx, data, user)
    response = kerberos.authGSSClientResponse(ctx)

    # Complete authentication.
    send_response_and_receive_challenge(response)

Viewing API Documentation without Sphinx

Use the help function in the python interactive shell:

>>> import winkerberos
>>> help(winkerberos)
Release History

Release History

This version
History Node

0.6.0

History Node

0.5.0

History Node

0.4.0

History Node

0.3.0

History Node

0.2.0

History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
winkerberos-0.6.0-cp26-cp26m-win32.whl (15.1 kB) Copy SHA256 Checksum SHA256 2.6 Wheel Feb 14, 2017
winkerberos-0.6.0-cp26-cp26m-win_amd64.whl (16.8 kB) Copy SHA256 Checksum SHA256 2.6 Wheel Feb 14, 2017
winkerberos-0.6.0-cp27-cp27m-win32.whl (14.9 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Feb 14, 2017
winkerberos-0.6.0-cp27-cp27m-win_amd64.whl (16.5 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Feb 14, 2017
winkerberos-0.6.0-cp33-cp33m-win32.whl (14.7 kB) Copy SHA256 Checksum SHA256 3.3 Wheel Feb 14, 2017
winkerberos-0.6.0-cp33-cp33m-win_amd64.whl (15.9 kB) Copy SHA256 Checksum SHA256 3.3 Wheel Feb 14, 2017
winkerberos-0.6.0-cp34-cp34m-win32.whl (14.7 kB) Copy SHA256 Checksum SHA256 3.4 Wheel Feb 14, 2017
winkerberos-0.6.0-cp34-cp34m-win_amd64.whl (15.9 kB) Copy SHA256 Checksum SHA256 3.4 Wheel Feb 14, 2017
winkerberos-0.6.0-cp35-cp35m-win32.whl (16.1 kB) Copy SHA256 Checksum SHA256 3.5 Wheel Feb 14, 2017
winkerberos-0.6.0-cp35-cp35m-win_amd64.whl (18.3 kB) Copy SHA256 Checksum SHA256 3.5 Wheel Feb 14, 2017
winkerberos-0.6.0-cp36-cp36m-win32.whl (16.1 kB) Copy SHA256 Checksum SHA256 3.6 Wheel Feb 14, 2017
winkerberos-0.6.0-cp36-cp36m-win_amd64.whl (18.3 kB) Copy SHA256 Checksum SHA256 3.6 Wheel Feb 14, 2017
winkerberos-0.6.0.zip (38.1 kB) Copy SHA256 Checksum SHA256 Source Feb 14, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting