{"id":14956427,"url":"https://github.com/mongodb/winkerberos","last_synced_at":"2025-12-12T00:59:58.128Z","repository":{"id":41994197,"uuid":"52392842","full_name":"mongodb/winkerberos","owner":"mongodb","description":"A native Kerberos client implementation for Python on Windows","archived":false,"fork":false,"pushed_at":"2025-03-03T20:18:37.000Z","size":295,"stargazers_count":54,"open_issues_count":4,"forks_count":15,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-04-02T02:54:37.261Z","etag":null,"topics":["authentication","gssapi","gssapi-authentication","kerberos","python","sspi"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mongodb.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-23T21:27:00.000Z","updated_at":"2025-03-03T20:18:41.000Z","dependencies_parsed_at":"2024-04-19T01:37:48.810Z","dependency_job_id":"28ce365e-b69e-470d-acdc-0129889c7ed7","html_url":"https://github.com/mongodb/winkerberos","commit_stats":{"total_commits":202,"total_committers":18,"mean_commits":"11.222222222222221","dds":0.6485148514851485,"last_synced_commit":"e328306d8689aff0bf1530cc885cbde0ee3aa610"},"previous_names":["mongodb-labs/winkerberos"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb%2Fwinkerberos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb%2Fwinkerberos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb%2Fwinkerberos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb%2Fwinkerberos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mongodb","download_url":"https://codeload.github.com/mongodb/winkerberos/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248018061,"owners_count":21034048,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","gssapi","gssapi-authentication","kerberos","python","sspi"],"created_at":"2024-09-24T13:13:03.346Z","updated_at":"2025-12-12T00:59:58.121Z","avatar_url":"https://github.com/mongodb.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"===========\nWinKerberos\n===========\n:Info: See `github \u003chttps://github.com/mongodb-labs/winkerberos\u003e`_ for the latest source.\n:Author: Bernie Hackett \u003cbernie@mongodb.com\u003e\n\nAbout\n=====\n\nA native Kerberos client implementation for Python on Windows. This module\nmimics the API of `pykerberos \u003chttps://pypi.python.org/pypi/pykerberos\u003e`_ to\nimplement Kerberos authentication with Microsoft's Security Support Provider\nInterface (SSPI). It supports Python 3.10+.\n\nInstallation\n============\n\nWinKerberos is in the `Python Package Index (pypi)\n\u003chttps://pypi.python.org/pypi/winkerberos\u003e`_. Use `pip\n\u003chttps://pypi.python.org/pypi/pip\u003e`_ to install it::\n\n  python -m pip install winkerberos\n\nWinKerberos requires Windows 7 / Windows Server 2008 R2 or newer.\n\nBuilding and installing from source\n===================================\n\nYou must have the correct version of VC++ installed for your version of\nPython:\n\n- Python 3.10+ - Visual Studio 2015+ (Any version)\n\nOnce you have the required compiler installed, run the following command from\nthe root directory of the WinKerberos source::\n\n    pip install .\n\nBuilding HTML documentation\n===========================\n\nFirst install `Sphinx \u003chttps://pypi.python.org/pypi/Sphinx\u003e`_::\n\n    python -m pip install Sphinx\n\nThen run the following command from the root directory of the WinKerberos\nsource::\n\n    pip install -e .\n    python -m sphinx -b html doc doc/_build\n\n\nExamples\n========\n\nThis is a simplified example of a complete authentication session\nfollowing RFC-4752, section 3.1:\n\n.. code-block:: python\n\n    import winkerberos as kerberos\n\n\n    def send_response_and_receive_challenge(response):\n        # Your server communication code here...\n        pass\n\n\n    def authenticate_kerberos(service, user, channel_bindings=None):\n        # Initialize the context object with a service principal.\n        status, ctx = kerberos.authGSSClientInit(service)\n\n        # GSSAPI is a \"client goes first\" SASL mechanism. Send the\n        # first \"response\" to the server and receive its first\n        # challenge.\n        if channel_bindings is not None:\n            status = kerberos.authGSSClientStep(ctx, \"\", channel_bindings=channel_bindings)\n        else:\n            status = kerberos.authGSSClientStep(ctx, \"\")\n        response = kerberos.authGSSClientResponse(ctx)\n        challenge = send_response_and_receive_challenge(response)\n\n        # Keep processing challenges and sending responses until\n        # authGSSClientStep reports AUTH_GSS_COMPLETE.\n        while status == kerberos.AUTH_GSS_CONTINUE:\n            if channel_bindings is not None:\n                status = kerberos.authGSSClientStep(\n                    ctx, challenge, channel_bindings=channel_bindings\n                )\n            else:\n                status = kerberos.authGSSClientStep(ctx, challenge)\n\n            response = kerberos.authGSSClientResponse(ctx) or \"\"\n            challenge = send_response_and_receive_challenge(response)\n\n        # Decrypt the server's last challenge\n        kerberos.authGSSClientUnwrap(ctx, challenge)\n        data = kerberos.authGSSClientResponse(ctx)\n        # Encrypt a response including the user principal to authorize.\n        kerberos.authGSSClientWrap(ctx, data, user)\n        response = kerberos.authGSSClientResponse(ctx)\n\n        # Complete authentication.\n        send_response_and_receive_challenge(response)\n\nChannel bindings can be generated with help from the cryptography_ module. See\n`\u003chttps://tools.ietf.org/html/rfc5929#section-4.1\u003e`_ for the rules regarding\nhash algorithm choice:\n\n.. code-block:: python\n\n    from cryptography import x509\n    from cryptography.hazmat.backends import default_backend\n    from cryptography.hazmat.primitives import hashes\n\n\n    def channel_bindings(ssl_socket):\n        server_certificate = ssl_socket.getpeercert(True)\n        cert = x509.load_der_x509_certificate(server_certificate, default_backend())\n        hash_algorithm = cert.signature_hash_algorithm\n        if hash_algorithm.name in (\"md5\", \"sha1\"):\n            digest = hashes.Hash(hashes.SHA256(), default_backend())\n        else:\n            digest = hashes.Hash(hash_algorithm, default_backend())\n        digest.update(server_certificate)\n        application_data = b\"tls-server-end-point:\" + digest.finalize()\n        return kerberos.channelBindings(application_data=application_data)\n\n\n.. _cryptography: https://pypi.python.org/pypi/cryptography\n\nViewing API Documentation without Sphinx\n========================================\n\nUse the help function in the python interactive shell:\n\n.. code-block:: pycon\n\n    \u003e\u003e\u003e import winkerberos\n    \u003e\u003e\u003e help(winkerberos)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongodb%2Fwinkerberos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmongodb%2Fwinkerberos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongodb%2Fwinkerberos/lists"}