Example #1
0
def get_options():

    try:
        webauthn_options = webauthn.WebAuthnOptions()

        try:
            options = Options.query.filter_by(rp_id=RP_ID).first()
            if options is None:
                options = Options()
                options.rp_id = RP_ID
                options.version = CURRENT_OPTIONS_TBL_VERSION
                options.option_content = json.dumps(webauthn_options.get())
                db.session.add(options)
                db.session.commit()
            else:
                if options.version != CURRENT_OPTIONS_TBL_VERSION:
                    return make_response(
                        jsonify({'fail': 'Options Table Version Error.'}), 400)
        except Exception as e:
            return make_response(
                jsonify({'fail': 'Options Database Error: {}'.format(e)}), 500)

        webauthn_options.set(json.loads(options.option_content))
        options_dict = webauthn_options.get()
    except Exception as e:
        app.logger.debug('Options failed. Error: {}'.format(e))
        return make_response(
            jsonify({'fail': 'Options failed. Error: {}'.format(e)}), 500)

    return make_response(jsonify(options_dict), 200)
Example #2
0
    def runTest(self, scenario):
        options = Options()
        options.setTest(True)

        core = Felt(options, scenario)
        result = core.run()

        self.assertEqual(1, len(result))

        return result[0]
Example #3
0
 def save_options_to_db(self):
   try:
     transaction.begin()
     Options.reset()
     dbsession = DBSession()
     options = Options(self.options['timeon'], self.options['timeoff'], self.options['speed'])
     dbsession.add(options)
     dbsession.commit()
     transaction.commit()
     return True
   except:
     return False
Example #4
0
def api_polls():

    if request.method == 'POST':

        #Get poll and save in the database
        poll = request.get_json()

        for key, value in poll.items():
            if not value:
                return jsonify(
                    {'message': 'value for {} is empty'.format(key)})

        title = poll['title']
        options_query = lambda option: Options.query.filter(
            Options.name.like(option))
        options = [
            Polls(option=Options(
                name=option)) if options_query(option).count() == 0 else Polls(
                    option=options_query(option).first())
            for option in poll['options']
        ]

        new_topic = Topics(title=title, options=options)

        db.session.add(new_topic)
        db.session.commit()

        return jsonify({'message': 'Poll was successfully created!'})

    else:
        #Query the database and return all polls as JSON objects
        polls = Topics.query.join(Polls).order_by(Topics.id.desc()).all()
        all_polls = {'Polls': [poll.to_json() for poll in polls]}

        return jsonify(all_polls)
Example #5
0
def api_polls():
    if request.method == 'POST':
        # get the poll and save it in the database
        poll = request.get_json()

        # simple validation to check if all values are properly secret
        for key, value in poll.items():
            if not value:
                return jsonify({'error': 'value for {} is empty'.format(key)})

        title = poll['title']
        options_query = lambda option: \
            Options.query.filter(Options.name.like(option))

        options = [
            Polls(option=Options(
                name=option)) if options_query(option).count() == 0 else Polls(
                    option=options_query(option).first())
            for option in poll['options']
        ]

        new_topic = Topics(title=title, options=options)

        db.session.add(new_topic)
        db.session.commit()

        return jsonify({'message': 'Poll was created succesfully'})

    else:
        # it's a GET request, return dict representations of the API
        polls = Topics.query.join(Polls).all()
        all_polls = {'Polls': [poll.to_json() for poll in polls]}

        return jsonify(all_polls)
