A PHP library for connect and use some features of the freeIPA / Red Hat Identity Management
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
certs Update the freeipa certificate Jan 17, 2018
docs first commit Nov 19, 2015
examples Version 0.2.0 Nov 24, 2015
nbproject Defined class structure; implemented more tests; almost all code is i… Nov 23, 2015
src
tests/APIAccess Version 0.2.0 Nov 24, 2015
.gitignore
.travis.yml Version 0.2.0 Nov 24, 2015
LICENSE Modified license; integration with composer, travis and scrutinizer; … Nov 22, 2015
README.md Update non-English string in README.md to English Feb 22, 2018
bootstrap.php Modified license; integration with composer, travis and scrutinizer; … Nov 22, 2015
composer.json
composer.lock Version 0.2.0 Nov 24, 2015
phpunit.xml Version 0.2.0 Nov 24, 2015

README.md

php-freeipa

A PHP library for connect and use some features of the freeIPA / Red Hat Identity Management

Build Status Scrutinizer Code Quality License Latest Stable Version

Quick start guide

Get CA certificate from server. Example:

# The certificate can be obtained in https://$host/ipa/config/ca.crt
wget --no-check-certificate https://ipa.demo1.freeipa.org/ipa/config/ca.crt -O certs/ipa.demo1.freeipa.org_ca.crt

Creates an instance

require_once('./bootstrap.php');
$host = 'ipa.demo1.freeipa.org';
$certificate = __DIR__ . "./certs/ipa.demo1.freeipa.org_ca.crt";
$ipa = new \FreeIPA\APIAccess\Main($host, $certificate);

Authenticates with the server

$user = 'admin';
$password = 'Secret123';
$auth = $ipa->connection()->authenticate($user, $password);
if ($auth) {
    print 'Logged in';
} else {
    $auth_info = $ipa->connection()->getAuthenticationInfo();
    var_dump($auth_info);
}

Showing the user information

$r = $ipa->user()->get($user);
var_dump($r);

Searching for users

$r = $ipa->user()->findBy('mail', 'user@company.com');
if ($r) {
    $t = count($r);
    print "Found $t users. Names: ";
    for ($i = 0; $i < $t; $i++) {
        print $r[$i]->uid[0] . ' | ';
    }
}

Insert a new user

$user_data = array(
    'givenname' => 'Richard',
    'sn' => 'Stallman',
    'uid' => "rms",
    'mail' => "rms@fsf.org",
    'userpassword' => 'Secret123',
);
$add_user = $ipa->user()->add($user_data);
if ($add_user) {
    print 'User added';
}

Insert a new group

$add_group = $ipa->group()->add("groupXYZ", "description of groupXYZ");
if ($add_group) {
    print 'Group added';
}

For more examples see file examples\all.php.

Roadmap

  • [] Implements more (all?) API methods
  • [] Implements more tests