Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for Windows #30

Merged
merged 7 commits into from
Feb 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions puresasl/mechanisms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import random
import struct
import sys
import platform

from puresasl import SASLError, SASLProtocolException, QOP

Expand All @@ -13,6 +14,15 @@
except ImportError:
have_kerberos = False

if platform.system() == 'Windows':
try:
import winkerberos as kerberos
# Fix for different capitalisation in winkerberos method name
kerberos.authGSSClientUserName = kerberos.authGSSClientUsername
have_kerberos = True
except ImportError:
have_kerberos = False

PY3 = sys.version_info[0] == 3
if PY3:
def _b(s):
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from setuptools import setup

import puresasl
import sys

setup(name='pure-sasl',
version=puresasl.__version__,
Expand All @@ -22,7 +23,7 @@
keywords='sasl',
packages=['puresasl'],
extras_require={
'GSSAPI': ['kerberos>=1.3.0']
'GSSAPI': ["winkerberos==0.7.0"] if platform.system() == 'Windows' else ['kerberos>=1.3.0']
},
classifiers=[
'Development Status :: 4 - Beta',
Expand Down
3 changes: 2 additions & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
coverage
kerberos>=1.3.0
mock<=1.0.1
nose
six
unittest2 ; python_version < '2.7'
winkerberos>=0.7.0 ; platform_system=="Windows"
kerberos>=1.3.0; platform_system != "Windows"
6 changes: 5 additions & 1 deletion tests/unit/test_mechanism.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
import base64
import hashlib
import hmac
import kerberos
import platform
if platform.system() == 'Windows':
import winkerberos as kerberos
else:
import kerberos

from mock import patch
import six
Expand Down