-
Notifications
You must be signed in to change notification settings - Fork 360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CAS Authentication for VuFind VUFIND-422 #13
Conversation
Composer updates will be in the following commit
Supersedes #12 |
@bemosior this should resolve the issue you were having. |
I got this mostly implemented today. For the most part, everything appears to be working well. Thoughts/questions:
That's all I found. Thanks for putting this together! |
What do you mean by this, that is what the
I am working on adding the cat_password field to both the CAS and Shibboleth Auth (https://github.com/misilot/vufind/commit/86f4d41780c7b4eb8d9c333f7b59d3bdecf9491a and #15 ).
I think this is a VuFind quirk, as I think this is how it acted. Not sure if there is a way or where a good place would be in order to add in a
|
VuFind uses an internal Thanks! |
;[CAS] | ||
|
||
; Required: the attribute CAS uses to uniquely identify users. | ||
;username = uid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what sets the VuFind username in the database. Not sure if I am still missing something.
It might just be confusion on my part. CAS returns a principal in the SAML assertion that is literally what the user types into the username field. The question is which "attribute" can be used to to assign the principal to a VuFind user field. In the below example, "bemosior" is the principal:
It doesn't seem to have an attribute name in the same sense as "catalog_barcode". |
Regarding running \phpCAS::checkAuthentication(); on every page load, you might be able to achieve that with ZF2's event system if it's actually necessary.... but I don't know enough about CAS to fully understand the situation; is there a way to force targets to route throught MyResearch/Home so that this is unnecessary? |
@bemosior the saml1:NameIdentifier attribute can be gotten from the function phpCAS::getUser(), and it will return the username in whatever case the user entered it. For example. If I enter |
I agree that it sounds like you wouldn't want to use the raw user input as the VuFind username, as that could cause weird inconsistent behavior. If anything, perhaps you would want to log that as a debug message or something. |
@misilot and @demiankatz, that's a good point. I forgot that I had encountered a similar issue like that before (we ended up dealing with it cheaply by using fn:toLowerCase because the situation allowed), so the username question is a non-issue. As far as the PR, I think we're in good shape once the cat_password is routed through saveCredentials(). |
@bemosior When you have a chance can you test this? Thanks! |
I'm away on vacation and unable to test until the 26th; I apologize for the delay! |
…ulled from the config file) Thanks to Brad Busenius.
Resolves VUFIND-815.
…serves/new items). Resolves VUFIND-873; thanks to David Lacy for reporting the problem.
@bemosior No problem. Thanks :) Enjoy your vacation. |
Minor improvements for release 2.1 (mostly search system related)
Too bad regarding phpCAS -- sounds like dev-master is the best option for now, but we should change it to a stable release as soon as that becomes possible. I need to read up on all the features of the PR system; I know that I could be using it better than I am at the moment, but I haven't taken the time to study all the possibilities. |
Composer updates will be in the following commit
…ASAuth-VUFIND-422
Made recommended changes for storing the cat_password as a temp value. |
I had an interesting problem with getting the catalog password to be populated. After some debugging, I found a typo:
That seems to fix the issue for both encrypted and unencrypted catalog password fields. I'm also having problems with convincing VuFind to use those credentials to authenticate against the ILS, but that is probably a local config issue. I'll work on figuring it out in the meantime (I need to anyway). |
Since there have been a couple of releases since I created this PR, I am going to replace this PR with a current one, so it can be included possible in one of the next releases. I will close this PR once the new one is made. (That way I can find the code :) ) |
Sounds good -- I don't think there have been any major changes that should affect this code, so hopefully updating the PR won't be too much work. I've been waiting to hear more from Benjamin before merging this -- any news on those ILS authentication issues? |
I'm having some idiot issues with Voyager authentication and VF2. I'll post on the list early next week to hopefully work through it, but there's no reason the CAS authentication shouldn't work based on the testing I completed previously. |
Thanks for the clarification. In that case, I'll review and merge the new PR as soon as it arrives. |
Disable PCI recordimages.
fixes style issues in DAIA.php and PAIA.php
This corrects a problem with new VuFind users being created from a Shibboleth login. Without this change, we see this exception and stack trace: ``` 2024-10-07T14:04:23-04:00 ERR (3): VuFind\Auth\Manager: Laminas\Db\RowGateway\Exception\InvalidArgumentException: Not a valid column in this row: cat_password in /usr/local/vufind-pmalibrary/vendor/laminas/laminas-db/src/RowGateway/AbstractRowGateway.php:294 Stack trace: #0 /usr/local/vufind-pmalibrary/module/VuFind/src/VuFind/Db/Row/User.php(964): Laminas\Db\RowGateway\AbstractRowGateway->__get() vufind-org#1 /usr/local/vufind-pmalibrary/module/VuFind/src/VuFind/Auth/ILSAuthenticator.php(224): VuFind\Db\Row\User->getRawCatPassword() vufind-org#2 /usr/local/vufind-pmalibrary/module/VuFind/src/VuFind/Auth/Shibboleth.php(240): VuFind\Auth\ILSAuthenticator->getCatPasswordForUser() vufind-org#3 /usr/local/vufind-pmalibrary/module/VuFind/src/VuFind/Auth/Manager.php(743): VuFind\Auth\Shibboleth->authenticate() vufind-org#4 /usr/local/vufind-pmalibrary/module/VuFind/src/VuFind/Controller/MyResearchController.php(217): VuFind\Auth\Manager->login() vufind-org#5 /usr/local/vufind-pmalibrary/vendor/laminas/laminas-mvc/src/Controller/AbstractActionController.php(72): VuFind\Controller\MyResearchController->homeAction() vufind-org#6 /usr/local/vufind-pmalibrary/module/VuFind/src/VuFind/Controller/Feature/CatchIlsExceptionsTrait.php(76): Laminas\Mvc\Controller\AbstractActionController->onDispatch() vufind-org#7 /usr/local/vufind-pmalibrary/vendor/laminas/laminas-eventmanager/src/EventManager.php(319): VuFind\Controller\MyResearchController->onDispatch() vufind-org#8 /usr/local/vufind-pmalibrary/vendor/laminas/laminas-eventmanager/src/EventManager.php(177): Laminas\EventManager\EventManager->triggerListeners() vufind-org#9 /usr/local/vufind-pmalibrary/vendor/laminas/laminas-mvc/src/Controller/AbstractController.php(105): Laminas\EventManager\EventManager->triggerEventUntil() vufind-org#10 /usr/local/vufind-pmalibrary/vendor/laminas/laminas-mvc/src/DispatchListener.php(117): Laminas\Mvc\Controller\AbstractController->dispatch() vufind-org#11 /usr/local/vufind-pmalibrary/vendor/laminas/laminas-eventmanager/src/EventManager.php(319): Laminas\Mvc\DispatchListener->onDispatch() vufind-org#12 /usr/local/vufind-pmalibrary/vendor/laminas/laminas-eventmanager/src/EventManager.php(177): Laminas\EventManager\EventManager->triggerListeners() vufind-org#13 /usr/local/vufind-pmalibrary/vendor/laminas/laminas-mvc/src/Application.php(319): Laminas\EventManager\EventManager->triggerEventUntil() vufind-org#14 /usr/local/vufind-pmalibrary/public/index.php(71): Laminas\Mvc\Application->run() ```
This corrects a problem with new VuFind users being created from a Shibboleth login. Without this change, we see this exception and stack trace: ``` 2024-10-07T14:04:23-04:00 ERR (3): VuFind\Auth\Manager: Laminas\Db\RowGateway\Exception\InvalidArgumentException: Not a valid column in this row: cat_password in /usr/local/vufind-pmalibrary/vendor/laminas/laminas-db/src/RowGateway/AbstractRowGateway.php:294 Stack trace: #0 /usr/local/vufind-pmalibrary/module/VuFind/src/VuFind/Db/Row/User.php(964): Laminas\Db\RowGateway\AbstractRowGateway->__get() vufind-org#1 /usr/local/vufind-pmalibrary/module/VuFind/src/VuFind/Auth/ILSAuthenticator.php(224): VuFind\Db\Row\User->getRawCatPassword() vufind-org#2 /usr/local/vufind-pmalibrary/module/VuFind/src/VuFind/Auth/Shibboleth.php(240): VuFind\Auth\ILSAuthenticator->getCatPasswordForUser() vufind-org#3 /usr/local/vufind-pmalibrary/module/VuFind/src/VuFind/Auth/Manager.php(743): VuFind\Auth\Shibboleth->authenticate() vufind-org#4 /usr/local/vufind-pmalibrary/module/VuFind/src/VuFind/Controller/MyResearchController.php(217): VuFind\Auth\Manager->login() vufind-org#5 /usr/local/vufind-pmalibrary/vendor/laminas/laminas-mvc/src/Controller/AbstractActionController.php(72): VuFind\Controller\MyResearchController->homeAction() vufind-org#6 /usr/local/vufind-pmalibrary/module/VuFind/src/VuFind/Controller/Feature/CatchIlsExceptionsTrait.php(76): Laminas\Mvc\Controller\AbstractActionController->onDispatch() vufind-org#7 /usr/local/vufind-pmalibrary/vendor/laminas/laminas-eventmanager/src/EventManager.php(319): VuFind\Controller\MyResearchController->onDispatch() vufind-org#8 /usr/local/vufind-pmalibrary/vendor/laminas/laminas-eventmanager/src/EventManager.php(177): Laminas\EventManager\EventManager->triggerListeners() vufind-org#9 /usr/local/vufind-pmalibrary/vendor/laminas/laminas-mvc/src/Controller/AbstractController.php(105): Laminas\EventManager\EventManager->triggerEventUntil() vufind-org#10 /usr/local/vufind-pmalibrary/vendor/laminas/laminas-mvc/src/DispatchListener.php(117): Laminas\Mvc\Controller\AbstractController->dispatch() vufind-org#11 /usr/local/vufind-pmalibrary/vendor/laminas/laminas-eventmanager/src/EventManager.php(319): Laminas\Mvc\DispatchListener->onDispatch() vufind-org#12 /usr/local/vufind-pmalibrary/vendor/laminas/laminas-eventmanager/src/EventManager.php(177): Laminas\EventManager\EventManager->triggerListeners() vufind-org#13 /usr/local/vufind-pmalibrary/vendor/laminas/laminas-mvc/src/Application.php(319): Laminas\EventManager\EventManager->triggerEventUntil() vufind-org#14 /usr/local/vufind-pmalibrary/public/index.php(71): Laminas\Mvc\Application->run() ```
Supports CAS authentication with the ability to set configuration via config.ini