You are here

public function Authmap::getAuthData in External Authentication 8

Same name and namespace in other branches
  1. 2.0.x src/Authmap.php \Drupal\externalauth\Authmap::getAuthData()

Get the external authname & extra data for a given user ID.

Parameters

int $uid: The Drupal user ID.

string $provider: The name of the service providing external authentication.

Return value

array An array with authname & data values.

Overrides AuthmapInterface::getAuthData

File

src/Authmap.php, line 76

Class

Authmap
Class Authmap.

Namespace

Drupal\externalauth

Code

public function getAuthData($uid, $provider) {
  $data = $this->connection
    ->select('authmap', 'am')
    ->fields('am', [
    'authname',
    'data',
  ])
    ->condition('uid', $uid)
    ->condition('provider', $provider)
    ->range(0, 1)
    ->execute()
    ->fetchAssoc();
  return $data;
}