Skip to content
Snippets Groups Projects
Commit d844feb7 authored by Demian Katz's avatar Demian Katz
Browse files

Added support for the cat_password attribute to be pulled from Shibboleth Attributes.

Resolves VUFIND-866; thanks to Tom Misilo for much of the code.
parent 26ba40a0
No related merge requests found
......@@ -335,6 +335,7 @@ database = mysql://root@localhost/vufind
; Some or all of the following entries may be uncommented to map Shibboleth
; attributes to user database columns:
;cat_username = HTTP_ALEPH_ID
;cat_password = HTTP_CAT_PASSWORD
;email = HTTP_MAIL
;firstname = HTTP_FIRST_NAME
;lastname = HTTP_LAST_NAME
......
......@@ -94,17 +94,31 @@ class Shibboleth extends AbstractBase
// If we made it this far, we should log in the user!
$user = $this->getUserTable()->getByUsername($username);
// Variable to hold catalog password (handled separately from other
// attributes since we need to use saveCredentials method to store it):
$catPassword = null;
// Has the user configured attributes to use for populating the user table?
$attribsToCheck = array(
"cat_username", "email", "lastname", "firstname", "college", "major",
"home_library"
'cat_username', 'cat_password', 'email', 'lastname', 'firstname',
'college', 'major', 'home_library'
);
foreach ($attribsToCheck as $attribute) {
if (isset($shib->$attribute)) {
$user->$attribute = $request->getServer()->get($shib->$attribute);
$value = $request->getServer()->get($shib->$attribute);
if ($attribute != 'cat_password') {
$user->$attribute = $value;
} else {
$catPassword = $value;
}
}
}
// Save credentials if applicable:
if (!empty($catPassword) && !empty($user->cat_username)) {
$user->saveCredentials($user->cat_username, $catPassword);
}
// Save and return the user object:
$user->save();
return $user;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment