def enroll(self, username):
        if username not in self.users:
            self.users[username] = {}

        user = self.users[username]
        devices = map(DeviceRegistration.wrap, user.get('_u2f_devices_', []))
        enroll = start_register(self.app_id, devices)
        user['_u2f_enroll_'] = enroll.json
        return enroll.json
예제 #2
0
    def enroll(self, username):
        if username not in self.users:
            self.users[username] = {}

        user = self.users[username]
        devices = map(DeviceRegistration.wrap, user.get('_u2f_devices_', []))
        enroll = start_register(self.app_id, devices)
        user['_u2f_enroll_'] = enroll.json
        return enroll.json
예제 #3
0
파일: main.py 프로젝트: peuter/gosa
    def __enable_u2f(self, user):
        if user.uuid not in self.__settings:
            self.__settings[user.uuid] = {}

        user_settings = self.__settings[user.uuid]
        devices = [DeviceRegistration.wrap(device)
                   for device in user_settings.get('_u2f_devices_', [])]
        enroll = start_register(self.app_id, devices)
        user_settings['_u2f_enroll_'] = enroll.json
        self.__save_settings()
        return enroll.json
예제 #4
0
파일: user.py 프로젝트: cherti/pretix
    def get_context_data(self, **kwargs):
        ctx = super().get_context_data()
        ctx['device'] = self.device

        devices = [DeviceRegistration.wrap(device.json_data)
                   for device in U2FDevice.objects.filter(confirmed=True, user=self.request.user)]
        enroll = u2f.start_register(self.app_id, devices)
        self.request.session['_u2f_enroll'] = enroll.json
        ctx['jsondata'] = enroll.json

        return ctx
예제 #5
0
파일: main.py 프로젝트: peuter/gosa
    def __enable_u2f(self, user):
        if user.uuid not in self.__settings:
            self.__settings[user.uuid] = {}

        user_settings = self.__settings[user.uuid]
        devices = [
            DeviceRegistration.wrap(device)
            for device in user_settings.get('_u2f_devices_', [])
        ]
        enroll = start_register(self.app_id, devices)
        user_settings['_u2f_enroll_'] = enroll.json
        self.__save_settings()
        return enroll.json
예제 #6
0
파일: user.py 프로젝트: zippyy/pretix
    def get_context_data(self, **kwargs):
        ctx = super().get_context_data()
        ctx['device'] = self.device

        devices = [
            DeviceRegistration.wrap(device.json_data)
            for device in U2FDevice.objects.filter(confirmed=True,
                                                   user=self.request.user)
        ]
        enroll = u2f.start_register(self.app_id, devices)
        self.request.session['_u2f_enroll'] = enroll.json
        ctx['jsondata'] = enroll.json

        return ctx
예제 #7
0
def userEnroll(id):
    try:
        user = User().getObjectsByKey("_id", id)[0]
    except Exception as e:
        return abort(404)

    try:
        devices = map(DeviceRegistration.wrap, user.u2f_devices)
    except:
        devices = []

    app_id = "http://127.0.0.1"
    print app_id
    enroll = start_register(app_id, devices)
    user.u2f_enroll = enroll.json
    return enroll.json
예제 #8
0
 def start_enrollment(self):
     return dict(u2f.start_register(self.u2f_app_id,
                                    self.get_u2f_devices()))
예제 #9
0
 def start_enrollment(self):
     return dict(u2f.start_register(self.u2f_app_id,
                                    self.get_u2f_devices()))
예제 #10
0
def register_token(devices=[]):
    token = SoftU2FDevice()
    request_data = u2f.start_register(APP_ID, devices)
    response = token.register(request_data.registerRequests[0].json, FACET)
    device, cert = u2f.complete_register(request_data, response)
    return device, token
예제 #11
0
 def generate_new_config(self):
     return {
         'enrollment': dict(u2f.start_register(self.u2f_app_id, [])),
     }
def register_token(devices=[]):
    token = SoftU2FDevice()
    request_data = u2f.start_register(APP_ID, devices)
    response = token.register(request_data.registerRequests[0].json, FACET)
    device, cert = u2f.complete_register(request_data, response)
    return device, token