Added context processor for login URL, added login URL to base template, added...

Added context processor for login URL, added login URL to base template, added embedded discovery service page.
parent 96bfb21b
......@@ -61,6 +61,9 @@ def spinfo(request):
def spprivacy(request):
return render_to_response('gracedb/spprivacy.html', {}, context_instance=RequestContext(request))
def discovery(request):
return render_to_response('gracedb/discovery.html', {}, context_instance=RequestContext(request))
def skyalert_authorized(request):
try:
return u"{0} {1}".format(request.user.first_name, request.user.last_name) in settings.SKYALERT_SUBMITTERS
......
from django.utils.http import urlquote
from django.conf import settings
def shib_login_url(request):
target = urlquote(request.get_full_path())
login_url = '%s?target=%s' % (settings.LOGIN_URL, target)
return {'login_url' : login_url}
......@@ -19,6 +19,8 @@ PUBLIC_URLS = [
'/SPInfo/',
'/SPPrivacy',
'/SPPrivacy/',
'/DiscoveryService',
'/DiscoveryService/',
]
def cert_dn_from_request(request):
......
......@@ -174,6 +174,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
"django.core.context_processors.request",
"gracedb.middleware.auth.LigoAuthContext",
'middleware.debug.LigoDebugContext',
'ligoauth.context_processors.shib_login_url',
)
AUTHENTICATION_BACKENDS = (
......@@ -186,6 +187,7 @@ AUTHENTICATION_BACKENDS = (
)
SHIB_AUTHENTICATION_SESSION_INITIATOR = 'https://moe.phys.uwm.edu/Shibboleth.sso/Login'
LOGIN_URL = '/Shibboleth.sso/Login'
# If these are left at default, when the Shibboleth middleware
# creates a new auth_user, they will get admin privs.
......
......@@ -184,6 +184,11 @@ span.coinc-0,
/* text-shadow: 2px 2px 2px #555; */
}
#nav #nav-login
{
float: right;
}
#nav li {
display:inline;
padding:0;
......
......@@ -37,7 +37,11 @@ function changeTime(obj, label) {
<li id="nav-feeds"><a href="{% url "feeds" %}">RSS</a></li>
<li id="nav-latest"><a href="{% url "latest" %}">Latest</a></li>
<li id="nav-userprofile"><a href="{% url "userprofile-home" %}">Options</a></li>
{% if user %}<li id="nav-user">Authenticated as: {{ user.first_name }} {{user.last_name }}</li>{% endif %}
{% if user %}
<li id="nav-user">Authenticated as: {{ user.first_name }} {{user.last_name }}</li>
{% else %}
<li id="nav-login"><a href="{{ login_url }}">Login</a></li>
{% endif %}
</ul>
<center>
{% if config_name %}
......
{% extends "base.html" %}
{% block title %}Home{% endblock %}
{% block heading %}Login Required {% endblock %}
{% block pageid %}Discovery Service{% endblock %}
{% block jscript %}
<link rel="stylesheet" type="text/css" href="/shibboleth-ds/idpselect.css" />
{% endblock %}
{% block content %}
<div class="text">
<p>
Please choose how to login
</p>
</div>
<div id="idpSelect">
</div>
<div>
<script src="/shibboleth-ds/idpselect_config.js" type="text/javascript" language="javascript"></script>
<script src="/shibboleth-ds/idpselect.js" type="text/javascript" language="javascript"></script>
</div>
{% endblock %}
......@@ -19,6 +19,7 @@ urlpatterns = patterns('',
url (r'^$', 'gracedb.views.index', name="home"),
url (r'^SPInfo', 'gracedb.views.spinfo', name="spinfo"),
url (r'^SPPrivacy', 'gracedb.views.spprivacy', name="spprivacy"),
url (r'^DiscoveryService', 'gracedb.views.discovery', name="discovery"),
(r'^events/', include('gracedb.urls')),
(r'^api/', include('gracedb.urls_rest', app_name="api", namespace="x509")),
(r'^apiweb/', include('gracedb.urls_rest', app_name="api", namespace="shib")),
......
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