Paas-Word authentication for Django
Paas-Word Django Authentication Middleware
Paas-Word is an online authentication and user management service. This Python Django middleware by Paas-Word enables website owners with a Django backend to restrict their endpoints to authenticated users only and retrieve user data.
- Create a free account at Paas-Word website.
- Recieve a login, sign-up, account and forgot-password pages for your website based on the user attributes you set up.
- Set the callback pages on your website where users will be redirected after they sign-up and log in.
- Once a user is redirected to your website with a token, send this token to your backend in the "x-auth-token" header.
pip3 install paasword
Add "paasword" to settings.py :
INSTALLED_APPS = [ ... 'paasword', ]
Set Private Key as Environment Variable
Create an app on Paas-Word and then set its Private Key as an environment variable on your server.
Gaurd all endpoints
Add middleware to settings.py :
MIDDLEWARE = [ ... 'paasword.middleware.Authenticate', ]
Gaurd spesific routes against unauthenticated users
Remove comment from middleware.py. As an example:
if request.path.startswith('/snippets/'): return self.get_response(request)
Retrieve user information
def snippet_list(request): if request.method == 'GET': print (request.user) snippets = Snippet.getAll() return JsonResponse(snippets, safe=False)
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash SHA256 hash help||File type||Python version||Upload date|
|paasword-1.0.1-py3-none-any.whl (3.9 kB) Copy SHA256 hash SHA256||Wheel||py3|
|paasword-1.0.1.tar.gz (3.5 kB) Copy SHA256 hash SHA256||Source||None|