summaryrefslogtreecommitdiff
path: root/src/leap/base/auth.py
diff options
context:
space:
mode:
authorantialias <antialias@leap.se>2012-10-22 17:29:26 -0400
committerantialias <antialias@leap.se>2012-10-22 17:29:26 -0400
commit5bbbdc6029855a2b0aeb830f4d2f9e5546d4585b (patch)
tree3d83d81df5635fcb70972db0bc256181c87852f7 /src/leap/base/auth.py
parent47a9a04145e30476c162a1d76d4d8b4b360de0bd (diff)
Test HTTPS Server in place and returning canned responses.
But verification failing.
Diffstat (limited to 'src/leap/base/auth.py')
-rw-r--r--src/leap/base/auth.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/leap/base/auth.py b/src/leap/base/auth.py
index 5a9ebe1d..d91e138b 100644
--- a/src/leap/base/auth.py
+++ b/src/leap/base/auth.py
@@ -119,12 +119,11 @@ safe_unhexlify = lambda x: binascii.unhexlify(x) \
class SRPAuth(requests.auth.AuthBase):
- def __init__(self, username, password):
+ def __init__(self, username, password, server=SERVER, verify=True):
self.username = username
self.password = password
-
- # XXX init something similar to
- # SERVER...
+ self.server = server
+ self.verify = verify
self.init_data = None
self.session = requests.session()
@@ -153,8 +152,9 @@ class SRPAuth(requests.auth.AuthBase):
def get_init_data(self):
init_session = self.session.post(
- SERVER + '/sessions',
- data=self.get_auth_data())
+ self.server + '/sessions',
+ data=self.get_auth_data(),
+ verify=self.verify)
self.init_data = self.get_data(init_session)
return self.init_data
@@ -174,8 +174,9 @@ class SRPAuth(requests.auth.AuthBase):
)
auth_result = self.session.put(
- SERVER + '/sessions/' + self.username,
- data={'client_auth': binascii.hexlify(self.M)})
+ self.server + '/sessions/' + self.username,
+ data={'client_auth': binascii.hexlify(self.M)},
+ verify=self.verify)
# XXX check for errors
auth_data = self.get_data(auth_result)