Authentication
sqladmin.authentication.AuthenticationBackend
基类:AuthenticationBackend
用于在 SQLAdmin 中实现身份验证。你需要继承此类并重写以下方法:login、logout 和 authenticate。
方法:
__init__(secret_key)构造函数,接受secret_key参数。authenticate(request) async在此处实现身份验证逻辑。该方法会在每个传入请求时被调用,以验证用户的身份。 如果返回的是Response或RedirectResponse,该响应将返回给用户;否则,方法应返回True或False。login(request) async在此处实现登录逻辑。你可以通过await request.form()访问登录表单数据并验证用户凭证。logout(request) async在此处实现注销逻辑。通常这将清除会话数据,执行request.session.clear()。
最后更新于