handling authentication through django-mellon

This commit is contained in:
Serghei Mihai 2015-01-13 23:53:38 +01:00
parent 8fd7999042
commit 700b2afb0a
2 changed files with 24 additions and 1 deletions

View File

@ -95,3 +95,16 @@ RSS_TITLE = 'Announces'
RSS_DESCRIPTION = ''
RSS_LINK = ''
RSS_LINK_TEMPLATE = '/#announce{0}'
# django-mellon settings
MELLON_ATTRIBUTE_MAPPING = {
'username': '{attributes[username][0]}',
'email': '{attributes[email][0]}',
'first_name': '{attributes[first_name][0]}',
'last_name': '{attributes[last_name][0]}',
}
if 'mellon' in INSTALLED_APPS:
AUTHENTICATION_BACKENDS = ('mellon.backends.SAMLBackend', )
LOGIN_URL = 'mellon_login'
LOGOUT_URL = 'mellon_logout'

View File

@ -15,9 +15,19 @@ urlpatterns = patterns('',
url(r'^manage/', decorated_includes(manager_required,
include(manage_urls))),
url(r'^ckeditor/', include('ckeditor.urls')),
url('^accounts/', include('django.contrib.auth.urls')),
url(r'^admin/', include(admin.site.urls))
)
if 'mellon' in settings.INSTALLED_APPS:
# authentication with django-mellon
urlpatterns += patterns('',
url(r'^accounts/mellon/', include('mellon.urls')),
)
else:
urlpatterns += patterns('',
url('^accounts/', include('django.contrib.auth.urls')),
)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += staticfiles_urlpatterns()