Example #6
0
def assertion_get_options():
    username = request.form.get('username')

    if 'challenge' in session:
        del session['challenge']
    challenge = util.generate_challenge(32)
    session['challenge'] = challenge

    webauthn_options = webauthn.WebAuthnOptions()

    try:
        options = Options.query.filter_by(rp_id=RP_ID).first()
        if options is None:
            options = Options()
            options.rp_id = RP_ID
            options.version = CURRENT_OPTIONS_TBL_VERSION
            options.option_content = json.dumps(webauthn_options.get())
            db.session.add(options)
            db.session.commit()
        else:
            if options.version != CURRENT_OPTIONS_TBL_VERSION:
                return make_response(
                    jsonify({'fail': 'Options Table Version Error.'}), 400)
    except Exception as e:
        return make_response(
            jsonify({'fail': 'Options Database Error: {}'.format(e)}), 500)

    webauthn_options.set(json.loads(options.option_content))

    allow_credentialids = []
    if username != '' or (
            webauthn_options.enableAssertionAllowCredentials == 'true'
            and len(webauthn_options.assertionAllowCredentialsUsers) != 0):
        if username != '':
            users = Users.query.filter_by(username=username).all()
        else:
            users = Users.query.filter(
                Users.id.in_(
                    webauthn_options.assertionAllowCredentialsUsers)).all()
        for user in users:
            allow_credentialids.append(user.credential_id)

    webauthn_assertion_options = webauthn.WebAuthnAssertionOptions(
        webauthn_options, allow_credentialids, challenge, RP_ID)

    return make_response(jsonify(webauthn_assertion_options.assertion_dict),
                         200)
Example #7
0
def new_poll(request):
    if request.method == "POST":
        option_list = request.POST.getlist('option[]')
        error = []
        options = []
        error2 = []
        if len(option_list) > 10:
            error2.append(u'Слишком много вариантов, хакир')
        if len(option_list) < 2:
            error2.append(u'Слишком мало вариантов, хакир')
        print len(option_list)
        print len(error2)
        for key, value in enumerate(option_list):
            if len(value) < 2 or len(value) > 15:
                error.append(key)
            options.append([key, value])
        if len(error) > 0 or len(error2) > 0:
            c = Context({
                'user': request.user,
                'head_menu': 'vote_new',
                'error': error,
                'error2': error2,
                'options': options,
                'post': 1,
                'poll_name': request.POST.get('poll_name')
            })
            c.update(csrf(request))
            return render_to_response('new_poll.html', c)
        else:
            poll = Polls()
            poll.user = request.user
            poll.name = request.POST.get('poll_name')
            poll.save()

            last_id = Polls.objects.latest('id')

            for key, value in options:
                option = Options()
                option.poll = last_id
                option.name = value
                option.count = 0
                option.save()
                cache.delete('all_polls')
            return HttpResponseRedirect('/poll/%s/' % (last_id.id))
    else:
        options = []
        [options.append(i) for i in xrange(1, 6)]
        c = Context({
            'user': request.user,
            'head_menu': 'vote_new',
            'options': options
        })
        c.update(csrf(request))
        return render_to_response('new_poll.html', c)
Example #8
0
 def init_datastore(self):
   i = 0
   for item in Texts.get_items():
     d = {
             'text': str(item.text),
             'color': str(item.color),
             'effect': item.effects.effect,
             'effect_time': item.effect_time
         }
     self.items[i] = d
     i+=1
   
   options_obj = Options.get_options()
   self.options['timeon'] = options_obj.timeon
   self.options['timeoff'] = options_obj.timeoff
   self.options['speed'] = options_obj.speed
Example #9
0
def api_polls():
    if request.method == 'POST':
        # get the poll and save it in the database
        poll = request.get_json()

        # simple validation to check if all values are properly set
        for key, value in poll.items():
            if not value:
                return jsonify(
                    {'message': 'value for {} is empty'.format(key)})

        title = poll['title']

        # return option that matches a given name
        def options_query(option):
            return Options.query.filter(Options.name.like(option))

        options = [
            Polls(option=Options(
                name=option)) if options_query(option).count() == 0 else Polls(
                    option=options_query(option).first())
            for option in poll['options']
        ]

        eta = datetime.utcfromtimestamp(poll['close_date'])
        new_topic = Topics(title=title, options=options, close_date=eta)

        db.session.add(new_topic)
        db.session.commit()

        # run the task
        from tasks import close_poll

        close_poll.apply_async((new_topic.id, env['SQLALCHEMY_DATABASE_URI']),
                               eta=eta)

        return jsonify({'message': 'Poll was created succesfully'})

    else:
        # it's a GET request, return dict representations of the API
        polls = Topics.query.filter_by(status=True).join(Polls)\
                .order_by(Topics.id.desc()).all()

        all_polls = {'Polls': [poll.to_json() for poll in polls]}

        return jsonify(all_polls)
