예제 #1
0
def _enroll(oauth, meta, builder, config_dict, lets_connect):
    # type: (str, Metadata, Gtk.builder, dict, bool) -> None
    if meta.username == 'totp':
        GLib.idle_add(lambda: totp_enroll_window(oauth=oauth, meta=meta, builder=builder, config_dict=config_dict,
                                                 lets_connect=lets_connect))
    elif meta.username == 'yubi':
        GLib.idle_add(lambda: yubi_enroll_window(oauth=oauth, meta=meta, builder=builder, config_dict=config_dict,
                                                 lets_connect=lets_connect))
def _enroll(oauth, meta, builder, config_dict, lets_connect):
    if meta.username == 'totp':
        GLib.idle_add(lambda: totp_enroll_window(oauth=oauth,
                                                 meta=meta,
                                                 builder=builder,
                                                 config_dict=config_dict,
                                                 lets_connect=lets_connect))
    elif meta.username == 'yubi':
        GLib.idle_add(lambda: yubi_enroll_window(oauth=oauth,
                                                 meta=meta,
                                                 builder=builder,
                                                 config_dict=config_dict,
                                                 lets_connect=lets_connect))
 def test_totp_enroll_window(self):
     totp_enroll_window(builder=self.builder,
                        config_dict=mock_config_dict,
                        meta=self.meta,
                        oauth=self.oauth,
                        lets_connect=False)
from eduvpn.main import init
from eduvpn.steps.totp_enroll import totp_enroll_window
from eduvpn.steps.yubi_enroll import yubi_enroll_window
from tests.online import get_oauth_token, check_online_tests, disable_2fa
from gi.repository import Gtk
from pyotp import TOTP

INSTANCE_URI = "https://debian-vpn.tuxed.net"
TOTP_SECRET = "QXU5GXJ3Y3Z7TCZG"
user, password = check_online_tests()
disable_2fa(user, password, TOTP_SECRET, INSTANCE_URI)
oauth, meta = get_oauth_token(user, password, INSTANCE_URI)
config_dict = {}
totp = TOTP(TOTP_SECRET)

edu_vpn_app = init()
# yubi_enroll_window(builder=edu_vpn_app.builder, oauth=oauth, meta=meta, config_dict=config_dict)
totp_enroll_window(builder=edu_vpn_app.builder,
                   oauth=oauth,
                   meta=meta,
                   config_dict=config_dict,
                   secret=TOTP_SECRET)
Gtk.main()