Gitlab CSE Unil

Commit b3f036f1 authored by Julien Furrer's avatar Julien Furrer
Browse files

Added support for Shibboleth SLO

Not activated by default
parent c0ee5570
......@@ -58,6 +58,13 @@ function($){
rateLimitWait: 300
},
//// Uncomment to enable Shibboleth SLO
//aai : {
// sp_logout: "https://jabba.unil.ch/Shibboleth.sso/Logout",
// idp_logout: "https://aai.unil.ch/idp/logout.jsp"
//},
// ====================================================================
// ----- Specific config
// The following settings are specific to the current use of the tool
......
......@@ -82,7 +82,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
* - document is ready
* - view.js is initialized
*
* @param mainEvents A dictionary of the signals dispatched by main.js
* @param params A dictionary of the signals dispatched by main.js
* used to listen to the needed signals
*
*/
......@@ -118,13 +118,13 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
// ----- General Event listeners -----
// Listen to events
view.events.imageLoaded.add(function(evt) {
view.events.imageLoaded.add(function (evt) {
adjustCanvasToImage(evt.raster);
$("#page-loader").remove();
console.timeEnd("complete app");
});
view.events.annotationsLoaded.add(function() {
view.events.annotationsLoaded.add(function () {
zoomFitContent();
updateUserLayers();
_autoSave = true;
......@@ -134,7 +134,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
view.events.userLayerVisibilityChanged.add(onUserLayerVisChange);
tools.events.annotationSelected.add(function(item) {
tools.events.annotationSelected.add(function (item) {
// ----- Update Properties Panel -----
// disable properties panel if there is no item or more than one
var doDisplay = !!item && view.getSelectedAnnotations().length === 1;
......@@ -147,7 +147,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
});
}*/
if (! doDisplay) {
if (!doDisplay) {
// Disable properties panel
disableProperties(true);
$("*:focus").blur();
......@@ -173,7 +173,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
}
// -- color
var itemColor = (typeof item.data.getColor === 'function') ? item.data.getColor.call(item):
var itemColor = (typeof item.data.getColor === 'function') ? item.data.getColor.call(item) :
(item.data.color) ? item.data.color :
(item.strokeColor) ? item.strokeColor :
item.fillColor;
......@@ -200,24 +200,26 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
if (item && item.layer) {
var id = item.layer.id;
var annotationLayerListItem = $("#annotation-list-container .list-group-item").filter(
function(i,n){ return( $(n).data('layerId') == id ); }
function (i, n) {
return ( $(n).data('layerId') == id );
}
);
selectLayerListItem(annotationLayerListItem, false);
}
});
io.events.loadingError.add(function(err){
io.events.loadingError.add(function (err) {
var pageLoader = $("#page-loader");
if (pageLoader.length) {
pageLoader.html(
'<div class="text-danger lead">Erreur de chargement</div>'+
'<div class="text-danger lead">Erreur de chargement</div>' +
'<div class="text-danger">' + err.msg + '</div>'
);
} else {
var alert = $('<div class="alert alert-danger in">'+
'<button data-dismiss="alert" class="close" type="button">×</button>'+
'<h4>Erreur de chargement</h4>'+
'<p>' + err.msg + '</p>'+
var alert = $('<div class="alert alert-danger in">' +
'<button data-dismiss="alert" class="close" type="button">×</button>' +
'<h4>Erreur de chargement</h4>' +
'<p>' + err.msg + '</p>' +
'</div>'
);
......@@ -225,6 +227,19 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
}
});
// AAI SLO
if (config.aai && config.user && config.user.shibboleth) {
$("#adim-logout-but").click(function (event) {
event.preventDefault();
var logout_url = $(this).attr("href");
$("<iframe>", {src: config.aai.sp_logout}).appendTo("body").hide();
$("<iframe>", {src: config.aai.idp_logout}).appendTo("body").hide();
setTimeout(function () {
window.document.location.href = logout_url;
}, 500);
});
}
var _autoSave = io.getAutoSave();
var saveBut = $("#save-but");
var autoSaveBut = $("#autosave-but");
......
This diff is collapsed.
This diff is collapsed.
......@@ -66,11 +66,12 @@ window.ADIM_CONFIG = {
username: "{{ user.username }}",
fullName: "{{ user.get_full_name }}",
full_name: "{{ user.get_full_name }}",
token: "{{ user.auth_token }}",
token: "{{ user.auth_token }}"
{% if membership %}
membership: { publish_mode: {{ membership.publish_mode }} },
,membership: { publish_mode: {{ membership.publish_mode }} }
{% endif %}
guest: {% if anobj.owner.id != user.id %}true{% else %}false{% endif %}
,guest: {% if anobj.owner.id != user.id %}true{% else %}false{% endif %}
,shibboleth: true
},
ui: {
......
......@@ -32,6 +32,7 @@ window.ADIM_CONFIG = {
username: "{{ user.username }}",
fullName: "{{ user.get_full_name }}",
full_name: "{{ user.get_full_name }}"
,shibboleth: true
},
ui: {
......
......@@ -37,7 +37,7 @@
<ul class="dropdown-menu" role="menu">
<li class="dropdown-header">{{ user.username|default:user.email }}</li>
<li class="divider"></li>
<li><a href="{% url "logout" %}"><span class="glyphicon glyphicon-log-out"></span> Déconnexion</a></li>
<li><a id="adim-logout-but" href="{% url "logout" %}"><span class="glyphicon glyphicon-log-out"></span> Déconnexion</a></li>
</ul>
</li>
{% endif %}
......
......@@ -6,7 +6,7 @@ AUTHENTICATION_BACKENDS = (
LOGIN_REDIRECT_URL = "adim.app:annotate_new"
LOGIN_URL = "adim.app:home"
SHIB_UID_ATTR = 'persistent-id'
SHIB_UID_ATTR = 'uniqueID'
SHIB_USERNAME_ATTR = 'mail'
SHIB_ATTR_MAP = {
'user': (
......
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