Discover which external authentication module(s) authenticated a username.
$authname: A username used by an external authentication module.
An associative array with module as key and username as value.
function user_get_authmaps($authname = NULL) {
$authmaps = db_query("SELECT module, authname FROM {authmap} WHERE authname = :authname", array(
':authname' => $authname,
))
->fetchAllKeyed();
return count($authmaps) ? $authmaps : 0;
}