rename webauthn auth functions

_complete_webauthn_authentication -> _verify_webauthn_authentication

This function just does verification of the actual auth process -
checking the challenge is correct, the signature matches the public key
we have stored in our database, etc.

verify_webauthn_login -> _complete_webauthn_login_attempt

This function doesn't do any actual verification, we've already verified
the user is who they say they are (or not), it's about marking the
attempt, either unsuccessful (we bump the failed_login_count in the db)
or successful (we set the logged_in_at and current_session_id in the
db).

This change also informs changes to the names of methods on the user
model and in user_api_client.
This commit is contained in:
Leo Hemsted
2021-06-02 11:25:02 +01:00
parent 0ec92e8c2f
commit 73a444b33a
4 changed files with 30 additions and 20 deletions

View File

@@ -126,8 +126,9 @@ class UserApiClient(NotifyAdminAPIClient):
raise e
@cache.delete('user-{user_id}')
def verify_webauthn_login(self, user_id, is_successful):
def complete_webauthn_login_attempt(self, user_id, is_successful):
data = {'successful': is_successful}
# TODO: Change this to `/complete/webauthn-login`
endpoint = f'/user/{user_id}/verify/webauthn-login'
try:
self.post(endpoint, data=data)