Commit c9b83fd2 authored by Xavier Guimard's avatar Xavier Guimard

Merge branch 'master' of gitlab.ow2.org:lemonldap-ng/lemonldap-ng

parents ffe88293 05aeaf92
......@@ -2495,7 +2495,8 @@ qr/(?:(?:https?):\/\/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.]
'type' => 'bool'
},
'samlDiscoveryProtocolIsPassive' => {
'type' => 'bool'
'default' => 0,
'type' => 'bool'
},
'samlDiscoveryProtocolPolicy' => {
'type' => 'text'
......
......@@ -1902,6 +1902,7 @@ sub attributes {
documentation => 'SAML Discovery Protocol Policy',
},
samlDiscoveryProtocolIsPassive => {
default => 0,
type => 'bool',
documentation => 'SAML Discovery Protocol Is Passive',
},
......
......@@ -25,6 +25,7 @@ sub cTrees {
{
title => 'vhostOptions',
help => 'configvhost.html#options',
form => 'simpleInputContainer',
nodes => [
'vhostPort', 'vhostHttps',
'vhostMaintenance', 'vhostAliases',
......
......@@ -69,6 +69,7 @@ sub diff {
}
elsif ( exists $conf[1]->{$key} ) {
if ( $conf[0]->{$key} ne $conf[1]->{$key} ) {
$self->logger->debug( "Key $key has changed : " . $conf[0]->{$key} . " -> " . $conf[1]->{$key} );
$res[0]->{$key} = $conf[0]->{$key};
$res[1]->{$key} = $conf[1]->{$key};
}
......
......@@ -2,8 +2,7 @@
diff.html script
###
llapp = angular.module 'llngConfDiff', ['ui.tree', 'ui.bootstrap', 'llApp', 'ngCookies']
llapp = angular.module 'llngConfDiff', ['ui.tree', 'ui.bootstrap', 'llApp', 'ngCookies'] , ($rootScopeProvider) -> $rootScopeProvider.digestTtl(15)
llapp.controller 'DiffCtrl', [ '$scope', '$http', '$q', '$translator', '$location', ($scope, $http, $q, $translator, $location) ->
$scope.links = links
$scope.menulinks = menulinks
......@@ -125,6 +124,7 @@ llapp.controller 'DiffCtrl', [ '$scope', '$http', '$q', '$translator', '$locatio
if v.constructor == 'array'
tmp.newvalue = v
else
console.log "Iteration"
tmp.newnodes = toNodes v, 'new'
else
tmp.newvalue = v
......
......@@ -1142,7 +1142,8 @@ function templates(tpl,key) {
],
"help" : "configvhost.html#options",
"id" : "vhostOptions",
"title" : "vhostOptions"
"title" : "vhostOptions",
"type" : "simpleInputContainer"
}
]
;
......
......@@ -7,7 +7,9 @@ diff.html script
(function() {
var llapp;
llapp = angular.module('llngConfDiff', ['ui.tree', 'ui.bootstrap', 'llApp', 'ngCookies']);
llapp = angular.module('llngConfDiff', ['ui.tree', 'ui.bootstrap', 'llApp', 'ngCookies'], function($rootScopeProvider) {
return $rootScopeProvider.digestTtl(15);
});
llapp.controller('DiffCtrl', [
'$scope', '$http', '$q', '$translator', '$location', function($scope, $http, $q, $translator, $location) {
......@@ -151,6 +153,7 @@ diff.html script
if (v.constructor === 'array') {
tmp.newvalue = v;
} else {
console.log("Iteration");
tmp.newnodes = toNodes(v, 'new');
}
} else {
......
(function(){var llapp;llapp=angular.module("llngConfDiff",["ui.tree","ui.bootstrap","llApp","ngCookies"]);llapp.controller("DiffCtrl",["$scope","$http","$q","$translator","$location",function($scope,$http,$q,$translator,$location){var buildTree,getCfg,init,pathEvent,readDiff,reverseTree,toNodes;$scope.links=links;$scope.menulinks=menulinks;$scope.staticPrefix=staticPrefix;$scope.scriptname=scriptname;$scope.availableLanguages=availableLanguages;$scope.waiting=true;$scope.showM=false;$scope.cfg=[];$scope.data={};$scope.currentNode=null;$scope.translateTitle=function(node){return $translator.translateField(node,"title")};$scope.translateP=$translator.translateP;$scope.translate=$translator.translate;$scope.toggle=function(scope){return scope.toggle()};$scope.stoggle=function(scope,node){$scope.currentNode=node;return scope.toggle()};$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.getLanguage=function(lang){$scope.lang=lang;$scope.init();return $scope.showM=false};getCfg=function(b,n){var d;d=$q.defer();if($scope.cfg[b]==null||$scope.cfg[b]!==n){$http.get(""+confPrefix+n).then(function(response){var date;if(response&&response.data){$scope.cfg[b]=response.data;date=new Date(response.data.cfgDate*1e3);$scope.cfg[b].date=date.toLocaleString();console.log("Metadatas of cfg "+n+" loaded");return d.resolve("OK")}else{return d.reject(response)}},function(response){console.log(response);return d.reject("NOK")})}else{d.resolve()}return d.promise};init=function(){var d;$scope.message=null;$scope.currentNode=null;d=$q.defer();return $http.get(scriptname+"diff/"+$scope.cfg[0].cfgNum+"/"+$scope.cfg[1].cfgNum).then(function(response){var data;data=[];data=readDiff(response.data[0],response.data[1]);$scope.data=buildTree(data);$scope.message="";return $scope.waiting=false},function(response){return $scope.message=$scope.translate("error")+" : "+response.statusLine})};readDiff=function(c1,c2,tr){var k,res,tmp,v;if(tr==null){tr=true}res=[];for(k in c1){v=c1[k];if(tr){tmp={title:$scope.translate(k),id:k}}else{tmp={title:k}}if(!k.match(/^cfg(?:Num|Log|Author(?:IP)?|Date)$/)){if(v!=null&&typeof v==="object"){if(v.constructor==="array"){tmp.oldvalue=v;tmp.newvalue=c2[k]}else if(typeof c2[k]==="object"){tmp.nodes=readDiff(c1[k],c2[k],false)}else{tmp.oldnodes=toNodes(v,"old")}}else{tmp.oldvalue=v;tmp.newvalue=c2[k]}res.push(tmp)}}for(k in c2){v=c2[k];if(!(k.match(/^cfg(?:Num|Log|Author(?:IP)?|Date)$/)||c1[k]!=null)){if(tr){tmp={title:$scope.translate(k),id:k}}else{tmp={title:k}}if(v!=null&&typeof v==="object"){if(v.constructor==="array"){tmp.newvalue=v}else{tmp.newnodes=toNodes(v,"new")}}else{tmp.newvalue=v}res.push(tmp)}}return res};toNodes=function(c,s){var k,res,tmp,v;res=[];for(k in c){v=c[k];tmp={title:k};if(typeof v==="object"){if(v.constructor==="array"){tmp[s+"value"]=v}else{tmp[s+"nodes"]=toNodes(c[k],s)}}else{tmp[s+"value"]=v}res.push(tmp)}return res};reverseTree=[];buildTree=function(data){var elem,found,i,j,l,len,len1,len2,m,n,node,offset,path,res;if(reverseTree==null){return data}res=[];for(j=0,len=data.length;j<len;j++){elem=data[j];offset=res;path=reverseTree[elem.id]!=null?reverseTree[elem.id].split("/"):"";for(l=0,len1=path.length;l<len1;l++){node=path[l];if(node.length>0){if(offset.length){found=-1;for(i=m=0,len2=offset.length;m<len2;i=++m){n=offset[i];if(n.id===node){found=i}}if(found!==-1){offset=offset[found].nodes}else{offset.push({id:node,title:$scope.translate(node),nodes:[]});offset=offset[offset.length-1].nodes}}else{offset.push({id:node,title:$scope.translate(node),nodes:[]});offset=offset[0].nodes}}}offset.push(elem)}return res};$scope.newDiff=function(){return $location.path("/"+$scope.cfg[0].cfgNum+"/"+$scope.cfg[1].cfgNum)};pathEvent=function(event,next,current){var n;n=next.match(new RegExp("#!?/(latest|[0-9]+)(?:/(latest|[0-9]+))?$"));if(n===null){$location.path("/latest")}else{$scope.waiting=true;$q.all([$translator.init($scope.lang),$http.get(staticPrefix+"reverseTree.json").then(function(response){reverseTree=response.data;return console.log("Structure loaded")}),getCfg(0,n[1]),n[2]!=null?getCfg(1,n[2]):void 0]).then(function(){if(n[2]!=null){return init()}else{if($scope.cfg[0].prev){$scope.cfg[1]=$scope.cfg[0];return getCfg(0,$scope.cfg[1].prev).then(function(){return init()})}else{$scope.data=[];return $scope.waiting=false}}},function(){$scope.message=$scope.translate("error");return $scope.waiting=false})}return true};return $scope.$on("$locationChangeSuccess",pathEvent)}])}).call(this);
(function(){var llapp;llapp=angular.module("llngConfDiff",["ui.tree","ui.bootstrap","llApp","ngCookies"],function($rootScopeProvider){return $rootScopeProvider.digestTtl(15)});llapp.controller("DiffCtrl",["$scope","$http","$q","$translator","$location",function($scope,$http,$q,$translator,$location){var buildTree,getCfg,init,pathEvent,readDiff,reverseTree,toNodes;$scope.links=links;$scope.menulinks=menulinks;$scope.staticPrefix=staticPrefix;$scope.scriptname=scriptname;$scope.availableLanguages=availableLanguages;$scope.waiting=true;$scope.showM=false;$scope.cfg=[];$scope.data={};$scope.currentNode=null;$scope.translateTitle=function(node){return $translator.translateField(node,"title")};$scope.translateP=$translator.translateP;$scope.translate=$translator.translate;$scope.toggle=function(scope){return scope.toggle()};$scope.stoggle=function(scope,node){$scope.currentNode=node;return scope.toggle()};$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.getLanguage=function(lang){$scope.lang=lang;$scope.init();return $scope.showM=false};getCfg=function(b,n){var d;d=$q.defer();if($scope.cfg[b]==null||$scope.cfg[b]!==n){$http.get(""+confPrefix+n).then(function(response){var date;if(response&&response.data){$scope.cfg[b]=response.data;date=new Date(response.data.cfgDate*1e3);$scope.cfg[b].date=date.toLocaleString();console.log("Metadatas of cfg "+n+" loaded");return d.resolve("OK")}else{return d.reject(response)}},function(response){console.log(response);return d.reject("NOK")})}else{d.resolve()}return d.promise};init=function(){var d;$scope.message=null;$scope.currentNode=null;d=$q.defer();return $http.get(scriptname+"diff/"+$scope.cfg[0].cfgNum+"/"+$scope.cfg[1].cfgNum).then(function(response){var data;data=[];data=readDiff(response.data[0],response.data[1]);$scope.data=buildTree(data);$scope.message="";return $scope.waiting=false},function(response){return $scope.message=$scope.translate("error")+" : "+response.statusLine})};readDiff=function(c1,c2,tr){var k,res,tmp,v;if(tr==null){tr=true}res=[];for(k in c1){v=c1[k];if(tr){tmp={title:$scope.translate(k),id:k}}else{tmp={title:k}}if(!k.match(/^cfg(?:Num|Log|Author(?:IP)?|Date)$/)){if(v!=null&&typeof v==="object"){if(v.constructor==="array"){tmp.oldvalue=v;tmp.newvalue=c2[k]}else if(typeof c2[k]==="object"){tmp.nodes=readDiff(c1[k],c2[k],false)}else{tmp.oldnodes=toNodes(v,"old")}}else{tmp.oldvalue=v;tmp.newvalue=c2[k]}res.push(tmp)}}for(k in c2){v=c2[k];if(!(k.match(/^cfg(?:Num|Log|Author(?:IP)?|Date)$/)||c1[k]!=null)){if(tr){tmp={title:$scope.translate(k),id:k}}else{tmp={title:k}}if(v!=null&&typeof v==="object"){if(v.constructor==="array"){tmp.newvalue=v}else{console.log("Iteration");tmp.newnodes=toNodes(v,"new")}}else{tmp.newvalue=v}res.push(tmp)}}return res};toNodes=function(c,s){var k,res,tmp,v;res=[];for(k in c){v=c[k];tmp={title:k};if(typeof v==="object"){if(v.constructor==="array"){tmp[s+"value"]=v}else{tmp[s+"nodes"]=toNodes(c[k],s)}}else{tmp[s+"value"]=v}res.push(tmp)}return res};reverseTree=[];buildTree=function(data){var elem,found,i,j,l,len,len1,len2,m,n,node,offset,path,res;if(reverseTree==null){return data}res=[];for(j=0,len=data.length;j<len;j++){elem=data[j];offset=res;path=reverseTree[elem.id]!=null?reverseTree[elem.id].split("/"):"";for(l=0,len1=path.length;l<len1;l++){node=path[l];if(node.length>0){if(offset.length){found=-1;for(i=m=0,len2=offset.length;m<len2;i=++m){n=offset[i];if(n.id===node){found=i}}if(found!==-1){offset=offset[found].nodes}else{offset.push({id:node,title:$scope.translate(node),nodes:[]});offset=offset[offset.length-1].nodes}}else{offset.push({id:node,title:$scope.translate(node),nodes:[]});offset=offset[0].nodes}}}offset.push(elem)}return res};$scope.newDiff=function(){return $location.path("/"+$scope.cfg[0].cfgNum+"/"+$scope.cfg[1].cfgNum)};pathEvent=function(event,next,current){var n;n=next.match(new RegExp("#!?/(latest|[0-9]+)(?:/(latest|[0-9]+))?$"));if(n===null){$location.path("/latest")}else{$scope.waiting=true;$q.all([$translator.init($scope.lang),$http.get(staticPrefix+"reverseTree.json").then(function(response){reverseTree=response.data;return console.log("Structure loaded")}),getCfg(0,n[1]),n[2]!=null?getCfg(1,n[2]):void 0]).then(function(){if(n[2]!=null){return init()}else{if($scope.cfg[0].prev){$scope.cfg[1]=$scope.cfg[0];return getCfg(0,$scope.cfg[1].prev).then(function(){return init()})}else{$scope.data=[];return $scope.waiting=false}}},function(){$scope.message=$scope.translate("error");return $scope.waiting=false})}return true};return $scope.$on("$locationChangeSuccess",pathEvent)}])}).call(this);
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -9,7 +9,7 @@
<div id="menu">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#"><i class="fa fa-home"></i></a>
<a class="navbar-brand" href="/"><i class="fa fa-home"></i></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
......
......@@ -114,23 +114,25 @@ ok(
);
count(1);
my $idpId = expectCookie($res);
#my ( $host, $tmp );
#( $host, $tmp, $query ) = expectForm( $res, '#', undef, 'confirm' );
expectRedirection( $res,
qr#^http://auth.rp.com/?\?openidconnectcallback=1\#(.*)$# );
## Bypass consent
# my ( $host, $tmp );
# ( $host, $tmp, $query ) = expectForm( $res, '#', undef, 'confirm' );
ok(
$res = $op->_post(
$url,
IO::String->new($query),
accept => 'text/html',
cookie => "lemonldap=$idpId",
length => length($query),
),
"Post confirmation, endpoint $url"
);
count(1);
# expectRedirection( $res,
# qr#^http://auth.rp.com/?\?openidconnectcallback=1\#(.*)$# );
# ok(
# $res = $op->_post(
# $url,
# IO::String->new($query),
# accept => 'text/html',
# cookie => "lemonldap=$idpId",
# length => length($query),
# ),
# "Post confirmation, endpoint $url"
# );
# count(1);
($query) = expectRedirection( $res,
qr#^http://auth.rp.com/?\?openidconnectcallback=1\#(.*)$# );
......
......@@ -115,6 +115,7 @@ ok(
count(1);
my $idpId = expectCookie($res);
## Consent required
my ( $host, $tmp );
( $host, $tmp, $query ) = expectForm( $res, '#', undef, 'confirm' );
......@@ -171,23 +172,24 @@ ok(
"Post authentication, endpoint $url"
);
count(1);
expectRedirection( $res,
qr#^http://auth.rp.com/?\?openidconnectcallback=1\#(.*)$# );
$idpId = expectCookie($res);
# expectRedirection( $res,
# qr#^http://auth.rp.com/?\?openidconnectcallback=1\#(.*)$# );
ok(
$res = $op->_post(
$url,
IO::String->new($query),
accept => 'text/html',
cookie => "lemonldap=$idpId",
length => length($query),
),
"Post confirmation, endpoint $url"
);
count(1);
# ok(
# $res = $op->_post(
# $url,
# IO::String->new($query),
# accept => 'text/html',
# cookie => "lemonldap=$idpId",
# length => length($query),
# ),
# "Post confirmation, endpoint $url"
# );
#count(1);
#print STDERR Dumper($query);
$op->logout($idpId);
clean_sessions();
done_testing( count() );
......
......@@ -6,7 +6,7 @@ require 't/test-lib.pm';
my $res;
my $maintests = 14;
my $maintests = 16;
SKIP: {
eval 'use GD::SecurityImage;use Image::Magick;';
if ($@) {
......@@ -17,6 +17,7 @@ SKIP: {
{ ini => {
logLevel => 'error',
useSafeJail => 1,
loginHistoryEnabled => 1,
captcha_login_enabled => 1,
portalMainLogo => 'common/logos/logo_llng_old.png',
}
......@@ -43,21 +44,29 @@ SKIP: {
ok( $ts = getCache()->get($token), ' Found token session' );
$ts = eval { JSON::from_json($ts) };
ok( $captcha = $ts->{captcha}, ' Found captcha value' );
ok( $res->[2]->[0] =~ qr%<img src="/static/common/logos/logo_llng_old.png"%,
'Found custom Main Logo' )
or print STDERR Dumper( $res->[2]->[0] );
ok( $res->[2]->[0]
=~ qr%<img src="/static/common/logos/logo_llng_old.png"%,
'Found custom Main Logo'
) or print STDERR Dumper( $res->[2]->[0] );
# Try to authenticate
$query .= "&user=dwho&password=dwho&captcha=$captcha";
$query .= "&user=dwho&password=dwho&captcha=$captcha&checkLogins=1";
ok( $res = $client->_post(
'/',
IO::String->new($query),
length => length($query)
length => length($query),
accept => 'text/html',
),
'Try to auth with captcha value'
);
expectOK($res);
my $id = expectCookie($res);
ok( $res->[2]->[0] =~ /trspan="lastLogins"/, 'History found' )
or explain( $res->[2]->[0], 'trspan="noHistory"' );
my @c = ( $res->[2]->[0] =~ /<td>127.0.0.1/gs );
# History with 1 successLogin
ok( @c == 1, " -> One entry found" );
# Verify auth
ok( $res = $client->_get( '/', cookie => "lemonldap=$id" ),
......
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