コード例 #1
0
def initialize_leap(leap_provider_cert,
                    leap_provider_cert_fingerprint,
                    credentials_file,
                    organization_mode,
                    leap_home,
                    initial_sync=True):
    init_monkeypatches()
    events_server.ensure_server()
    register(events.KEYMANAGER_FINISHED_KEY_GENERATION,
             set_fresh_account)
    provider, username, password = credentials.read(organization_mode,
                                                    credentials_file)
    LeapCertificate.set_cert_and_fingerprint(leap_provider_cert,
                                             leap_provider_cert_fingerprint)

    config = LeapConfig(leap_home=leap_home, start_background_jobs=True)
    provider = LeapProvider(provider, config)
    LeapCertificate(provider).setup_ca_bundle()
    leap_session = LeapSessionFactory(provider).create(username, password)

    if initial_sync:
        leap_session = yield leap_session.initial_sync()

    global fresh_account
    if fresh_account:
        add_welcome_mail(leap_session.mail_store)

    defer.returnValue(leap_session)
コード例 #2
0
ファイル: leap.py プロジェクト: akjones/pixelated-user-agent
def initialize_leap_single_user(
    leap_provider_cert, leap_provider_cert_fingerprint, credentials_file, leap_home, initial_sync=True
):

    init_monkeypatches()
    events_server.ensure_server()

    provider, username, password = credentials.read(credentials_file)

    config, provider = initialize_leap_provider(provider, leap_provider_cert, leap_provider_cert_fingerprint, leap_home)

    leap_session = yield authenticate_user(provider, username, password, initial_sync=initial_sync)

    defer.returnValue(leap_session)
コード例 #3
0
def initialize_leap(leap_provider_cert,
                    leap_provider_cert_fingerprint,
                    credentials_file,
                    organization_mode,
                    leap_home):
    init_monkeypatches()
    events_server.ensure_server(random.randrange(8000, 11999))
    provider, username, password = credentials.read(organization_mode, credentials_file)
    LeapCertificate.set_cert_and_fingerprint(leap_provider_cert, leap_provider_cert_fingerprint)

    config = LeapConfig(leap_home=leap_home, start_background_jobs=True)
    provider = LeapProvider(provider, config)
    LeapCertificate(provider).setup_ca_bundle()
    leap_session = LeapSessionFactory(provider).create(username, password)

    return leap_session
コード例 #4
0
    def test_organization_mode_reads_credentials_from_stdin(self):
        data = json.dumps({'leap_provider_hostname': 'test_provider', 'user': '******', 'password': '******'})
        orig_stdin = sys.stdin
        sys.stdin = mock()
        when(sys.stdin).read().thenReturn(data)

        try:
            sys.argv = ['tmp/does_not_exist', '--organization-mode']
            args = arguments.parse_user_agent_args()

            provider, user, password = credentials.read(args.organization_mode, 'not_used')

            self.assertEquals('test_provider', provider)
            self.assertEquals('test_user', user)
            self.assertEquals('test_password', password)
        finally:
            sys.stdin = orig_stdin
コード例 #5
0
ファイル: leap.py プロジェクト: bwagnerr/pixelated-user-agent
def initialize_leap_single_user(leap_provider_cert,
                                leap_provider_cert_fingerprint,
                                credentials_file,
                                leap_home):

    init_monkeypatches()
    events_server.ensure_server()

    provider, username, password = credentials.read(credentials_file)

    provider = initialize_leap_provider(provider, leap_provider_cert, leap_provider_cert_fingerprint, leap_home)

    auth = yield Authenticator(provider).authenticate(username, password)

    leap_session = yield create_leap_session(provider, username, password, auth)

    defer.returnValue(leap_session)
コード例 #6
0
def initialize_leap(leap_provider_cert, leap_provider_cert_fingerprint,
                    credentials_file, organization_mode, leap_home):
    init_monkeypatches()
    events_server.ensure_server()
    provider, username, password = credentials.read(organization_mode,
                                                    credentials_file)
    LeapCertificate.set_cert_and_fingerprint(leap_provider_cert,
                                             leap_provider_cert_fingerprint)

    config = LeapConfig(leap_home=leap_home, start_background_jobs=True)
    provider = LeapProvider(provider, config)
    LeapCertificate(provider).setup_ca_bundle()
    leap_session = LeapSessionFactory(provider).create(username, password)

    yield leap_session.initial_sync()

    defer.returnValue(leap_session)
コード例 #7
0
def initialize_leap_single_user(leap_provider_cert,
                                leap_provider_cert_fingerprint,
                                credentials_file, leap_home):

    init_monkeypatches()
    events_server.ensure_server()

    provider, username, password = credentials.read(credentials_file)

    provider = initialize_leap_provider(provider, leap_provider_cert,
                                        leap_provider_cert_fingerprint,
                                        leap_home)

    auth = yield Authenticator(provider).authenticate(username, password)

    leap_session = yield create_leap_session(provider, username, password,
                                             auth)

    defer.returnValue(leap_session)
コード例 #8
0
def initialize_leap_single_user(leap_provider_cert,
                                leap_provider_cert_fingerprint,
                                credentials_file,
                                leap_home,
                                initial_sync=True):

    init_monkeypatches()
    events_server.ensure_server()

    provider, username, password = credentials.read(credentials_file)

    config, provider = initialize_leap_provider(
        provider, leap_provider_cert, leap_provider_cert_fingerprint,
        leap_home)

    leap_session = yield authenticate_user(provider,
                                           username,
                                           password,
                                           initial_sync=initial_sync)

    defer.returnValue(leap_session)
コード例 #9
0
def initialize_leap_single_user(leap_provider_cert,
                                leap_provider_cert_fingerprint,
                                credentials_file, leap_home):

    init_monkeypatches()
    events_server.ensure_server()

    provider, username, password = credentials.read(credentials_file)

    config, provider = initialize_leap_provider(
        provider, leap_provider_cert, leap_provider_cert_fingerprint,
        leap_home)

    try:
        auth = yield authenticate(provider, username, password)
    except SRPAuthenticationError:
        raise UnauthorizedLogin()

    leap_session = yield create_leap_session(provider, username, password,
                                             auth)

    defer.returnValue(leap_session)
コード例 #10
0
    def test_organization_mode_reads_credentials_from_stdin(self):
        data = json.dumps({
            'leap_provider_hostname': 'test_provider',
            'user': '******',
            'password': '******'
        })
        orig_stdin = sys.stdin
        sys.stdin = mock()
        when(sys.stdin).read().thenReturn(data)

        try:
            sys.argv = ['tmp/does_not_exist', '--organization-mode']
            args = arguments.parse_user_agent_args()

            provider, user, password = credentials.read(
                args.organization_mode, 'not_used')

            self.assertEquals('test_provider', provider)
            self.assertEquals('test_user', user)
            self.assertEquals('test_password', password)
        finally:
            sys.stdin = orig_stdin