fix hardcoded value

This commit is contained in:
tuxcoder 2023-12-25 19:55:29 +01:00
parent 368f2396ce
commit 789762dd51

View file

@ -198,7 +198,7 @@ async def login_auth() -> ResponseReturnValue:
@auth_views.route('/passkey/verify', methods=['POST']) @auth_views.route('/passkey/verify', methods=['POST'])
async def passkey_verify() -> ResponseReturnValue: async def passkey_verify() -> ResponseReturnValue:
secret_key = current_app.config['SECRET_KEY'] secret_key = current_app.config['SECRET_KEY']
public_url = current_app.config['PUBLIC_URL'] public_url = urlparse(current_app.config['PUBLIC_URL'])
data = request.get_json() data = request.get_json()
@ -218,14 +218,12 @@ async def passkey_verify() -> ResponseReturnValue:
result = webauthn.verify_authentication_response( result = webauthn.verify_authentication_response(
credential = credential, credential = credential,
expected_rp_id = "localhost", expected_rp_id = public_url.hostname,
expected_challenge = challenge, expected_challenge = challenge,
expected_origin = [ public_url ], expected_origin = [ public_url.geturl() ],
credential_public_key = passkey.credential_public_key, credential_public_key = passkey.credential_public_key,
credential_current_sign_count = passkey.sign_count, credential_current_sign_count = passkey.sign_count,
) )
logger.error(f"DEBUG: {passkey}")
logger.error(f"DEBUG: {result}")
passkey.sign_count = result.new_sign_count passkey.sign_count = result.new_sign_count
passkey.last_used = datetime.utcnow() passkey.last_used = datetime.utcnow()