use Test::More; use strict; use IO::String; require 't/test-lib.pm'; my $res; my $maintests = 3; SKIP: { skip 'LLNGTESTLDAP is not set', $maintests unless ( $ENV{LLNGTESTLDAP} ); require 't/test-ldap.pm'; my $client = LLNG::Manager::Test->new( { ini => { logLevel => 'error', useSafeJail => 1, authentication => 'LDAP', portal => 'http://auth.example.com/', userDB => 'Same', passwordDB => 'LDAP', portalRequireOldPassword => 1, ldapServer => 'ldap://127.0.0.1:19389/', ldapBase => 'ou=users,dc=example,dc=com', managerDn => 'cn=admin,dc=example,dc=com', managerPassword => 'admin', } } ); my $postString = 'user=' . ( $ENV{LDAPACCOUNT} || 'dwho' ) . '&password=' . ( $ENV{LDAPPWD} || 'dwho' ); # Try yo authenticate # ------------------- ok( $res = $client->_post( '/', IO::String->new($postString), length => length($postString) ), 'Auth query' ); expectOK($res); my $id = expectCookie($res); ok( $res = $client->_post( '/', IO::String->new( 'oldpassword=dwho&newpassword=test&confirmpassword=test'), cookie => "lemonldap=$id", accept => 'application/json', length => 54 ), 'Change password' ); expectOK($res); $client->logout($id); ok( $res = $client->_post( '/', IO::String->new('user=dwho&password=test'), cookie => "lemonldap=$id", length => 23 ), 'Auth query with new password' ); expectOK($res); $id = expectCookie($res); $client->logout($id); clean_sessions(); } count($maintests); stopLdapServer() if $ENV{LLNGTESTLDAP}; done_testing( count() );