craftbeerpi4-pione/venv3/lib/python3.7/site-packages/aiohttp_auth/auth/abstract_auth.py

49 lines
1.3 KiB
Python
Raw Normal View History

2021-03-03 23:49:41 +01:00
import abc
class AbstractAuthentication(object):
"""Abstract authentication policy class"""
@abc.abstractmethod
async def remember(self, request, user_id):
"""Abstract function called to store the user_id for a request.
Args:
request: aiohttp Request object.
user_id: String representing the user_id to remember
"""
pass
@abc.abstractmethod
async def forget(self, request):
"""Abstract function called to forget the userid for a request
Args:
request: aiohttp Request object
"""
pass
@abc.abstractmethod
async def get(self, request):
"""Abstract function called to get the user_id for the request.
Args:
request: aiohttp Request object.
Returns:
The user_id for the request, or None if the user_id is not
authenticated.
"""
pass
async def process_response(self, request, response):
"""Called to perform any processing of the response required (setting
cookie data, etc).
Default implementation does nothing.
Args:
request: aiohttp Request object.
response: response object returned from the handled view
"""
pass