Example #10
0
def api_polls():
    if request.method == 'POST':
        poll = request.get_json()
        for key, value in poll.items():
            if not value:
                return jsonify({"message": "ERROR: value for {} is empty".format(key)})
        title = poll['title']
        options_query = lambda option : Options.query.filter(Options.name.like(option))
        options = [Polls(option=Options(name=option)) if options_query(option)==0 else Polls(option=options_query(option).first()) for option in poll['options']]
        new_topic = Topics(title=title, options=options)

        db.session.add(new_topic)
        db.session.commit()
        return jsonify({'message':'Poll was created successfuly'})
    else:
        polls = Topics.query.join(Polls).all()
        all_polls = {'Polls': [poll.to_json() for poll in polls]}
        return jsonify(all_polls)
Example #11
0
def add_option():
    new_option = request.args.get('new_option', type=str)
    topic_id = request.args.get('topic_id', type=str)
    topic = Topics.query.filter_by(title=topic_id).first()

    option_temp = Options(new_option)
    db.session.add(option_temp)
    db.session.commit()
    poll_temp = Polls(topic.id, option_temp.id)
    db.session.add(poll_temp)
    db.session.commit()
    
    all_options = Polls.query.filter_by(topic_id=topic.id).all()
    ret_options = {}
    for i in all_options:
        ret_options["id"] = i.id
        ret_options["name"] = i.option.name

    return jsonify(result=ret_options)
Example #12
0
def api_polls():
    if request.method == 'POST':
        # get the poll and save it in the database
        poll = request.get_json()

        # simple validation to check if all values are properly secret
        for key, value in poll.items():
            if not value:
                return jsonify(
                    {'message': 'value for {} is empty'.format(key)})
        title = poll['title']
        options_query = lambda option: Options.query.filter(
            Options.name.like(option))
        """The list comprehension reads as follows Make a Poll object out of an option if that option doesn’t exist 
        in the database (count == 0), if exists in the database (else) then get that option and make a Poll object 
        from it. """
        options = [
            Polls(option=Options(
                name=option)) if options_query(option).count() == 0 else Polls(
                    option=options_query(option).first())
            for option in poll['options']
        ]

        eta = datetime.utcfromtimestamp(poll['close_date'])
        new_topic = Topics(title=title, options=options, close_date=eta)

        db.session.add(new_topic)
        db.session.commit()

        # run the task
        from tasks import close_poll
        close_poll.apply_async((new_topic.id, ), eta=eta)

        return jsonify({'message': 'Poll was created successfully'})

    else:
        # it's a GET request, return dict representations of the API
        polls = Topics.query.filter_by(status=True).join(Polls).order_by(
            Topics.id.desc()).all()
        all_polls = {'Polls': [poll.to_json() for poll in polls]}

        return jsonify(all_polls)
Example #13
0
def api_polls():
    if request.method == "POST":
        # get the poll and save it in the database
        poll = request.get_json()

        # simple validation to check if all values are properly secret
        for key, value in poll.items():
            if not value:
                return jsonify(
                    {"message": "value for {} is empty".format(key)})

        title = poll["title"]
        options_query = lambda option: Options.query.filter(
            Options.name.like(option))

        options = [
            Polls(option=Options(
                name=option)) if options_query(option).count() == 0 else Polls(
                    option=options_query(option).first())
            for option in poll["options"]
        ]

        new_topic = Topics(title=title, options=options)

        db.session.add(new_topic)
        db.session.commit()

        # run the task
        from tasks import close_poll

        eta = datetime.utcfromtimestamp(poll['close_date'])
        close_poll.apply_async((new_topic.id), eta=eta)

        return jsonify({"message": "Poll was created succesfully"})

    else:
        # it's a GET request, return dict representations of the API
        polls = (Topics.query.filter_by(status=1).join(Polls).order_by(
            Topics.id.desc()).all())
        all_polls = {"Polls": [poll.to_json() for poll in polls]}

        return jsonify(all_polls)
