use Test::More; use strict; use IO::String; use LWP::UserAgent; use inc::LWP::Protocol::PSGI; use MIME::Base64; BEGIN { require 't/test-lib.pm'; require 't/saml-lib.pm'; } my $maintests = 10; my $debug = 'error'; my ( $issuer, $sp, $res ); my %handlerOR = ( issuer => [], sp => [] ); # Redefine LWP methods for tests LWP::Protocol::PSGI->register( sub { my $req = Plack::Request->new(@_); fail('POST should not launch SOAP requests'); count(1); return [ 500, [], [] ]; } ); SKIP: { eval "use Lasso"; if ($@) { skip 'Lasso not found', $maintests; } # Initialization ok( $issuer = issuer(), 'Issuer portal' ); $handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('sp'); &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; # Simple SP access my $res; ok( $res = $sp->_get( '/', accept => 'text/html', query => 'url=aHR0cDovL3Rlc3QxLmV4YW1wbGUuY29tLw==' ), 'Unauth SP request' ); expectOK($res); ok( expectCookie( $res, 'lemonldapidp' ) == 0, 'IDP cookie deleted' ) or explain( $res->[1], 'Set-Cookie => lemonldapidp=0; domain=.sp.com; path=/; expires=-1d' ); my ( $host, $url, $query ) = expectForm( $res, '#', undef, 'confirm' ); ok( $res->[2]->[0] =~ m#