Exemple #1
0
 /**
  * Initialization of tests definitions
  * 
  * @since GIT: 0.1.0
  * @version GIT: 0.1.0
  */
 public function setUp()
 {
     global $data;
     $this->data = $data;
     $ipa = new \FreeIPA\APIAccess\Main($data['host'], $data['cert']);
     $r = $ipa->connection()->authenticate($data['user'], $data['pass']);
     if (false === $r) {
         $this->markTestIncomplete('This test need a connection with the server');
     }
     $this->setInstance($ipa);
 }
Exemple #2
0
 */
ini_set('display_errors', 1);
ini_set('track_errors', 1);
ini_set('html_errors', 1);
error_reporting(E_ALL);
require_once 'functions_utils.php';
$host = 'ipa.demo1.freeipa.org';
// The certificate can be obtained in https://$host/ipa/config/ca.crt
$certificate = __DIR__ . "/../certs/ipa.demo1.freeipa.org_ca.crt";
$user = '******';
$password = '******';
$search = 'test';
$random = rand(1, 9999);
require_once '../bootstrap.php';
try {
    $ipa = new \FreeIPA\APIAccess\Main($host, $certificate);
    //$ipa->connection($host, $certificate);
} catch (Exception $e) {
    _print("[instance] Exception. Message: {$e->getMessage()} Code: {$e->getCode()}");
    die;
}
// If you wish to force the use of one specific version of API (for example:
// after make tests in the code and define that he does not work with different
// versions).
//$ipa->connection()->setAPIVersion('2.112');
// Make authentication
try {
    $ret_aut = $ipa->connection()->authenticate($user, $password);
    if (TRUE === $ret_aut) {
        // user is authenticate
        _print('Authentication successful');