CKAN Authentication using Email as primary identifier including username
ckanext-emailauth allows you to:
- Enable registration / login via email or username
- Do email verification based on any SMTP server as per configuration you provide
- Ability to store extra user information as key value pair in user_extra table
- Reset password via email verification link with link expiry
Supports Python 2.7 and Python 3.8, tested with CKAN 2.8.4 / CKAN 2.9.1
To install ckanext-emailauth:
Activate your CKAN virtual environment, for example:
. /usr/lib/ckan/default/bin/activate
Clone repository and install the ckanext-emailauth requirements first by:
pip install -r requirements.txt
Install extension into your virtual environment:
python setup.py install
Add
emailauth
to theckan.plugins
setting in your CKAN config file (by default the config file is located at/etc/ckan/default/production.ini
).Follow configuration step below to add necessary details and then do Database Initialization
Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:
sudo service apache2 reload
ckanext-emailauth has few custom configuration which is required before running:
[email protected] ckan.mail.secret=password [email protected] # Optional password.reset_key.expiry_hours=4
ckanext-emailauth requires two custom table which needs to be initialized. Change directory inside ckanext-emailauth
:
If you are using CKAN 2.8 or less:
paster user_validation initdb -c /path/to/development.ini paster user_extra initdb -c /path/to/development.ini
For CKAN 2.9 or greater:
ckan -c /path/to/ckan.ini user_validation initdb ckan -c /path/tp/ckan.ini user_extra initdb
In your who.ini
(usually in /usr/lib/ckan/ckan-env/src/ckan/who.ini
) file add custom authenticator as:
[authenticators] plugins = auth_tkt ckanext.emailauth.authenticator:EmailAuthenticator
This will enable EmailAuthenticator during all authenticator process, it allows you to do authentication both via username and if username is not found, then it will search for email
To install ckanext-emailauth for development, activate your CKAN virtualenv and do:
git clone https://github.com/justicehub-in/ckanext-emailauth.git cd ckanext-emailauth python setup.py develop
Right now it's mostly focused on being by ckanext-justicehub_theme
and it's hard to generalize it for normal usage.
Few challenges are:
- Popup based authentication responses
- Schema is fixed right now but it should be configurable
- Templates are hardcoded based on theme usage