Example #14
0
def api_polls():
    if request.method == 'POST':

        poll = request.get_json()

        for key, value in poll.items():
            if not value:
                return jsonify({'message': 'vacia'.format(key)})

        title = poll['title']
        options_query = lambda option: Options.query.filter(
            Options.name.like(option))

        options = [
            Polls(option=Options(
                name=option)) if options_query(option).count() == 0 else Polls(
                    option=options_query(option).first())
            for option in poll['txtOptions']
        ]

        try:
            new_topic = Topics(title=title, options=options)
            db.session.add(new_topic)
            db.session.commit()
        except exc.SQLAlchemyError:
            db.session.rollback()
            return jsonify({
                'message':
                'Existe un problema con nuestra base de datos, favor de intentarlo mas tarde'
            })
            raise
        finally:
            return jsonify({'message': 'Encuesta creada correctamente'})

    else:

        polls = Topics.query.join(Polls).all()
        all_polls = {'Polls': [poll.to_json() for poll in polls]}

        return jsonify(all_polls)
Example #15
0
def main(args):
    """Main function.

    The main function parses the command line arguments, reads the input file
    and inits the generator.
    """
    # Parse arguments
    parser = argparse.ArgumentParser(description='Start workload.')
    parser.add_argument('--debug', action='store_true',
                        help="enable debug information")
    parser.add_argument('--verbose', action='store_true',
                        help="makes generator more verbose")
    parser.add_argument('--threads', type=int,
                        default=Options.DEFAULT_THREADS,
                        help="number of threads to run simultaneously")
    parser.add_argument('--test', action='store_true',
                        help="run a scenario only once")
    parser.add_argument('--slimerjs', action='store_true',
                        help="use slimerjs instead of phantomjs")
    parser.add_argument('--screenshot', action='store_true',
                        help="provide screenshots after each step")
    parser.add_argument('--user-agent', type=str, dest='userAgent',
                        help="provide a custom User-Agent")
    parser.add_argument('--max-time', type=int,
                        default=Options.DEFAULT_MAXTIME, dest='maxTime',
                        help="provide a maximum runtime")
    parser.add_argument('scenario')
    args = parser.parse_args()

    # Check if scenario exists
    if not os.path.isfile(args.scenario):
        print "scenario '%s' not found" % args.scenario
        return

    # Load from file and parse
    with open(args.scenario, 'r') as content_file:
        content = content_file.read()
    scenario = commentjson.loads(content)

    # Load in scenario
    scenario = Scenario(scenario)

    # Parse options
    options = Options()

    # Which browser are we using
    if args.slimerjs:
        options.setBrowser('slimerjs')

    # Threads option
    options.setThreads(args.threads)

    # Test option
    options.setTest(args.test)

    # Output information
    options.setVerbose(args.verbose)

    # Debug mode
    options.setDebug(args.debug)

    # Screenshot mode
    options.setScreenshot(args.screenshot)

    # User agent
    options.setUserAgent(args.userAgent)

    # Create watchdog thread
    options.setMaximumExectionTime(args.maxTime)

    # Create new Felt class
    felt = Felt(options, scenario)

    # Start worker
    felt.run()
Example #16
0
def api_polls():
    if request.method == 'POST':

        # get the poll and save it in the database
        poll = request.get_json()

        # simple validation to check if all values are properly set
        for key, value in poll.items():
            if not value:
                return jsonify(
                    {'message': 'value for {} is empty'.format(key)})

        title = poll['title']
        batch = poll['batch']
        options_query = lambda option: Options.query.filter(
            Options.name.like(option))

        options = [
            Polls(option=Options(
                name=option)) if options_query(option).count() == 0 else Polls(
                    option=options_query(option).first())
            for option in poll['options']
        ]
        eta = datetime.utcfromtimestamp(poll['close_date'])
        new_topic = Topics(title=title,
                           poll_group=batch,
                           options=options,
                           close_date=eta)
        #poll_group = Polls()
        #db.session.add(poll_group)
        db.session.add(new_topic)
        db.session.commit()

        # run the task
        from tasks import close_poll

        close_poll.apply_async((new_topic.id, SQLALCHEMY_DATABASE_URI),
                               eta=eta)

        return jsonify({'message': 'Poll was created succesfully'})

    else:
        # it's a GET request, return dict representations of the API
        user = session['user']
        # print('User:'******'NFKD', user).encode('ascii','ignore')
        # print('UpdatedUser:'******'User Info: ', user_info)
        # user_type = unicodedata.normalize('NFKD', user_info.user_group).encode('ascii','ignore')
        user_type = user_info.user_group

        polls = Topics.query.filter_by(
            status=True,
            poll_group=user_type).join(Polls).order_by(Topics.id.desc()).all()
        all_polls = Topics.query.filter_by(
            status=True,
            poll_group='all').join(Polls).order_by(Topics.id.desc()).all()
        for x in all_polls:
            polls.append(x)
        print(type(polls))
        all_polls = {'Polls': [poll.to_json() for poll in polls]}

        return jsonify(all_polls)
