diff options
author | NavaL <mnandri@thoughtworks.com> | 2016-01-27 19:29:36 +0100 |
---|---|---|
committer | NavaL <mnandri@thoughtworks.com> | 2016-01-28 10:43:14 +0100 |
commit | 766c5617007650d90f1d249aaa253755dcd1906c (patch) | |
tree | ebe66b6219cbbab28b5101a72a3338210c69f99c /service/pixelated/bitmask_libraries | |
parent | 29f0bd4576955536d3714b1c095bcfe387ec51b9 (diff) |
making async setup user services after auth
Issue #583
Diffstat (limited to 'service/pixelated/bitmask_libraries')
-rw-r--r-- | service/pixelated/bitmask_libraries/session.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/service/pixelated/bitmask_libraries/session.py b/service/pixelated/bitmask_libraries/session.py index dfa96388..a88eff11 100644 --- a/service/pixelated/bitmask_libraries/session.py +++ b/service/pixelated/bitmask_libraries/session.py @@ -136,21 +136,24 @@ class LeapSessionFactory(object): self._provider = provider self._config = provider.config - def create(self, username, password): + def create(self, username, password, auth=None): key = self._session_key(username) session = self._lookup_session(key) if not session: - session = self._create_new_session(username, password) + session = self._create_new_session(username, password, auth) self._remember_session(key, session) return session - def _create_new_session(self, username, password): + def _auth_leap(self, username, password): + srp_auth = SRPAuth(self._provider.api_uri, self._provider.local_ca_crt) + return srp_auth.authenticate(username, password) + + def _create_new_session(self, username, password, auth=None): self._create_dir(self._provider.config.leap_home) self._provider.download_certificate() - srp_auth = SRPAuth(self._provider.api_uri, self._provider.local_ca_crt) - auth = srp_auth.authenticate(username, password) + auth = auth or self._auth_leap(username, password) account_email = self._provider.address_for(username) self._create_database_dir(auth.uuid) |