authentication via django-mellon example added

This commit is contained in:
Serghei Mihai 2014-11-20 18:13:43 +01:00
parent bdd7984dfa
commit 10e8bff81c
3 changed files with 35 additions and 0 deletions

View File

@ -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'},
# ]

View File

@ -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]}'

View File

@ -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