-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathalma.wayf.inc
42 lines (38 loc) · 984 Bytes
/
alma.wayf.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* @file
* Implements functions used to log users into the system through WAYF.
*/
/**
* Implements hook_wayf_login_credentials().
*
* Used to set the name and password to log into the library system after WAYF
* login.
*/
function alma_wayf_login_credentials($authentication_attributes) {
$hash = variable_get('wayf_hash', '');
$credentials = array();
if ($hash) {
$credentials = array(
'name' => $authentication_attributes['schacPersonalUniqueID'],
'pass' => $hash,
);
}
else {
// Set message that hash value was not found.
watchdog('alma', 'The WAYF hash value has not been set in setting.php as $conf[\'wayf_hash\'] and WAYF login will fail.', WATCHDOG_ERROR);
}
return $credentials;
}
/**
* Implements hook_wayf_attributes().
*
* Used to define which attribute to use as login name.
*/
function alma_wayf_attributes() {
return array(
'schacPersonalUniqueID' => array(
'field' => 'CPR',
),
);
}