Example #17
0
from app import db, app

db.app = app
db.init_app(app)
db.create_all()
from models import Options, Topics, Polls

topic = Topics(title='Which side is going to win the EPL this season')
arsenal = Options(name='Arsenal')
spurs = Options(name='Spurs')
poll = Polls(topic=topic, option=arsenal)
poll1 = Polls(topic=topic, option=spurs)
db.session.add(topic)
db.session.commit()
city = Options(name='Manchester city')
liverpool = Options(name='Liverpool FC')
liverpool = Polls(option=liverpool)
city = Polls(option=city)
new_topic = Topics(title='Whos better liverpool or city', options=[liverpool, city])
db.session.add(new_topic)
db.session.commit()
Example #18
0
def attestation_get_options():
    username = request.form.get('username')
    display_name = request.form.get('displayName')

    if 'register_ukey' in session:
        del session['register_ukey']
    if 'register_username' in session:
        del session['register_username']
    if 'register_display_name' in session:
        del session['register_display_name']
    if 'challenge' in session:
        del session['challenge']
    if 'att_option' in session:
        del session['att_option']

    if username == "" or username is None:
        username = util.random_username(8)
    if display_name == "" or display_name is None:
        display_name = username

    session['register_username'] = username
    session['register_display_name'] = display_name

    rp_name = RP_ID
    challenge = util.generate_challenge(32)
    ukey = util.generate_ukey()

    session['challenge'] = challenge
    session['register_ukey'] = ukey

    exclude_credentialids = []

    webauthn_options = webauthn.WebAuthnOptions()

    try:
        options = Options.query.filter_by(rp_id=RP_ID).first()
        if options is None:
            options = Options()
            options.rp_id = RP_ID
            options.version = CURRENT_OPTIONS_TBL_VERSION
            options.option_content = json.dumps(webauthn_options.get())
            db.session.add(options)
            db.session.commit()
        else:
            if options.version != CURRENT_OPTIONS_TBL_VERSION:
                return make_response(
                    jsonify({'fail': 'Options Table Version Error.'}), 400)
    except Exception as e:
        return make_response(
            jsonify({'fail': 'Options Database Error: {}'.format(e)}), 500)

    webauthn_options.set(json.loads(options.option_content))

    if webauthn_options.enableAttestationExcludeCredentials == 'true' and len(
            webauthn_options.attestationExcludeCredentialsUsers):
        users = Users.query.filter(
            Users.id.in_(
                webauthn_options.attestationExcludeCredentialsUsers)).all()
        for user in users:
            if not user.credential_id:
                app.logger.debug('Unknown credential ID.')
                return make_response(
                    jsonify({'fail': 'Unknown credential ID.'}), 401)
            exclude_credentialids.append(str(user.credential_id))

    make_credential_options = webauthn.WebAuthnMakeCredentialOptions(
        webauthn_options, exclude_credentialids, challenge, rp_name, RP_ID,
        ukey, username, display_name, 'https://example.com')

    reg_dict = json.dumps(make_credential_options.registration_dict, indent=2)
    session['att_option'] = reg_dict

    return make_response(jsonify(make_credential_options.registration_dict),
                         200)
Example #19
0
api = Blueprint('api', 'api', url_prefix='/api')

