Commit cd3043c2 authored by Antoine Rosier's avatar Antoine Rosier

Merge remote-tracking branch 'upstream/v2.0' into logs

parents b0824190 af4f1239
......@@ -294,6 +294,8 @@ $(SRCPORTALDIR)/site/htdocs/static/common/js/%.js: $(SRCPORTALDIR)/site/coffee/%
@if which coffee >/dev/null; then \
echo "Compiling $(SRCPORTALDIR)/site/coffee/$*.coffee"; \
coffee -c -o $(SRCPORTALDIR)/site/htdocs/static/common/js/ $(SRCPORTALDIR)/site/coffee/$*.coffee; \
else \
echo "Can't find coffee"; \
fi
$(SRCMANAGERDIR)/site/htdocs/static/js/%.js: $(SRCMANAGERDIR)/site/coffee/%.coffee
......
......@@ -119,13 +119,8 @@
"namespace" : "lemonldap-ng-sessions"
},
"locationRules" : {
"auth.example.com" : {
"(?#checkUser)^/checkuser": "$uid eq \"dwho\"",
"(?#errors)^/lmerror/": "accept",
"default" : "accept"
},
"manager.__DNSDOMAIN__" : {
"(?#Configuration)^/(manager\\.html|$)" : "$uid eq \"dwho\"",
"(?#Configuration)^/(manager\\.html|conf/)" : "$uid eq \"dwho\"",
"(?#Notifications)/notifications" : "$uid eq \"dwho\" or $uid eq \"rtyler\"",
"(?#Sessions)/sessions" : "$uid eq \"dwho\" or $uid eq \"rtyler\"",
"default" : "$uid eq \"dwho\" or $uid eq \"rtyler\""
......
......@@ -780,7 +780,11 @@ sub postInputFilter {
my %data =
$class->tsv->{inputPostData}->{$vhost}->{$uri}->( $req, $session );
foreach ( keys %data ) {
$data{$_} = uri_escape( $data{$_} );
my $post_key = uri_escape($_);
my $post_value = uri_escape( $data{$_} );
delete $data{$_};
$data{$post_key} = $post_value;
$class->logger->debug("Send key $post_key with value $post_value");
}
$class->setPostParams( $req, \%data );
}
......@@ -809,7 +813,8 @@ sub postJavascript {
: "form.submit();\n";
my $jqueryUrl = $formParams->{jqueryUrl} || "";
$jqueryUrl = &{ $class->tsv->{portal} } . "skins/common/js/jquery-1.10.2.js"
$jqueryUrl =
&{ $class->tsv->{portal} } . "static/bwr/jquery/dist/jquery.min.js"
if ( $jqueryUrl eq "default" );
$jqueryUrl = "<script type='text/javascript' src='$jqueryUrl'></script>\n"
if ($jqueryUrl);
......
......@@ -835,6 +835,10 @@ qr/(?:(?:https?):\/\/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.]
'k' => 'LDAP',
'v' => 'LDAP'
},
{
'k' => 'LinkedIn',
'v' => 'LinkedIn'
},
{
'k' => 'PAM',
'v' => 'PAM'
......
......@@ -923,9 +923,9 @@ sub attributes {
flags => 'm',
},
viewerAllowBrowser => {
type => 'bool',
default => 0,
documentation => 'Allow configuration browser',
type => 'bool',
default => 0,
documentation => 'Allow configuration browser',
},
# Notification
......@@ -3108,6 +3108,7 @@ m{^(?:ldapi://[^/]*/?|\w[\w\-\.]*(?::\d{1,5})?|ldap(?:s|\+tls)?://\w[\w\-\.]*(?:
{ k => 'GPG', v => 'GPG' },
{ k => 'Kerberos', v => 'Kerberos' },
{ k => 'LDAP', v => 'LDAP' },
{ k => 'LinkedIn', v => 'LinkedIn' },
{ k => 'PAM', v => 'PAM' },
{ k => 'Radius', v => 'Radius' },
{ k => 'REST', v => 'REST' },
......
......@@ -179,8 +179,6 @@ llapp.controller 'SessionsExplorerCtrl', ['$scope', '$translator', '$location',
# Session preparation
transformSession = (session) ->
_stToStr = (s) ->
s
_insert = (re, title) ->
tmp = []
reg = new RegExp(re)
......@@ -210,10 +208,7 @@ llapp.controller 'SessionsExplorerCtrl', ['$scope', '$translator', '$location',
else if key.match /^(_utime|_lastAuthnUTime|_lastSeen|notification)$/
session[key] = $scope.localeDate value
else if key.match /^(_startTime|_updateTime)$/
value = _stToStr value
pattern = /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/
arrayDate = value.match(pattern)
session[key] = "#{arrayDate[3]}/#{arrayDate[2]}/#{arrayDate[1]} à #{arrayDate[4]}:#{arrayDate[5]}:#{arrayDate[6]}"
session[key] = $scope.strToLocaleDate value
res = []
......@@ -345,6 +340,12 @@ llapp.controller 'SessionsExplorerCtrl', ['$scope', '$translator', '$location',
d = new Date(s * 1000)
return d.toLocaleString()
$scope.strToLocaleDate = (s) ->
arrayDate = s.match /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/
return s unless arrayDate.length
d = new Date "#{arrayDate[1]}-#{arrayDate[2]}-#{arrayDate[3]}T#{arrayDate[4]}:#{arrayDate[5]}:#{arrayDate[6]}"
return d.toLocaleString()
# Function to change interface language
$scope.getLanguage = (lang) ->
$scope.lang = lang
......
// Generated by CoffeeScript 1.12.7
// Generated by CoffeeScript 1.12.8
/*
* 2ndFA Session explorer
......
// Generated by CoffeeScript 1.12.7
// Generated by CoffeeScript 1.12.8
/*
diff.html script
......
// Generated by CoffeeScript 1.12.7
// Generated by CoffeeScript 1.12.8
(function() {
var filterFunctions;
......
// Generated by CoffeeScript 1.12.7
// Generated by CoffeeScript 1.12.8
/*
* LemonLDAP::NG Notifications Explorer client
......
......@@ -199,10 +199,7 @@
$scope.displaySession = function(scope) {
var sessionId, transformSession;
transformSession = function(session) {
var _insert, _stToStr, array, arrayDate, attr, attrs, category, cv, epoch, i, id, j, k, key, l, len, len1, len2, len3, len4, m, name, o, oidcConsent, pattern, ref, ref1, res, sfDevice, subres, time, title, tmp, value;
_stToStr = function(s) {
return s;
};
var _insert, array, attr, attrs, category, cv, epoch, i, id, j, k, key, l, len, len1, len2, len3, len4, m, name, o, oidcConsent, ref, ref1, res, sfDevice, subres, time, title, tmp, value;
_insert = function(re, title) {
var key, reg, tmp, value;
tmp = [];
......@@ -240,10 +237,7 @@
} else if (key.match(/^(_utime|_lastAuthnUTime|_lastSeen|notification)$/)) {
session[key] = $scope.localeDate(value);
} else if (key.match(/^(_startTime|_updateTime)$/)) {
value = _stToStr(value);
pattern = /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/;
arrayDate = value.match(pattern);
session[key] = arrayDate[3] + "/" + arrayDate[2] + "/" + arrayDate[1] + " à " + arrayDate[4] + ":" + arrayDate[5] + ":" + arrayDate[6];
session[key] = $scope.strToLocaleDate(value);
}
}
}
......@@ -424,6 +418,15 @@
d = new Date(s * 1000);
return d.toLocaleString();
};
$scope.strToLocaleDate = function(s) {
var arrayDate, d;
arrayDate = s.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/);
if (!arrayDate.length) {
return s;
}
d = new Date(arrayDate[1] + "-" + arrayDate[2] + "-" + arrayDate[3] + "T" + arrayDate[4] + ":" + arrayDate[5] + ":" + arrayDate[6]);
return d.toLocaleString();
};
$scope.getLanguage = function(lang) {
$scope.lang = lang;
$scope.form = 'white';
......
(function(){var categories,hiddenAttributes,llapp,max,menu,overScheme,schemes;max=25;schemes={_whatToTrace:[function(t,v){return"groupBy=substr("+t+",1)"},function(t,v){return t+"="+v+"*&groupBy="+t},function(t,v){return t+"="+v}],ipAddr:[function(t,v){return"groupBy=net("+t+",16,1)"},function(t,v){if(!v.match(/:/)){v=v+"."}return t+"="+v+"*&groupBy=net("+t+",32,2)"},function(t,v){if(!v.match(/:/)){v=v+"."}return t+"="+v+"*&groupBy=net("+t+",48,3)"},function(t,v){if(!v.match(/:/)){v=v+"."}return t+"="+v+"*&groupBy=net("+t+",128,4)"},function(t,v){return t+"="+v+"&groupBy=_whatToTrace"},function(t,v,q){return q.replace(/\&groupBy.*$/,"")+("&_whatToTrace="+v)}],_startTime:[function(t,v){return"groupBy=substr("+t+",8)"},function(t,v){return t+"="+v+"*&groupBy=substr("+t+",10)"},function(t,v){return t+"="+v+"*&groupBy=substr("+t+",11)"},function(t,v){return t+"="+v+"*&groupBy=substr("+t+",12)"},function(t,v){return t+"="+v+"*&groupBy=_whatToTrace"},function(t,v,q){console.log(t);console.log(v);console.log(q);return q.replace(/\&groupBy.*$/,"")+("&_whatToTrace="+v)}],doubleIp:[function(t,v){return t},function(t,v){return"_whatToTrace="+v+"&groupBy=ipAddr"},function(t,v,q){return q.replace(/\&groupBy.*$/,"")+("&ipAddr="+v)}]};overScheme={_whatToTrace:function(t,v,level,over){if(level===1&&v.length>over){return t+"="+v+"*&groupBy=substr("+t+","+(level+over+1)+")"}else{return null}},ipAddr:function(t,v,level,over){if(level>0&&level<4){return t+"="+v+"*&groupBy=net("+t+","+(16*level+4*(over+1))+",2)"}else{return null}}};hiddenAttributes="_password";categories={dateTitle:["_utime","_startTime","_updateTime","_lastAuthnUTime","_lastSeen"],connectionTitle:["ipAddr","_timezone","_url"],authenticationTitle:["_session_id","_user","_password","authenticationLevel"],modulesTitle:["_auth","_userDB","_passwordDB","_issuerDB","_authChoice","_authMulti","_userDBMulti"],saml:["_idp","_idpConfKey","_samlToken","_lassoSessionDump","_lassoIdentityDump"],groups:["groups","hGroups"],ldap:["dn"],BrowserID:["_browserIdAnswer","_browserIdAnswerRaw"],OpenIDConnect:["_oidc_id_token","_oidc_OP","_oidc_access_token"],sfaTitle:["_2fDevices"],oidcConsents:["_oidcConsents"]};menu={session:[{title:"deleteSession",icon:"trash"}],home:[]};llapp=angular.module("llngSessionsExplorer",["ui.tree","ui.bootstrap","llApp"]);llapp.controller("SessionsExplorerCtrl",["$scope","$translator","$location","$q","$http",function($scope,$translator,$location,$q,$http){var autoId,c,pathEvent,sessionType;$scope.links=links;$scope.menulinks=menulinks;$scope.staticPrefix=staticPrefix;$scope.scriptname=scriptname;$scope.formPrefix=formPrefix;$scope.availableLanguages=availableLanguages;$scope.waiting=true;$scope.showM=false;$scope.showT=true;$scope.data=[];$scope.currentScope=null;$scope.currentSession=null;$scope.menu=menu;$scope.translateP=$translator.translateP;$scope.translate=$translator.translate;$scope.translateTitle=function(node){return $translator.translateField(node,"title")};sessionType="global";$scope.menuClick=function(button){if(button.popup){window.open(button.popup)}else{if(!button.action){button.action=button.title}switch(typeof button.action){case"function":button.action($scope.currentNode,$scope);break;case"string":$scope[button.action]();break;default:console.log(typeof button.action)}}return $scope.showM=false};$scope.deleteOIDCConsent=function(rp,epoch){var item;item=angular.element(".data-"+epoch);item.remove();$scope.waiting=true;$http["delete"](scriptname+"sessions/OIDCConsent/"+sessionType+"/"+$scope.currentSession.id+"?rp="+rp+"&epoch="+epoch).then(function(response){return $scope.waiting=false},function(resp){return $scope.waiting=false});return $scope.showT=false};$scope.deleteSession=function(){$scope.waiting=true;return $http["delete"](scriptname+"sessions/"+sessionType+"/"+$scope.currentSession.id).then(function(response){$scope.currentSession=null;$scope.currentScope.remove();return $scope.waiting=false},function(resp){$scope.currentSession=null;$scope.currentScope.remove();return $scope.waiting=false})};$scope.stoggle=function(scope){var node;node=scope.$modelValue;if(node.nodes.length===0){$scope.updateTree(node.value,node.nodes,node.level,node.over,node.query,node.count)}return scope.toggle()};$scope.displaySession=function(scope){var sessionId,transformSession;transformSession=function(session){var _insert,_stToStr,array,arrayDate,attr,attrs,category,cv,epoch,i,id,j,k,key,l,len,len1,len2,len3,len4,m,name,o,oidcConsent,pattern,ref,ref1,res,sfDevice,subres,time,title,tmp,value;_stToStr=function(s){return s};_insert=function(re,title){var key,reg,tmp,value;tmp=[];reg=new RegExp(re);for(key in session){value=session[key];if(key.match(reg)&&value){tmp.push({title:key,value:value});delete session[key]}}if(tmp.length>0){return res.push({title:title,nodes:tmp})}};time=session._utime;id=session._session_id;for(key in session){value=session[key];if(!value){delete session[key]}else{if(typeof session==="string"&&value.match(/; /)){session[key]=value.split("; ")}if(typeof session[key]!=="object"){if(hiddenAttributes.match(new RegExp("\b"+key+"\b"))){session[key]="********"}else if(key.match(/^(_utime|_lastAuthnUTime|_lastSeen|notification)$/)){session[key]=$scope.localeDate(value)}else if(key.match(/^(_startTime|_updateTime)$/)){value=_stToStr(value);pattern=/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/;arrayDate=value.match(pattern);session[key]=arrayDate[3]+"/"+arrayDate[2]+"/"+arrayDate[1]+" à "+arrayDate[4]+":"+arrayDate[5]+":"+arrayDate[6]}}}}res=[];for(category in categories){attrs=categories[category];subres=[];for(i=0,len=attrs.length;i<len;i++){attr=attrs[i];if(session[attr]){if(session[attr].toString().match(/"type":\s*"(?:TOTP|U2F|UBK)"/)){subres.push({title:"type",value:"name",epoch:"date",td:"0"});array=JSON.parse(session[attr]);for(j=0,len1=array.length;j<len1;j++){sfDevice=array[j];for(key in sfDevice){value=sfDevice[key];if(key==="type"){title=value}if(key==="name"){name=value}if(key==="epoch"){epoch=value}}subres.push({title:title,value:name,epoch:epoch,td:"1"})}delete session[attr]}else if(session[attr].toString().match(/"rp":\s*"[\w-]+"/)){subres.push({title:"rp",value:"scope",epoch:"date",td:"0"});array=JSON.parse(session[attr]);for(k=0,len2=array.length;k<len2;k++){oidcConsent=array[k];for(key in oidcConsent){value=oidcConsent[key];if(key==="rp"){title=value}if(key==="scope"){name=value}if(key==="epoch"){epoch=value}}subres.push({title:title,value:name,epoch:epoch,td:"2"})}delete session[attr]}else if(session[attr].toString().match(/\w+/)){subres.push({title:attr,value:session[attr],epoch:""});delete session[attr]}else{delete session[attr]}}else{delete session[attr]}}if(subres.length>0){res.push({title:"__"+category+"__",nodes:subres})}}_insert("^openid","OpenID");_insert("^notification_(.+)","__notificationsDone__");if(session._loginHistory){tmp=[];if(session._loginHistory.successLogin){ref=session._loginHistory.successLogin;for(m=0,len3=ref.length;m<len3;m++){l=ref[m];cv="";for(key in l){value=l[key];if(!key.match(/^(_utime|ipAddr|error)$/)){cv+=", "+key+" : "+value}}tmp.push({t:l._utime,title:$scope.localeDate(l._utime),value:"Success (IP "+l.ipAddr+")"+cv})}}if(session._loginHistory.failedLogin){ref1=session._loginHistory.failedLogin;for(o=0,len4=ref1.length;o<len4;o++){l=ref1[o];cv="";for(key in l){value=l[key];if(!key.match(/^(_utime|ipAddr|error)$/)){cv+=", "+key+" : "+value}}tmp.push({t:l._utime,title:$scope.localeDate(l._utime),value:"Error "+l.error+" (IP "+l.ipAddr+")"+cv})}}delete session._loginHistory;tmp.sort(function(a,b){return b.t-a.t});res.push({title:"__loginHistory__",nodes:tmp})}tmp=[];for(key in session){value=session[key];tmp.push({title:key,value:value})}tmp.sort(function(a,b){if(a.title>b.title){return 1}else if(a.title<b.title){return-1}else{return 0}});res.push({title:"__attributesAndMacros__",nodes:tmp});return{_utime:time,id:id,nodes:res}};$scope.currentScope=scope;sessionId=scope.$modelValue.session;$http.get(scriptname+"sessions/"+sessionType+"/"+sessionId).then(function(response){return $scope.currentSession=transformSession(response.data)});return $scope.showT=false};$scope.localeDate=function(s){var d;d=new Date(s*1e3);return d.toLocaleString()};$scope.getLanguage=function(lang){$scope.lang=lang;$scope.form="white";$scope.init();return $scope.showM=false};pathEvent=function(event,next,current){var n;n=next.match(/#!?\/(\w+)/);sessionType="global";if(n===null){$scope.type="_whatToTrace"}else if(n[1].match(/^(persistent)$/)){sessionType=RegExp.$1;$scope.type="_session_uid"}else{$scope.type=n[1]}return $scope.init()};$scope.$on("$locationChangeSuccess",pathEvent);autoId=0;$scope.updateTree=function(value,node,level,over,currentQuery,count){var query,scheme,tmp;$scope.waiting=true;scheme=schemes[$scope.type]?schemes[$scope.type]:$scope.type==="_updateTime"?schemes._startTime:schemes._whatToTrace;query=scheme[level]($scope.type,value,currentQuery);if(count>max&&overScheme[$scope.type]){if(tmp=overScheme[$scope.type]($scope.type,value,level,over,currentQuery)){over++;query=tmp;level=level-1}else{over=0}}else{over=0}return $http.get(scriptname+"sessions/"+sessionType+"?"+query).then(function(response){var data,i,len,n,ref;data=response.data;if(data.result){ref=data.values;for(i=0,len=ref.length;i<len;i++){n=ref[i];autoId++;n.id="node"+autoId;if(level<scheme.length-1){n.nodes=[];n.level=level+1;n.query=query;n.over=over;if($scope.type.match(/^(?:start|update)Time$/)){n.title=n.value.replace(/^(\d{8})(\d{2})(\d{2})$/,"$2:$3").replace(/^(\d{8})(\d{2})(\d)$/,"$2:$30").replace(/^(\d{8})(\d{2})$/,"$2h").replace(/^(\d{4})(\d{2})(\d{2})/,"$1-$2-$3")}}node.push(n)}if(value===""){$scope.total=data.total}}return $scope.waiting=false},function(resp){return $scope.waiting=false})};$scope.init=function(){$scope.waiting=true;$scope.data=[];$q.all([$translator.init($scope.lang),$scope.updateTree("",$scope.data,0,0)]).then(function(){return $scope.waiting=false},function(resp){return $scope.waiting=false});$scope.activeModule="sessions";return $scope.myStyle={color:"#ffb84d"}};c=$location.path().match(/^\/(\w+)/);return $scope.type=c?c[1]:"_whatToTrace"}])}).call(this);
(function(){var categories,hiddenAttributes,llapp,max,menu,overScheme,schemes;max=25;schemes={_whatToTrace:[function(t,v){return"groupBy=substr("+t+",1)"},function(t,v){return t+"="+v+"*&groupBy="+t},function(t,v){return t+"="+v}],ipAddr:[function(t,v){return"groupBy=net("+t+",16,1)"},function(t,v){if(!v.match(/:/)){v=v+"."}return t+"="+v+"*&groupBy=net("+t+",32,2)"},function(t,v){if(!v.match(/:/)){v=v+"."}return t+"="+v+"*&groupBy=net("+t+",48,3)"},function(t,v){if(!v.match(/:/)){v=v+"."}return t+"="+v+"*&groupBy=net("+t+",128,4)"},function(t,v){return t+"="+v+"&groupBy=_whatToTrace"},function(t,v,q){return q.replace(/\&groupBy.*$/,"")+("&_whatToTrace="+v)}],_startTime:[function(t,v){return"groupBy=substr("+t+",8)"},function(t,v){return t+"="+v+"*&groupBy=substr("+t+",10)"},function(t,v){return t+"="+v+"*&groupBy=substr("+t+",11)"},function(t,v){return t+"="+v+"*&groupBy=substr("+t+",12)"},function(t,v){return t+"="+v+"*&groupBy=_whatToTrace"},function(t,v,q){console.log(t);console.log(v);console.log(q);return q.replace(/\&groupBy.*$/,"")+("&_whatToTrace="+v)}],doubleIp:[function(t,v){return t},function(t,v){return"_whatToTrace="+v+"&groupBy=ipAddr"},function(t,v,q){return q.replace(/\&groupBy.*$/,"")+("&ipAddr="+v)}]};overScheme={_whatToTrace:function(t,v,level,over){if(level===1&&v.length>over){return t+"="+v+"*&groupBy=substr("+t+","+(level+over+1)+")"}else{return null}},ipAddr:function(t,v,level,over){if(level>0&&level<4){return t+"="+v+"*&groupBy=net("+t+","+(16*level+4*(over+1))+",2)"}else{return null}}};hiddenAttributes="_password";categories={dateTitle:["_utime","_startTime","_updateTime","_lastAuthnUTime","_lastSeen"],connectionTitle:["ipAddr","_timezone","_url"],authenticationTitle:["_session_id","_user","_password","authenticationLevel"],modulesTitle:["_auth","_userDB","_passwordDB","_issuerDB","_authChoice","_authMulti","_userDBMulti"],saml:["_idp","_idpConfKey","_samlToken","_lassoSessionDump","_lassoIdentityDump"],groups:["groups","hGroups"],ldap:["dn"],BrowserID:["_browserIdAnswer","_browserIdAnswerRaw"],OpenIDConnect:["_oidc_id_token","_oidc_OP","_oidc_access_token"],sfaTitle:["_2fDevices"],oidcConsents:["_oidcConsents"]};menu={session:[{title:"deleteSession",icon:"trash"}],home:[]};llapp=angular.module("llngSessionsExplorer",["ui.tree","ui.bootstrap","llApp"]);llapp.controller("SessionsExplorerCtrl",["$scope","$translator","$location","$q","$http",function($scope,$translator,$location,$q,$http){var autoId,c,pathEvent,sessionType;$scope.links=links;$scope.menulinks=menulinks;$scope.staticPrefix=staticPrefix;$scope.scriptname=scriptname;$scope.formPrefix=formPrefix;$scope.availableLanguages=availableLanguages;$scope.waiting=true;$scope.showM=false;$scope.showT=true;$scope.data=[];$scope.currentScope=null;$scope.currentSession=null;$scope.menu=menu;$scope.translateP=$translator.translateP;$scope.translate=$translator.translate;$scope.translateTitle=function(node){return $translator.translateField(node,"title")};sessionType="global";$scope.menuClick=function(button){if(button.popup){window.open(button.popup)}else{if(!button.action){button.action=button.title}switch(typeof button.action){case"function":button.action($scope.currentNode,$scope);break;case"string":$scope[button.action]();break;default:console.log(typeof button.action)}}return $scope.showM=false};$scope.deleteOIDCConsent=function(rp,epoch){var item;item=angular.element(".data-"+epoch);item.remove();$scope.waiting=true;$http["delete"](scriptname+"sessions/OIDCConsent/"+sessionType+"/"+$scope.currentSession.id+"?rp="+rp+"&epoch="+epoch).then(function(response){return $scope.waiting=false},function(resp){return $scope.waiting=false});return $scope.showT=false};$scope.deleteSession=function(){$scope.waiting=true;return $http["delete"](scriptname+"sessions/"+sessionType+"/"+$scope.currentSession.id).then(function(response){$scope.currentSession=null;$scope.currentScope.remove();return $scope.waiting=false},function(resp){$scope.currentSession=null;$scope.currentScope.remove();return $scope.waiting=false})};$scope.stoggle=function(scope){var node;node=scope.$modelValue;if(node.nodes.length===0){$scope.updateTree(node.value,node.nodes,node.level,node.over,node.query,node.count)}return scope.toggle()};$scope.displaySession=function(scope){var sessionId,transformSession;transformSession=function(session){var _insert,array,attr,attrs,category,cv,epoch,i,id,j,k,key,l,len,len1,len2,len3,len4,m,name,o,oidcConsent,ref,ref1,res,sfDevice,subres,time,title,tmp,value;_insert=function(re,title){var key,reg,tmp,value;tmp=[];reg=new RegExp(re);for(key in session){value=session[key];if(key.match(reg)&&value){tmp.push({title:key,value:value});delete session[key]}}if(tmp.length>0){return res.push({title:title,nodes:tmp})}};time=session._utime;id=session._session_id;for(key in session){value=session[key];if(!value){delete session[key]}else{if(typeof session==="string"&&value.match(/; /)){session[key]=value.split("; ")}if(typeof session[key]!=="object"){if(hiddenAttributes.match(new RegExp("\b"+key+"\b"))){session[key]="********"}else if(key.match(/^(_utime|_lastAuthnUTime|_lastSeen|notification)$/)){session[key]=$scope.localeDate(value)}else if(key.match(/^(_startTime|_updateTime)$/)){session[key]=$scope.strToLocaleDate(value)}}}}res=[];for(category in categories){attrs=categories[category];subres=[];for(i=0,len=attrs.length;i<len;i++){attr=attrs[i];if(session[attr]){if(session[attr].toString().match(/"type":\s*"(?:TOTP|U2F|UBK)"/)){subres.push({title:"type",value:"name",epoch:"date",td:"0"});array=JSON.parse(session[attr]);for(j=0,len1=array.length;j<len1;j++){sfDevice=array[j];for(key in sfDevice){value=sfDevice[key];if(key==="type"){title=value}if(key==="name"){name=value}if(key==="epoch"){epoch=value}}subres.push({title:title,value:name,epoch:epoch,td:"1"})}delete session[attr]}else if(session[attr].toString().match(/"rp":\s*"[\w-]+"/)){subres.push({title:"rp",value:"scope",epoch:"date",td:"0"});array=JSON.parse(session[attr]);for(k=0,len2=array.length;k<len2;k++){oidcConsent=array[k];for(key in oidcConsent){value=oidcConsent[key];if(key==="rp"){title=value}if(key==="scope"){name=value}if(key==="epoch"){epoch=value}}subres.push({title:title,value:name,epoch:epoch,td:"2"})}delete session[attr]}else if(session[attr].toString().match(/\w+/)){subres.push({title:attr,value:session[attr],epoch:""});delete session[attr]}else{delete session[attr]}}else{delete session[attr]}}if(subres.length>0){res.push({title:"__"+category+"__",nodes:subres})}}_insert("^openid","OpenID");_insert("^notification_(.+)","__notificationsDone__");if(session._loginHistory){tmp=[];if(session._loginHistory.successLogin){ref=session._loginHistory.successLogin;for(m=0,len3=ref.length;m<len3;m++){l=ref[m];cv="";for(key in l){value=l[key];if(!key.match(/^(_utime|ipAddr|error)$/)){cv+=", "+key+" : "+value}}tmp.push({t:l._utime,title:$scope.localeDate(l._utime),value:"Success (IP "+l.ipAddr+")"+cv})}}if(session._loginHistory.failedLogin){ref1=session._loginHistory.failedLogin;for(o=0,len4=ref1.length;o<len4;o++){l=ref1[o];cv="";for(key in l){value=l[key];if(!key.match(/^(_utime|ipAddr|error)$/)){cv+=", "+key+" : "+value}}tmp.push({t:l._utime,title:$scope.localeDate(l._utime),value:"Error "+l.error+" (IP "+l.ipAddr+")"+cv})}}delete session._loginHistory;tmp.sort(function(a,b){return b.t-a.t});res.push({title:"__loginHistory__",nodes:tmp})}tmp=[];for(key in session){value=session[key];tmp.push({title:key,value:value})}tmp.sort(function(a,b){if(a.title>b.title){return 1}else if(a.title<b.title){return-1}else{return 0}});res.push({title:"__attributesAndMacros__",nodes:tmp});return{_utime:time,id:id,nodes:res}};$scope.currentScope=scope;sessionId=scope.$modelValue.session;$http.get(scriptname+"sessions/"+sessionType+"/"+sessionId).then(function(response){return $scope.currentSession=transformSession(response.data)});return $scope.showT=false};$scope.localeDate=function(s){var d;d=new Date(s*1e3);return d.toLocaleString()};$scope.strToLocaleDate=function(s){var arrayDate,d;arrayDate=s.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/);if(!arrayDate.length){return s}d=new Date(arrayDate[1]+"-"+arrayDate[2]+"-"+arrayDate[3]+"T"+arrayDate[4]+":"+arrayDate[5]+":"+arrayDate[6]);return d.toLocaleString()};$scope.getLanguage=function(lang){$scope.lang=lang;$scope.form="white";$scope.init();return $scope.showM=false};pathEvent=function(event,next,current){var n;n=next.match(/#!?\/(\w+)/);sessionType="global";if(n===null){$scope.type="_whatToTrace"}else if(n[1].match(/^(persistent)$/)){sessionType=RegExp.$1;$scope.type="_session_uid"}else{$scope.type=n[1]}return $scope.init()};$scope.$on("$locationChangeSuccess",pathEvent);autoId=0;$scope.updateTree=function(value,node,level,over,currentQuery,count){var query,scheme,tmp;$scope.waiting=true;scheme=schemes[$scope.type]?schemes[$scope.type]:$scope.type==="_updateTime"?schemes._startTime:schemes._whatToTrace;query=scheme[level]($scope.type,value,currentQuery);if(count>max&&overScheme[$scope.type]){if(tmp=overScheme[$scope.type]($scope.type,value,level,over,currentQuery)){over++;query=tmp;level=level-1}else{over=0}}else{over=0}return $http.get(scriptname+"sessions/"+sessionType+"?"+query).then(function(response){var data,i,len,n,ref;data=response.data;if(data.result){ref=data.values;for(i=0,len=ref.length;i<len;i++){n=ref[i];autoId++;n.id="node"+autoId;if(level<scheme.length-1){n.nodes=[];n.level=level+1;n.query=query;n.over=over;if($scope.type.match(/^(?:start|update)Time$/)){n.title=n.value.replace(/^(\d{8})(\d{2})(\d{2})$/,"$2:$3").replace(/^(\d{8})(\d{2})(\d)$/,"$2:$30").replace(/^(\d{8})(\d{2})$/,"$2h").replace(/^(\d{4})(\d{2})(\d{2})/,"$1-$2-$3")}}node.push(n)}if(value===""){$scope.total=data.total}}return $scope.waiting=false},function(resp){return $scope.waiting=false})};$scope.init=function(){$scope.waiting=true;$scope.data=[];$q.all([$translator.init($scope.lang),$scope.updateTree("",$scope.data,0,0)]).then(function(){return $scope.waiting=false},function(resp){return $scope.waiting=false});$scope.activeModule="sessions";return $scope.myStyle={color:"#ffb84d"}};c=$location.path().match(/^\/(\w+)/);return $scope.type=c?c[1]:"_whatToTrace"}])}).call(this);
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -181,7 +181,7 @@ sub reloadConf {
# Initialize content-security-policy header
my $csp = '';
foreach (qw(default img src style font connect)) {
foreach (qw(default img src style font connect script)) {
my $prm = $self->conf->{ 'csp' . ucfirst($_) };
$csp .= "$_-src $prm;" if ($prm);
}
......
......@@ -359,11 +359,11 @@ sub _filterHash {
# If a specific rule exists, get it from cache or compile it
if ( $appdisplay !~ /^auto$/i ) {
if ( $self->specific->{$appuri} ) {
$cond = $self->specific->{$appuri};
if ( $self->specific->{$key} ) {
$cond = $self->specific->{$key};
}
else {
$cond = $self->specific->{$appuri} =
$cond = $self->specific->{$key} =
$self->p->HANDLER->buildSub(
$self->p->HANDLER->substitute($appdisplay) );
}
......
......@@ -159,8 +159,7 @@ sub authLogout {
sub deleteSession {
my ( $self, $req ) = @_;
$req->userData( {} );
if ( my $id = $req->id ) {
if ( my $id = $req->id || $req->userData->{_session_id} ) {
my $apacheSession = $self->getApacheSession( $req->id );
unless ($apacheSession) {
$self->logger->debug("Session $id already deleted");
......@@ -211,6 +210,7 @@ sub deleteSession {
$req->urldc( $req->script_name . "?logout=1" );
}
}
$req->userData( {} );
# Redirect or Post if asked by authLogout
if ( $req->urldc and $req->urldc ne $self->conf->{portal} ) {
......
......@@ -17,6 +17,8 @@ use strict;
use URI::Escape;
use JSON;
has trOverCache => ( is => 'rw', default => sub { {} } );
# List constants
sub authProcess { qw(extractFormInfo getUser authenticate) }
......@@ -184,8 +186,9 @@ sub logout {
return $self->do(
$req,
[
'controlUrl', @{ $self->beforeLogout },
'authLogout', 'deleteSession'
'importHandlerData', 'controlUrl',
@{ $self->beforeLogout }, 'authLogout',
'deleteSession'
]
);
}
......@@ -749,23 +752,26 @@ sub sendHtml {
# Override messages
my $trOverMessages = JSON::from_json( $self->trOver );
opendir( DIR, $templateDir );
my @langfiles = grep( /\.json$/, readdir(DIR) );
close(DIR);
foreach my $file (@langfiles) {
my ($lang) = ( $file =~ /^(\w+)\.json/ );
$self->logger->debug("Use $file to override messages");
if ( open my $json, "<", $templateDir . "/" . $file ) {
local $/ = undef;
$trOverMessages->{$lang} = JSON::from_json(<$json>);
}
else {
$self->logger->error("Unable to read $file");
unless ( $self->trOverCache->{$templateDir} ) {
opendir( DIR, $templateDir );
my @langfiles = grep( /\.json$/, readdir(DIR) );
close(DIR);
foreach my $file (@langfiles) {
my ($lang) = ( $file =~ /^(\w+)\.json/ );
$self->logger->debug("Use $file to override messages");
if ( open my $json, "<", $templateDir . "/" . $file ) {
local $/ = undef;
$trOverMessages->{$lang} = JSON::from_json(<$json>);
}
else {
$self->logger->error("Unable to read $file");
}
}
}
$args{params}->{TROVER} = JSON::to_json($trOverMessages);
$self->trOverCache->{$templateDir} = JSON::to_json($trOverMessages);
}
$args{params}->{TROVER} = $self->trOverCache->{$templateDir};
my $res = $self->SUPER::sendHtml( $req, $template, %args );
push @{ $res->[1] },
......
// Generated by CoffeeScript 1.12.7
// Generated by CoffeeScript 1.12.8
/*
LemonLDAP::NG 2F registration script
......
// Generated by CoffeeScript 1.12.7
// Generated by CoffeeScript 1.12.8
(function() {
$(document).ready(function() {
return $('#upgrd').submit();
......
(function(){$(document).ready(function(){return $("#upgrd").submit()})}).call(this);
\ No newline at end of file
(function(){$(document).ready(function(){return $("#upgrd").submit()})}).call(this);
// Generated by CoffeeScript 1.10.0
// Generated by CoffeeScript 1.12.8
(function() {
var go, i, timer, timerIsEnabled;
......
// Generated by CoffeeScript 1.10.0
// Generated by CoffeeScript 1.12.8
(function() {
$(document).ready(function() {
return $(".idploop").on('click', function() {
......
// Generated by CoffeeScript 1.9.3
// Generated by CoffeeScript 1.12.8
(function() {
var _go, go, i, stop, timer;
......
(function(){var _go,go,i,stop,timer;i=30;_go=1;stop=function(){_go=0;return $("#divToHide").hide()};go=function(){if(_go){return $("#form").submit()}};timer=function(){var h;h=$("#timer").html();if(i>0){i--}h=h.replace(/\d+/,i);$("#timer").html(h);return window.setTimeout(timer,1e3)};$(document).ready(function(){if(window.datas["activeTimer"]){window.setTimeout(go,3e4);window.setTimeout(timer,1e3)}else{stop}return $("#wait").on("click",function(){return stop()})})}).call(this);
\ No newline at end of file
(function(){var _go,go,i,stop,timer;i=30;_go=1;stop=function(){_go=0;return $("#divToHide").hide()};go=function(){if(_go){return $("#form").submit()}};timer=function(){var h;h=$("#timer").html();if(i>0){i--}h=h.replace(/\d+/,i);$("#timer").html(h);return window.setTimeout(timer,1e3)};$(document).ready(function(){if(window.datas["activeTimer"]){window.setTimeout(go,3e4);window.setTimeout(timer,1e3)}else{stop}return $("#wait").on("click",function(){return stop()})})}).call(this);
// Generated by CoffeeScript 1.10.0
// Generated by CoffeeScript 1.12.8
(function() {
$(document).ready(function() {
return $.ajax(portal + '?kerberos=1', {
......
(function(){$(document).ready(function(){return $.ajax(portal+"?kerberos=1",{dataType:"json",statusCode:{401:function(){return $("#lform").submit()}},success:function(a){return $("#lform").submit()},error:function(){return $("#lform").submit()}})})}).call(this);
\ No newline at end of file
(function(){$(document).ready(function(){return $.ajax(portal+"?kerberos=1",{dataType:"json",statusCode:{401:function(){return $("#lform").submit()}},success:function(data){return $("#lform").submit()},error:function(){return $("#lform").submit()}})})}).call(this);
// Generated by CoffeeScript 1.12.7
// Generated by CoffeeScript 1.12.8
(function() {
$(document).ready(function() {
return $.ajax(portal + '?kerberos=1', {
......
// Generated by CoffeeScript 1.12.7
// Generated by CoffeeScript 1.12.8
(function() {
var values;
......
// Generated by CoffeeScript 1.12.7
// Generated by CoffeeScript 1.12.8
/*
LemonLDAP::NG Portal jQuery scripts
......
// Generated by CoffeeScript 1.10.0
// Generated by CoffeeScript 1.12.8
(function() {
document.onreadystatechange = function() {
var redirect;
......
(function(){document.onreadystatechange=function(){var a;if(document.readyState==="complete"){a=document.getElementById("redirect").textContent.replace(/\s/g,"");if(a){if(a==="form"){return document.getElementById("form").submit()}else{return document.location.href=a}}else{return console.log("No redirection !")}}}}).call(this);
\ No newline at end of file
(function(){document.onreadystatechange=function(){var redirect;if(document.readyState==="complete"){redirect=document.getElementById("redirect").textContent.replace(/\s/g,"");if(redirect){if(redirect==="form"){return document.getElementById("form").submit()}else{return document.location.href=redirect}}else{return console.log("No redirection !")}}}}).call(this);
// Generated by CoffeeScript 1.10.0
// Generated by CoffeeScript 1.12.8
(function() {
$(document).ready(function() {
return new Fingerprint2().get(function(result, components) {
......
(function(){$(document).ready(function(){return new Fingerprint2().get(function(a,b){$("#fg").attr("value",a);return $("#form").submit()})})}).call(this);
\ No newline at end of file
(function(){$(document).ready(function(){return(new Fingerprint2).get(function(result,components){$("#fg").attr("value",result);return $("#form").submit()})})}).call(this);
// Generated by CoffeeScript 1.12.7
// Generated by CoffeeScript 1.12.8
(function() {
var tryssl;
......
// Generated by CoffeeScript 1.12.7
// Generated by CoffeeScript 1.12.8
(function() {
var tryssl;
......
// Generated by CoffeeScript 1.12.7
// Generated by CoffeeScript 1.12.8
/*
LemonLDAP::NG TOTP registration script
......
// Generated by CoffeeScript 1.9.3
// Generated by CoffeeScript 1.12.8
/*
LemonLDAP::NG U2F verify script
......
(function(){var a;a=function(){return u2f.sign(window.datas.appId,window.datas.challenge,window.datas.registeredKeys,function(b){$("#verify-data").val(JSON.stringify(b));$("#verify-challenge").val(window.datas.challenge);return $("#verify-form").submit()})};$(document).ready(function(){return setTimeout(a,1000)})}).call(this);
\ No newline at end of file
(function(){var check;check=function(){return u2f.sign(window.datas.appId,window.datas.challenge,window.datas.registeredKeys,function(data){$("#verify-data").val(JSON.stringify(data));$("#verify-challenge").val(window.datas.challenge);return $("#verify-form").submit()})};$(document).ready(function(){return setTimeout(check,1e3)})}).call(this);
// Generated by CoffeeScript 1.12.7
// Generated by CoffeeScript 1.12.8
/*
LemonLDAP::NG U2F registration script
......
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