mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-10 09:17:48 +01:00
49 lines
1.3 KiB
Python
49 lines
1.3 KiB
Python
|
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
|