@api.route('/polls', methods=['GET', 'POST'])
# retrieves/adds polls from/to the database 
def api_polls():
    if request.method == 'POST':
        # get the poll and save it in the database        
     poll = request.get_json()
        # simple validation to check if all values are properly secret        
     for key, value in poll.items():
            if not value:
                return jsonify({'message': 'value for {} is empty'.format(key)})
            title = poll['title']
            options_query = lambda option:Options.query.filter(Options.name.like(option))
options = [Polls(option=Options(name=option))
            if options_query(option).count() == 0
            else 
                Polls(option=options_query(option).first()) 
                for option in poll['options']
                ]
new_topic = Topics(title=title, options=options)
db.session.add(new_topic)
db.session.commit()
return jsonify({'message': 'Poll was created succesfully'})
else:
        # it's a GET request, return dict representations of the API         
polls = Topics.query.filter_by(status=1).join(Polls).order_by(Topics.id.desc()).all()
all_polls = {'Polls':  [poll.to_json() for poll in polls]}
return jsonify(all_polls)
Example #20
0
def set_options():

    conveyancePreference = request.form.get('conveyancePreference')
    userVerification = request.form.get('userVerification')
    requireResidentKey = request.form.get('requireResidentKey')
    authenticatorAttachment = request.form.get('authenticatorAttachment')
    enableAttestationExcludeCredentials = request.form.get(
        'enableAttestationExcludeCredentials')
    attestationExcludeCredentialsUsers = request.form.get(
        'attestationExcludeCredentialsUsers')
    attestationExcludeCredentialsTransports = request.form.get(
        'attestationExcludeCredentialsTransports')
    attestationExtensions = request.form.get('attestationExtensions', None)
    enableAssertionAllowCredentials = request.form.get(
        'enableAssertionAllowCredentials')
    assertionAllowCredentialsUsers = request.form.get(
        'assertionAllowCredentialsUsers')
    assertionAllowCredentialsTransports = request.form.get(
        'assertionAllowCredentialsTransports')
    assertionExtensions = request.form.get('assertionExtensions', None)

    try:
        webauthn_options = webauthn.WebAuthnOptions()

        try:
            options = Options.query.filter_by(rp_id=RP_ID).first()
            if options is None:
                options = Options()
                options.rp_id = RP_ID
                options.version = CURRENT_OPTIONS_TBL_VERSION
                options.option_content = json.dumps(webauthn_options.get())
                db.session.add(options)
                db.session.commit()
            else:
                if options.version != CURRENT_OPTIONS_TBL_VERSION:
                    return make_response(
                        jsonify({'fail': 'Options Table Version Error.'}), 400)
        except Exception as e:
            return make_response(
                jsonify({'fail': 'Options Database Error: {}'.format(e)}), 500)

        webauthn_options.set(json.loads(options.option_content))

        if conveyancePreference in webauthn.WebAuthnOptions.SUPPORTED_CONVEYANCE_PREFARENCE:
            webauthn_options.conveyancePreference = conveyancePreference
        else:
            return make_response(
                jsonify(
                    {'fail':
                     'Option Selection Error (conveyancePreference).'}), 400)
        if userVerification in webauthn.WebAuthnOptions.SUPPORTED_AUTHENTICATIONSELECTION_USERVERIFICATION:
            webauthn_options.userVerification = userVerification
        else:
            return make_response(
                jsonify({'fail':
                         'Option Selection Error (userVerification).'}), 400)
        if requireResidentKey in webauthn.WebAuthnOptions.SUPPORTED_REQUIRE_REDIDENTKEY:
            webauthn_options.requireResidentKey = requireResidentKey
        else:
            return make_response(
                jsonify(
                    {'fail': 'Option Selection Error (requireResidentKey).'}),
                400)
        if authenticatorAttachment in webauthn.WebAuthnOptions.SUPPORTED_AUTHENTICATIONSELECTION_ATTACHIMENT or authenticatorAttachment == '':
            webauthn_options.authenticatorAttachment = authenticatorAttachment
        else:
            return make_response(
                jsonify({
                    'fail':
                    'Option Selection Error (authenticatorAttachment).'
                }), 400)
        if enableAttestationExcludeCredentials in webauthn.WebAuthnOptions.SUPPORTED_ENABLE_CREDENTIALS:
            webauthn_options.enableAttestationExcludeCredentials = enableAttestationExcludeCredentials
        else:
            return make_response(
                jsonify({
                    'fail':
                    'Option Selection Error (enableAttestationExcludeCredentials).'
                }), 400)
        if re.sub(r'\d', '',
                  re.sub(r'\s', '', attestationExcludeCredentialsUsers)) == '':
            webauthn_options.attestationExcludeCredentialsUsers = attestationExcludeCredentialsUsers.split(
                ' ')
        else:
            return make_response(
                jsonify({
                    'fail':
                    'Option Selection Error (attestationExcludeCredentialsUsers).'
                }), 400)
        if set(attestationExcludeCredentialsTransports.split(' ')).issubset(
                webauthn.WebAuthnOptions.SUPPORTED_TRANSPORTS
        ) or attestationExcludeCredentialsTransports == '':
            webauthn_options.attestationExcludeCredentialsTransports = attestationExcludeCredentialsTransports.split(
                ' ')
        else:
            return make_response(
                jsonify({
                    'fail':
                    'Option Selection Error (attestationExcludeCredentialsTransports).'
                }), 400)
        if attestationExtensions is not None:
            tmp_dict = {}
            for lineitem in attestationExtensions.splitlines():
                item = [x.strip() for x in lineitem.split('=')]
                if len(item) == 2:
                    tmp_dict[item[0]] = item[1]
            if len(tmp_dict) == len(attestationExtensions.splitlines()):
                webauthn_options.attestationExtensions = tmp_dict
            else:
                return make_response(
                    jsonify({
                        'fail':
                        'Option Format Error (attestationExtensions).'
                    }), 400)
        if enableAssertionAllowCredentials in webauthn.WebAuthnOptions.SUPPORTED_ENABLE_CREDENTIALS:
            webauthn_options.enableAssertionAllowCredentials = enableAssertionAllowCredentials
        else:
            return make_response(
                jsonify({
                    'fail':
                    'Option Selection Error (enableAssertionAllowCredentials).'
                }), 400)
        if re.sub(r'\d', '', re.sub(r'\s', '',
                                    assertionAllowCredentialsUsers)) == '':
            webauthn_options.assertionAllowCredentialsUsers = assertionAllowCredentialsUsers.split(
                ' ')
        else:
            return make_response(
                jsonify({
                    'fail':
                    'Option Selection Error (assertionAllowCredentialsUsers).'
                }), 400)
        if set(assertionAllowCredentialsTransports.split(' ')).issubset(
                webauthn.WebAuthnOptions.SUPPORTED_TRANSPORTS
        ) or assertionAllowCredentialsTransports == '':
            webauthn_options.assertionAllowCredentialsTransports = assertionAllowCredentialsTransports.split(
                ' ')
        else:
            return make_response(
                jsonify({
                    'fail':
                    'Option Selection Error (assertionAllowCredentialsTransports).'
                }), 400)
        if assertionExtensions is not None:
            tmp_dict = {}
            for lineitem in assertionExtensions.splitlines():
                item = [x.strip() for x in lineitem.split('=')]
                if len(item) == 2:
                    tmp_dict[item[0]] = item[1]
            if len(tmp_dict) == len(assertionExtensions.splitlines()):
                webauthn_options.assertionExtensions = tmp_dict
            else:
                return make_response(
                    jsonify(
                        {'fail':
                         'Option Format Error (assertionExtensions).'}), 400)

    except Exception as e:
        app.logger.debug('Options failed. Error: {}'.format(e))
        return make_response(
            jsonify({'fail': 'Options failed. Error: {}'.format(e)}), 500)

    try:
        options.option_content = json.dumps(webauthn_options.get())
        db.session.add(options)
        db.session.commit()
    except Exception as e:
        return make_response(
            jsonify({'fail': 'Options Database Error: {}'.format(e)}), 500)

    return make_response(jsonify({'success': 'Options successfully saved.'}),
                         200)