diff --git a/config_example.py b/config_example.py index 60a08d3..c55129f 100644 --- a/config_example.py +++ b/config_example.py @@ -12,3 +12,22 @@ DATABASES = { 'NAME': 'db.sqlite3', } } + +## Django Mellon configuration +# you need to generate SSL certificates in your current directory to make it functionnal : +# +# openssl genpkey -algorithm rsa -pkeyopt rsa_keygen_bits:2048 -out key.cert +# openssl req -x509 -new -out cert.pem -subj '/CN=whocaresIdo' -key key.cert -days 3650 +# +# you also need to get the idp metadata and call it idp-metadata.xml +# Uncomment the following lines to enable SAML support +#INSTALLED_APPS += ('mellon',) +#AUTHENTICATION_BACKENDS = ( 'mellon.backends.SAMLBackend',) +#LOGIN_URL = 'mellon_login' +#LOGOUT_URL = 'mellon_logout' +#MELLON_PUBLIC_KEYS = ['cert.pem'] +#MELLON_PRIVATE_KEY = 'key.cert' +#MELLON_IDENTITY_PROVIDERS = [ +# {'METADATA': 'idp-metadata.xml', +# 'GROUP_ATTRIBUTE': 'role'}, +# ] diff --git a/hobo/default_settings.py b/hobo/default_settings.py index f74ebc6..92ec6bd 100644 --- a/hobo/default_settings.py +++ b/hobo/default_settings.py @@ -139,3 +139,18 @@ try: except ImportError: pass +LOGIN_REDIRECT_URL = '/' + +# mellon authentication params +MELLON_ATTRIBUTE_MAPPING = { + 'username': '{attributes[username][0]}', + 'email': '{attributes[email][0]}', + 'first_name': '{attributes[first_name][0]}', + 'last_name': '{attributes[last_name][0]}', +} + +MELLON_SUPERUSER_MAPPING = { + 'roles': 'Admin::Hobo', +} + +MELLON_USERNAME_TEMPLATE = '{attributes[username][0]}' diff --git a/requirements.txt b/requirements.txt index 6b99037..b6f85fe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ django<1.7 -e git+http://repos.entrouvert.org/gadjo.git/#egg=gadjo -e git+http://repos.entrouvert.org/django-allauth-authentic2.git/#egg=allauth_authentic2 celery +django-mellon