Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
871740a927
49
_example/test/cas.php
Executable file
49
_example/test/cas.php
Executable file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
require_once("/usr/share/php/CAS.php");
|
||||
phpCAS::setDebug();
|
||||
$host = $_SERVER{'SERVER_NAME'};
|
||||
$host_components = explode( ".", $host);
|
||||
$cas_host = "auth.".$host_components[1].".".$host_components[2];
|
||||
$cas_port = 443;
|
||||
$cas_context = "/cas";
|
||||
|
||||
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
|
||||
|
||||
phpCAS::setNoCasServerValidation();
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
if (isset($_REQUEST['logout'])) {
|
||||
phpCAS::logout();
|
||||
}
|
||||
|
||||
?>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>CAS PHP test</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>CAS PHP test</h1>
|
||||
<p>The user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
|
||||
<h3>User Attributes</h3>
|
||||
<ul>
|
||||
<?php
|
||||
foreach (phpCAS::getAttributes() as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
echo '<li>', $key, ':<ol>';
|
||||
foreach ($value as $item) {
|
||||
echo '<li><strong>', $item, '</strong></li>';
|
||||
}
|
||||
echo '</ol></li>';
|
||||
} else {
|
||||
echo '<li>', $key, ': <strong>', $value, '</strong></li>' . PHP_EOL;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
|
||||
<p><a href="?logout=">Logout</a></p>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -10,6 +10,7 @@ use MIME::Base64
|
|||
use URI::Escape;
|
||||
use CGI;
|
||||
use Data::Dumper;
|
||||
$Data::Dumper::Useperl = 1;
|
||||
use utf8;
|
||||
use Digest::SHA
|
||||
qw/hmac_sha256_base64 hmac_sha384_base64 hmac_sha512_base64 sha256 sha256_base64 sha384_base64 sha512_base64/;
|
||||
|
@ -660,8 +661,8 @@ else {
|
|||
my $ui_locales = uri_escape("fr-CA en-GB en fr-FR fr");
|
||||
my $login_hint = uri_escape("coudot");
|
||||
my $max_age = 3600;
|
||||
my $id_token_hint =
|
||||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhenAiOiJsZW1vbmxkYXAiLCJzdWIiOiJjb3Vkb3RAbGluYWdvcmEuY29tIiwiaWF0IjoxNDI3Mjk5MjMyLCJhdXRoX3RpbWUiOjE0MjcyOTYwNTQsImV4cCI6IjM2MDAiLCJub25jZSI6IjEyMzQ1Njc4OTAiLCJhdWQiOlsibGVtb25sZGFwIl0sImF0X2hhc2giOiJwZEdBcG9lVE8tNTM0el9XQ2wxcUtRIiwiYWNyIjoibG9hLTIiLCJpc3MiOiJodHRwOi8vYXV0aC5leGFtcGxlLmNvbS8ifQ==.R7nddv9bom+J2hyrTe/7a4mRupJAoDioBYaop+Q94Fg";
|
||||
my $id_token_hint = "";
|
||||
#"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhenAiOiJsZW1vbmxkYXAiLCJzdWIiOiJjb3Vkb3RAbGluYWdvcmEuY29tIiwiaWF0IjoxNDI3Mjk5MjMyLCJhdXRoX3RpbWUiOjE0MjcyOTYwNTQsImV4cCI6IjM2MDAiLCJub25jZSI6IjEyMzQ1Njc4OTAiLCJhdWQiOlsibGVtb25sZGFwIl0sImF0X2hhc2giOiJwZEdBcG9lVE8tNTM0el9XQ2wxcUtRIiwiYWNyIjoibG9hLTIiLCJpc3MiOiJodHRwOi8vYXV0aC5leGFtcGxlLmNvbS8ifQ==.R7nddv9bom+J2hyrTe/7a4mRupJAoDioBYaop+Q94Fg";
|
||||
|
||||
my $request_paylod_hash = {
|
||||
response_type => "code",
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use Data::Dumper;
|
||||
use Plack::Builder;
|
||||
|
||||
# Basic test app
|
||||
|
|
|
@ -2,7 +2,6 @@ package Lemonldap::NG::Common::Cli;
|
|||
|
||||
use strict;
|
||||
use Mouse;
|
||||
use Data::Dumper;
|
||||
use Lemonldap::NG::Common::Conf;
|
||||
|
||||
our $VERSION = '2.0.0';
|
||||
|
|
|
@ -9,7 +9,6 @@ use strict;
|
|||
use Mouse;
|
||||
use Crypt::OpenSSL::RSA;
|
||||
use Crypt::OpenSSL::X509;
|
||||
use Data::Dumper;
|
||||
use HTML::Template;
|
||||
use MIME::Base64;
|
||||
use Safe;
|
||||
|
|
|
@ -131,7 +131,7 @@ sub oldUnserialize {
|
|||
if ( $k =~ $hashParameters and $v ||= {} and not ref($v) ) {
|
||||
$conf->{$k} = {};
|
||||
|
||||
# Value should be a Data::Dumper, else this is an old format
|
||||
# Value should be a Data::Dumper, else this is an old-old format
|
||||
if ( defined($v) and $v !~ /^\$/ ) {
|
||||
|
||||
$Lemonldap::NG::Common::Conf::msg .=
|
||||
|
|
|
@ -125,6 +125,7 @@ sub jsonResponse {
|
|||
or die "PSGI lib has refused my get, aborting";
|
||||
unless ( $res->[0] == 200 ) {
|
||||
require Data::Dumper;
|
||||
$Data::Dumper::Useperl = 1;
|
||||
print STDERR "Result dump :\n" . Data::Dumper::Dumper($res);
|
||||
die "Manager lib does not return a 200 code, aborting";
|
||||
}
|
||||
|
@ -139,6 +140,7 @@ sub jsonPostResponse {
|
|||
or die "PSGI lib has refused my post, aborting";
|
||||
unless ( $res->[0] == 200 ) {
|
||||
require Data::Dumper;
|
||||
$Data::Dumper::Useperl = 1;
|
||||
print STDERR "Result dump :\n" . Data::Dumper::Dumper($res);
|
||||
die "Manager lib does not return a 200 code, aborting";
|
||||
}
|
||||
|
@ -153,6 +155,7 @@ sub jsonPutResponse {
|
|||
or die "PSGI lib has refused my put, aborting";
|
||||
unless ( $res->[0] == 200 ) {
|
||||
require Data::Dumper;
|
||||
$Data::Dumper::Useperl = 1;
|
||||
print STDERR "Result dump :\n" . Data::Dumper::Dumper($res);
|
||||
die "Manager lib does not return a 200 code, aborting";
|
||||
}
|
||||
|
|
|
@ -117,8 +117,6 @@ sub handlerAbort {
|
|||
sub handler {
|
||||
my ( $self, $req ) = @_;
|
||||
|
||||
#print STDERR Dumper($self->routes);use Data::Dumper;
|
||||
|
||||
# Reinitialize configuration message
|
||||
$Lemonldap::NG::Common::Conf::msg = '';
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ package Lemonldap::NG::Handler::Lib::Status;
|
|||
use strict;
|
||||
use POSIX qw(setuid setgid);
|
||||
use JSON qw(to_json);
|
||||
use Data::Dumper;
|
||||
|
||||
our $VERSION = '2.0.0';
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use Test::More;
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
use MIME::Base64;
|
||||
|
||||
require 't/test-psgi-lib.pm';
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use Test::More;
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
use MIME::Base64;
|
||||
|
||||
require 't/test-psgi-lib.pm';
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use Test::More;
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
use MIME::Base64;
|
||||
|
||||
require 't/test-psgi-lib.pm';
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use Test::More;
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
use MIME::Base64;
|
||||
|
||||
require 't/test-psgi-lib.pm';
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use Test::More;
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
use MIME::Base64;
|
||||
use LWP::UserAgent;
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use Test::More;
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
use MIME::Base64;
|
||||
|
||||
BEGIN {
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
# Base library for tests
|
||||
|
||||
use strict;
|
||||
use Data::Dumper;
|
||||
use 5.10.0;
|
||||
use POSIX 'strftime';
|
||||
use_ok('Lemonldap::NG::Common::PSGI::Cli::Lib');
|
||||
|
||||
our $client;
|
||||
our $count = 1;
|
||||
$Data::Dumper::Deparse = 1;
|
||||
|
||||
no warnings 'redefine';
|
||||
|
||||
|
|
|
@ -215,6 +215,11 @@ sub attributes {
|
|||
return {
|
||||
|
||||
# Other
|
||||
logLevel => {
|
||||
type => 'text',
|
||||
documentation => 'Log level, must be set in .ini',
|
||||
flags => 'hmp',
|
||||
},
|
||||
configStorage => {
|
||||
type => 'text',
|
||||
documentation => 'Configuration storage',
|
||||
|
|
|
@ -6,6 +6,7 @@ use Data::Dumper;
|
|||
use Lemonldap::NG::Common::Conf::ReConstants;
|
||||
|
||||
our $VERSION = '2.0.0';
|
||||
$Data::Dumper::Useperl = 1;
|
||||
|
||||
extends('Lemonldap::NG::Manager::Cli::Lib');
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ sub hdebug {
|
|||
foreach my $d (@_) {
|
||||
if ( ref $d ) {
|
||||
require Data::Dumper;
|
||||
$Data::Dumper::Useperl = 1;
|
||||
print STDERR Data::Dumper::Dumper($d);
|
||||
}
|
||||
else { print STDERR "$d\n" }
|
||||
|
|
|
@ -32,7 +32,8 @@ $refConf->{cfgLog} = '';
|
|||
|
||||
# Sort keys
|
||||
$Data::Dumper::Sortkeys = 1;
|
||||
my $tmp = Dumper($refConf);
|
||||
$Data::Dumper::Useperl = 1;
|
||||
my $tmp = Dumper($refConf);
|
||||
|
||||
my $refFile = File::Temp->new( UNLINK => 1 );
|
||||
my $editFile = File::Temp->new( UNLINK => 1 );
|
||||
|
@ -68,12 +69,13 @@ if (`diff $refFile $editFile`) {
|
|||
{
|
||||
refConf => $refConf,
|
||||
newConf => $VAR1,
|
||||
req => 1,
|
||||
req => 1,
|
||||
}
|
||||
);
|
||||
unless($parser->testNewConf) {
|
||||
unless ( $parser->testNewConf ) {
|
||||
print STDERR "Configuration seems to have some errors:\n ";
|
||||
print STDERR Dumper({errors => $parser->errors,warnings => $parser->warnings});
|
||||
print STDERR Dumper(
|
||||
{ errors => $parser->errors, warnings => $parser->warnings } );
|
||||
print STDERR "Are you sure you want to write it ? (yes/no) ";
|
||||
my $resp = <STDIN>;
|
||||
die "Aborted" unless $resp =~ /^yes$/i;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
use Test::More;
|
||||
use strict;
|
||||
use Data::Dumper;
|
||||
|
||||
my $formDir = 'site/htdocs/static/forms';
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@ foreach my $query (@bad) {
|
|||
or print STDERR "# Receive a $res->[0] code";
|
||||
my $href;
|
||||
|
||||
#print STDERR Dumper($res->[2]);use Data::Dumper;
|
||||
ok( $href = from_json( $res->[2]->[0] ), 'Response is JSON' );
|
||||
ok( $href->{error}, "Receive an explanation message ($href->{error})" );
|
||||
count(3);
|
||||
|
|
|
@ -29,6 +29,4 @@ ok( $res->[0] == 200, "Result code is 200" );
|
|||
ok( $key = from_json( $res->[2]->[0] ), 'Response is JSON' );
|
||||
count(3);
|
||||
|
||||
#print STDERR Dumper($key);use Data::Dumper;
|
||||
|
||||
done_testing( count() );
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Test::More;
|
||||
use strict;
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
require 't/test-lib.pm';
|
||||
|
||||
my @struct =
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
use Test::More;
|
||||
use strict;
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
require 't/test-lib.pm';
|
||||
|
||||
my $struct = 't/jsonfiles/12-modified.json';
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Test::More;
|
||||
use strict;
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
require 't/test-lib.pm';
|
||||
|
||||
my $struct = 't/jsonfiles/14-bad.json';
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Test::More;
|
||||
use strict;
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
require 't/test-lib.pm';
|
||||
|
||||
my $struct = 't/jsonfiles/15-combination.json';
|
||||
|
|
|
@ -42,7 +42,7 @@ my @notManagedAttributes = (
|
|||
|
||||
# Other ini-only prms
|
||||
'configStorage', 'status', 'localStorageOptions', 'localStorage',
|
||||
'max2FDevices', 'max2FDevicesNameLength',
|
||||
'max2FDevices', 'max2FDevicesNameLength', 'logLevel',
|
||||
);
|
||||
|
||||
# Words used either as attribute name and node title
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# Base library for tests
|
||||
|
||||
use strict;
|
||||
use Data::Dumper;
|
||||
use 5.10.0;
|
||||
use_ok('Lemonldap::NG::Manager::Cli::Lib');
|
||||
|
||||
|
|
|
@ -679,7 +679,8 @@ sub cookie {
|
|||
sub _dump {
|
||||
my ( $self, $variable ) = @_;
|
||||
require Data::Dumper;
|
||||
$Data::Dumper::Indent = 0;
|
||||
$Data::Dumper::Indent = 0;
|
||||
$Data::Dumper::Useperl = 1;
|
||||
$self->logger->debug( "Dump: " . Data::Dumper::Dumper($variable) );
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ my $debug = 'error';
|
|||
my ( $op, $rp, $res );
|
||||
my %handlerOR = ( op => [], rp => [] );
|
||||
|
||||
my $access_token;
|
||||
|
||||
LWP::Protocol::PSGI->register(
|
||||
sub {
|
||||
my $req = Plack::Request->new(@_);
|
||||
|
@ -60,6 +62,11 @@ LWP::Protocol::PSGI->register(
|
|||
' Content is JSON' )
|
||||
or explain( $res->[1], 'Content-Type => application/json' );
|
||||
count(4);
|
||||
if ( $res->[2]->[0] =~ /"access_token":"(.*?)"/ ) {
|
||||
$access_token = $1;
|
||||
pass "Found access_token $access_token";
|
||||
count(1);
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
);
|
||||
|
@ -148,6 +155,27 @@ ok( getHeader( $res, 'Content-Security-Policy' ) !~ /frame-ancestors/,
|
|||
count(1);
|
||||
|
||||
# Verify UTF-8
|
||||
ok(
|
||||
$res = $op->_get(
|
||||
'/oauth2/userinfo',
|
||||
query => 'access_token=' . $access_token,
|
||||
),
|
||||
'Get userinfo'
|
||||
);
|
||||
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
|
||||
or print STDERR $@;
|
||||
ok( $res->{name} eq 'Frédéric Accents', 'UTF-8 values' )
|
||||
or explain( $res, 'name => Frédéric Accents' );
|
||||
count(3);
|
||||
|
||||
ok( $res = $op->_get("/sessions/global/$spId"), 'Get UTF-8' );
|
||||
expectOK($res);
|
||||
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
|
||||
or print STDERR $@;
|
||||
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
|
||||
or explain( $res, 'cn => Frédéric Accents' );
|
||||
count(3);
|
||||
|
||||
switch ('rp');
|
||||
ok( $res = $rp->_get("/sessions/global/$spId"), 'Get UTF-8' );
|
||||
expectOK($res);
|
||||
|
@ -290,6 +318,7 @@ sub op {
|
|||
authentication => 'Demo',
|
||||
userDB => 'Same',
|
||||
issuerDBOpenIDConnectActivation => "1",
|
||||
restSessionServer => 1,
|
||||
oidcRPMetaDataExportedVars => {
|
||||
rp => {
|
||||
email => "mail",
|
||||
|
|
|
@ -3,7 +3,6 @@ package main;
|
|||
|
||||
use strict;
|
||||
use Data::Dumper;
|
||||
$Data::Dumper::Sortkeys = 1;
|
||||
use LWP::UserAgent;
|
||||
use URI::Escape;
|
||||
use 5.10.0;
|
||||
|
@ -15,7 +14,9 @@ BEGIN {
|
|||
}
|
||||
|
||||
our $count = 1;
|
||||
$Data::Dumper::Deparse = 1;
|
||||
$Data::Dumper::Deparse = 1;
|
||||
$Data::Dumper::Sortkeys = 1;
|
||||
$Data::Dumper::Useperl = 1;
|
||||
my $ini;
|
||||
|
||||
sub count {
|
||||
|
|
|
@ -8,7 +8,7 @@ use JSON;
|
|||
my $milestone = '2.0.0';
|
||||
my @cat = ( 'Bug', 'Improvement', 'New Feature' );
|
||||
|
||||
open F, "$ENV{HOME}/.ow2-token" or die $!;
|
||||
open F, "$ENV{HOME}/.ow2-token" or die "Unable to get OW2 token ($!)";
|
||||
my $token = join '',<F>;
|
||||
close F;
|
||||
$token =~ s/\s//sg or die "No token";
|
||||
|
|
|
@ -10,6 +10,8 @@ my $rmg =
|
|||
"^(?:(?:$Lemonldap::NG::Common::Conf::ReConstants::virtualHostKeys)|(?:$Lemonldap::NG::Common::Conf::ReConstants::casAppMetaDataNodeKeys)|(?:$Lemonldap::NG::Common::Conf::ReConstants::casSrvMetaDataNodeKeys)|(?:$Lemonldap::NG::Common::Conf::ReConstants::oidcOPMetaDataNodeKeys)|(?:$Lemonldap::NG::Common::Conf::ReConstants::oidcRPMetaDataNodeKeys)|(?:$Lemonldap::NG::Common::Conf::ReConstants::samlIDPMetaDataNodeKeys)|(?:$Lemonldap::NG::Common::Conf::ReConstants::samlSPMetaDataNodeKeys)|(?:$Lemonldap::NG::Common::Conf::ReConstants::specialNodeKeys))\$";
|
||||
$rmg = qr/$rmg/;
|
||||
|
||||
my $complexNodes = qr/^(?:(?:(?:saml(?:ID|S)|oidc[OR])P|cas(?:App|Srv))MetaData|vhost)Options$/;
|
||||
|
||||
my $ignore = qr/^(?:virtualHosts)$/;
|
||||
|
||||
open F, 'lemonldap-ng-manager/site/htdocs/static/reverseTree.json';
|
||||
|
@ -49,7 +51,7 @@ foreach my $k ( sort keys %$prm ) {
|
|||
# Manager flag
|
||||
.' | '.( $p->{flags} =~ /m/ ? $ok : '')
|
||||
# Ini-only flag
|
||||
.' | ' . ( ( $managed->{$k} or $k =~ $rmg ) ? '' : $ok )
|
||||
.' | ' . ( ( $managed->{$k} or $k =~ $rmg ) ? '' : ( $k =~ $complexNodes ? '[1]' : $ok ) )
|
||||
# End of line
|
||||
. " |\n";
|
||||
}
|
||||
|
@ -57,6 +59,8 @@ foreach my $k ( sort keys %$prm ) {
|
|||
print <<EOF;
|
||||
</sortable>
|
||||
|
||||
//[1]: complex nodes//
|
||||
|
||||
===== Configuration backend parameters =====
|
||||
|
||||
^ Full name ^ Key name ^ Configuration backend ^
|
||||
|
|
Loading…
Reference in New Issue
Block a user