2017 © Pedro Peláez
 

library opauth-ldap

Ldap strategy for Opauth

image

flexcoders/opauth-ldap

Ldap strategy for Opauth

  • Saturday, June 27, 2015
  • by WanWizard
  • Repository
  • 2 Watchers
  • 0 Stars
  • 142 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Opauth-Ldap

[Opauth][1] strategy for Ldap authentication., (*1)

Opauth is a multi-provider authentication framework for PHP., (*2)

Getting started

  1. Install Opauth-Ldap:, (*3)

    cd path_to_opauth/Strategy
    git clone git://github.com/flexcoders/opauth-ldap.git ldap
    
  2. Configure Opauth-Ldap strategy., (*4)

  3. Call it., (*5)

Since this is not an HTTP based protocol, some of the standard Opauth config does not apply. There is no redirection involved, and a username and password needs to be passed., (*6)

You call it like so:, (*7)

// some input vars
$providerName = "Ldap";

// prep a config
$config = [
    'provider' => $providerName,
    'username' => $_POST['username'],
    'password' => $_POST['password'],
    'request_uri' => '/current/uri/'.strtolower($providerName),
    'callback_url' => '/your/uri/for/callback/'.strtolower($providerName),
];

// construct the Opauth object
$this->opauth = new \Opauth($config, true);

It will attempt an LDAP login, and then redirect to the callback url, just like with all other Opauth strategies, and with a similar response., (*8)

Strategy configuration

Required parameters:, (*9)

<?php
'Ldap' => array(
    'server'        => 'ldap.forumsys.com',
    'port'          => 389,
    'bind-cn'       => 'uid=$username$',
    'bind-dn'       => 'dc=example,dc=com',
    'bind-password' => '$password$',
    'attributes'    => array(
        'uid'      => 'uidnumber',
        'name'     => 'cn',
        'email'    => 'mail',
        'username' => 'uid',
    ),
    'options'       => array(
        LDAP_OPT_PROTOCOL_VERSION => 3,
        LDAP_OPT_REFERRALS => 0,
    ),
    'expiry'        => 86400,
)

Optional parameters: expire, options, (*10)

The bind() happens on the concatenation of 'bind-cn' and 'bind-dn', and the 'bind-password'., (*11)

Make sure the attributes array contains the correct attribute mapping. On the left side are the names the Strategy is expecting. If in your schema they are called different, use the name you are using on the righthand side., (*12)

As in this example, we require an attribute called 'name', which in the schema is called 'cn'. Same for 'email' which is called 'mail' in the schema of the test server., (*13)

References

If you want to test using an LDAP server on the internet, you can use the config given above. More info about the LDAP schema used and the test server objects, see http://www.forumsys.com/tutorials/integration-how-to/ldap/online-ldap-test-server/, (*14)

License

Opauth-Ldap is MIT Licensed Copyright © 2015 FlexCoders Ltd (http://flexcoders.co.uk), (*15)

The Versions

27/06 2015

dev-master

9999999-dev http://flexcoders.co.uk

Ldap strategy for Opauth

  Sources   Download

MIT

The Requires

 

authentication auth active directory ad

04/05 2015

0.2

0.2.0.0 http://flexcoders.co.uk

Ldap strategy for Opauth

  Sources   Download

MIT

The Requires

 

authentication auth active directory ad

04/05 2015

0.1

0.1.0.0 http://flexcoders.co.uk

Active Directory strategy for Opauth

  Sources   Download

MIT

The Requires

 

authentication auth active directory ad