Skip to content

Latest commit

 

History

History
40 lines (23 loc) · 1.01 KB

password_verification.md

File metadata and controls

40 lines (23 loc) · 1.01 KB

Password verification

The library does not provide own solution to check user passwords but accepts any class that implements PasswordVerifier protocol in places where it needs to check the password.

You also can use passlib as is with this library.

The password gets verified in login/logout flow and by HTTP Basic Authenticator.

Using passlib

Install passlib before using it

from passlib.hash import pbkdf2_sha1

from imia import LoginManager

login_manager = LoginManager(password_verifier=pbkdf2_sha1, ...)

Writing custom verifiers

A custom verifier is a class that has verify(plan, hashed) -> bool method.

from imia import LoginManager


class MyPasswordVerifier:
    def verify(self, plain: str, hashed: str) -> bool:
        return hashed == plain


login_manager = LoginManager(password_verifier=MyPasswordVerifier(), ...)

Next topic

Proceed to login/logout flow