Esempio n. 1
0
    def _create_new_session(self, username, password, auth):
        account_email = self._provider.address_for(username)

        self._create_database_dir(auth.uuid)

        api_cert = LeapCertificate(self._provider).provider_api_cert

        soledad = yield self.setup_soledad(auth.token, auth.uuid, password,
                                           api_cert)

        mail_store = LeapMailStore(soledad)

        keymanager = yield self.setup_keymanager(self._provider, soledad,
                                                 account_email, auth.token,
                                                 auth.uuid)

        smtp_client_cert = self._download_smtp_cert(auth)
        smtp_host, smtp_port = self._provider.smtp_info()
        smtp_config = LeapSMTPConfig(account_email, smtp_client_cert,
                                     smtp_host, smtp_port)

        leap_session = LeapSession(self._provider, auth, mail_store, soledad,
                                   keymanager, smtp_config)

        defer.returnValue(leap_session)
Esempio n. 2
0
    def __init__(self, userid, soledad, keymanager):
        self.userid = userid

        self.soledad = soledad

        # XXX this needs to be converged with our public apis.
        self.nicknym = NickNym(keymanager, userid)
        self.mail_store = LeapMailStore(soledad)

        self.user_auth = Config()
        self.user_auth.uuid = soledad.uuid

        self.fresh_account = False
        self.incoming_mail_fetcher = None
        self.account = Account(soledad, userid)

        username, provider = userid.split('@')
        smtp_client_cert = os.path.join(
            get_path_prefix(), 'leap', 'providers', provider, 'keys', 'client',
            'smtp_{username}.pem'.format(username=username))

        assert (os.path.isfile(smtp_client_cert))

        smtp_config = get_smtp_config(provider)
        smtp_host = smtp_config.host
        smtp_port = smtp_config.port

        self.smtp_config = LeapSMTPConfig(userid, smtp_client_cert, smtp_host,
                                          smtp_port)
Esempio n. 3
0
 def setUp(self):
     self._cert_path = u'/some/cert/path'
     self._keymanager_mock = mock()
     self._remote_smtp_host = 'some.host.test'
     self._remote_smtp_port = 1234
     self._smtp_config = LeapSMTPConfig('*****@*****.**',
                                        self._cert_path,
                                        self._remote_smtp_host,
                                        self._remote_smtp_port)