Commit baa68271 authored by Leonidas Poulopoulos's avatar Leonidas Poulopoulos
Browse files

Added Shibboleth attribute map. Added management dropdown in seperate...

Added Shibboleth attribute map. Added management dropdown in seperate template. Added accounts in urls.py.dist
parent c340e3ec
......@@ -977,16 +977,10 @@ def user_login(request):
username = request.META['HTTP_EPPN']
if not username:
error_username = True
firstname = request.META['HTTP_SHIB_INETORGPERSON_GIVENNAME']
lastname = request.META['HTTP_SHIB_PERSON_SURNAME']
if 'mail' in request.META:
mail = request.META['mail']
elif ('HTTP_MAIL' in request.META):
mail = request.META['HTTP_MAIL']
elif ('HTTP_SHIB_INETORGPERSON_MAIL' in request.META):
mail = request.META['HTTP_SHIB_INETORGPERSON_MAIL']
else:
mail = ''
firstname = lookupShibAttr(settings.SHIB_FIRSTNAME, request.META)
lastname = lookupShibAttr(settings.SHIB_LASTNAME, request.META)
mail = lookupShibAttr(settings.SHIB_MAIL, request.META)
entitlement = lookupShibAttr(settings.SHIB_ENTITLEMENT, request.META)
#organization = request.META['HTTP_SHIB_HOMEORGANIZATION']
entitlement = request.META['HTTP_SHIB_EP_ENTITLEMENT']
......@@ -1493,3 +1487,8 @@ def rad(x):
def send_new_mail(subject, message, from_email, recipient_list, bcc_list):
return EmailMessage(subject, message, from_email, recipient_list, bcc_list).send()
def lookupShibAttr(attrmap, requestMeta):
for attr in attrmap:
if (attr in requestMeta) & (len(requestMeta[attr]) > 0):
return requestMeta[attr]
return ''
\ No newline at end of file
......@@ -186,6 +186,12 @@ LDAP_AUTH_GROUP = None
# Whether new users will have admin access
LDAP_AUTH_IS_STAFF = False
#Shibboleth attribute map
SHIB_USERNAME = ['HTTP_EPPN']
SHIB_MAIL = ['mail', 'HTTP_MAIL', 'HTTP_SHIB_INETORGPERSON_MAIL']
SHIB_FIRSTNAME = ['HTTP_SHIB_INETORGPERSON_GIVENNAME']
SHIB_LASTNAME = ['HTTP_SHIB_PERSON_SURNAME']
SHIB_ENTITLEMENT = ['HTTP_SHIB_EP_ENTITLEMENT']
# DJANGO SOCIAL AUTH PLUGIN SETTINGS
......
{% load i18n %}
<li class="dropdown"><a id="drop2" class="dropdown-toggle"
data-toggle="dropdown" role="button" href="#"> {% trans "Manage" %}
<b class="caret"></b>
......
......@@ -7,6 +7,8 @@ admin.autodiscover()
urlpatterns = patterns('',
# Example:
(r'^accounts/', include('social_auth.urls')),
(r'^setlang/?$', 'django.views.i18n.set_language'),
# Uncomment the admin/doc line below to enable admin documentation:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment