A custom GeoKey extension for WeGovNow functionality.
geokey-wegovnow requires:
- Python version 2.7
- GeoKey version 1.3 or greater
Install django-allauth-uwum:
pip install git+https://github.com/ExCiteS/django-allauth-uwum.git
Install geokey-wegovnow:
pip install git+https://github.com/ExCiteS/geokey-wegovnow.git
Add both packages to the installed apps (together with Material Design package):
INSTALLED_APPS += (
'material',
'allauth_uwum',
'geokey_wegovnow',
)
Configure django-allauth-uwum using the official documentation.
Add the custom UWUM middleware for requests and responses:
MIDDLEWARE_CLASSES += (
'geokey_wegovnow.middleware.UWUMMiddleware',
)
Extend OAuth2 provider settings by setting a custom UWUM validator class:
OAUTH2_PROVIDER['OAUTH2_VALIDATOR_CLASS'] = 'geokey_wegovnow.validators.UWUMOAuth2Validator'
Extend template loaders with a custom WeGovNow Material:
TEMPLATES[0]['OPTIONS']['loaders'][:0] = ['geokey_wegovnow.templates.MaterialLoader']
Or a custom WeGovNow Bootstrap:
TEMPLATES[0]['OPTIONS']['loaders'][:0] = ['geokey_wegovnow.templates.BootstrapLoader']
Change default social acccount adapter to UWUM:
SOCIALACCOUNT_ADAPTER = 'geokey_wegovnow.adapters.UWUMSocialAccountAdapter'
Set option that UWUM users would be automatically signed up:
SOCIALACCOUNT_AUTO_SIGNUP = True
Add UWUM provider settings (change URL accordingly):
SOCIALACCOUNT_PROVIDERS = {
'uwum': {
'CERT': join(dirname(abspath(__file__)), 'uwum.pem'),
'REGULAR_URL': 'https://wegovnow.liquidfeedback.com',
'CERT_URL': 'https://wegovnow-cert.liquidfeedback.com',
'API_VERSION': 1,
},
}
SOCIALACCOUNT_PROVIDERS['uwum']['NAVIGATION_URL'] = '%s/api/%s/navigation' % (
SOCIALACCOUNT_PROVIDERS.get('uwum', {}).get('REGULAR_URL').rstrip('/'),
SOCIALACCOUNT_PROVIDERS.get('uwum', {}).get('API_VERSION'),
)
SOCIALACCOUNT_PROVIDERS['uwum']['SETTINGS_URL'] = '%s/member/settings.html' % (
SOCIALACCOUNT_PROVIDERS.get('uwum', {}).get('REGULAR_URL').rstrip('/')
)
Add OnToMap logger settings (change URL accordingly):
ONTOMAP_URLS = {
'BASE_URL': 'https://api.ontomap.eu',
'API_VERSION': 1,
}
ONTOMAP_URLS['EVENTS_URL'] = '%s/api/v%s/logger/events' % (
ONTOMAP_URLS.get('BASE_URL').rstrip('/'),
ONTOMAP_URLS.get('API_VERSION'),
)
ONTOMAP_URLS['MAPPINGS_URL'] = '%s/api/v%s/logger/mappings' % (
ONTOMAP_URLS.get('BASE_URL').rstrip('/'),
ONTOMAP_URLS.get('API_VERSION'),
)
Change default GeoKey redirects:
LOGIN_REDIRECT_URL = SOCIALACCOUNT_PROVIDERS['uwum']['SETTINGS_URL']
ACCOUNT_EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL = SOCIALACCOUNT_PROVIDERS['uwum']['SETTINGS_URL']
After all GeoKey migrations are initiated, add the UWUM app (client ID must be the one registered by the UWUM Certificate Authority):
python manage.py add_uwum_app --id='<client_id>'
Sign up with UWUM account and note your screen name (not login name!) and email address, then use those details to set yourself as a superuser:
python manage.py set_superuser --username='<your_username>' --email='<your_email>'
You're now ready to go!
Update geokey-wegovnow:
pip install -U git+https://github.com/ExCiteS/geokey-wegovnow.git
Run tests:
python manage.py test geokey_wegovnow
Check code coverage:
coverage run --source=geokey_wegovnow manage.py test geokey_wegovnow
coverage report -m --omit=*/tests/*,*/migrations/*