Skip to content
Commits on Source (2)
<div class="icnml_navigation">
</div>
...@@ -152,15 +152,24 @@ def do_validate_signin(): ...@@ -152,15 +152,24 @@ def do_validate_signin():
user_id = session[ "user_id" ] user_id = session[ "user_id" ]
key = config.db.query_fetchone( "SELECT * FROM webauthn WHERE user_id = %s AND usage_counter > 0 ORDER BY last_usage DESC LIMIT 1", ( user_id, ) ) key_list = config.db.query_fetchall( "SELECT * FROM webauthn WHERE user_id = %s AND active = true", ( user_id, ) )
webauthn_user = webauthn.WebAuthnUser( credential_id_list = []
key[ "ukey" ], session[ "username" ], session[ "username" ], None, for key in key_list:
key[ "credential_id" ], key[ "pub_key" ], key[ "sign_count" ], config.RP_ID credential_id_list.append( {
) "type": "public-key",
webauthn_assertion_options = webauthn.WebAuthnAssertionOptions( webauthn_user, challenge ) "id": key[ "credential_id" ],
assertion_dict = webauthn_assertion_options.assertion_dict "transports": [ "usb", "nfc", "ble", "internal" ]
assertion_dict[ "userVerification" ] = "discouraged" } )
current_app.logger.debug( "key '{}' added to the usable keys".format( key[ "credential_id" ] ) )
assertion_dict = {
"challenge": challenge,
"timeout": 60000,
"allowCredentials": credential_id_list,
"rpId": config.RP_ID,
"userVerification": "discouraged"
}
return jsonify( { return jsonify( {
"error": False, "error": False,
......