You are here

private function SimpleLdapSSO::getHashedSid in Simple LDAP 7

Same name and namespace in other branches
  1. 7.2 simple_ldap_sso/SimpleLdapSSO.class.php \SimpleLdapSSO::getHashedSid()

The hashed sid, as stored on LDAP.

1 call to SimpleLdapSSO::getHashedSid()
SimpleLdapSSO::validateSid in simple_ldap_sso/SimpleLdapSSO.class.php
Validate an sid against the stored value on LDAP.

File

simple_ldap_sso/SimpleLdapSSO.class.php, line 24
SimpleLdapSSO object.

Class

SimpleLdapSSO
@file SimpleLdapSSO object.

Code

private function getHashedSid() {
  if (!isset($this->server) || !$this->server instanceof SimpleLdapServer) {
    throw new Exception(t('Unable to get hashed SID. LDAP server does not exist.'));
  }
  if (!isset($this->hashedSid)) {

    // Search for this attribute.
    $result = $this->server
      ->search($this->dn, 'objectclass=*', 'base', array(
      $this
        ->getSidAttribute(),
    ));

    // Clean up the result.
    $clean = SimpleLdap::clean($result);

    // Only set the value if we actually got a result.
    if (isset($clean[$this->dn][$this
      ->getSidAttribute()][0])) {
      $this->hashedSid = $clean[$this->dn][$this
        ->getSidAttribute()][0];
    }
  }
  return $this->hashedSid;
}