-
Notifications
You must be signed in to change notification settings - Fork 7
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 support for WAYFless URLs #172
Conversation
3de9643
to
e97f3e7
Compare
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.
@vbessonov I found a potential source of the test failures. I'd especially like to confirm your intentions for the return from SAMLWAYFlessAcquisitionLinkProcessor.fulfil
in some cases.
api/saml/wayfless.py
Outdated
""" | ||
return get_one(db, ExternalIntegration, id=self._external_integration_id) | ||
|
||
def fulfil( |
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.
The method name is misspelled here and should probably be "fulfill" (ending in two l
s).
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.
Thanks for noticing it. I found quite a lot of similar typos in the code and tried to fix all of them.
api/saml/wayfless.py
Outdated
|
||
fulfillment.content_link = acquisition_link | ||
|
||
return fulfillment |
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.
Unless both acquisition_link_template
and saml_credential
end up set, no fulfillment
will be returned by this method, so the caller will back get None
. Was that the intention?
I suspect that this should be dedented two levels to the main level of this function, so that the fulfillment
-- modified or not -- is always returned. The failing tests -- and all of the api
tests pass with this change.
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.
There are the following cases:
- No
acquisition_link_template
. In this case CM must return the existingFulfillmentInfo
object. acquisition_link_template
exists but there is nosaml_credential
. In this case I think we need to raise an error: we expect the patron to be authenticated using SAML but there is noCredential
object in the database. It probably means that there is some configuration error and either SAML Auth Provider or collection'sacquisition_link_template
are not configured properly. Returning the existingFulfillmentInfo
object will not work because content provider expects a WAYFless URL.acquisition_link_template
,saml_credential
are present but there is nosaml_subject.idp
. In this case we need to raise an error because we cannot form the WAYFless URL without IdP's entityID. Returning the existingFulfillmentInfo
object will again not work because the content provider expects a WAYFless URL.
50f1373
to
b585811
Compare
I just pushed a commit that reorganizes at least some of the system into a mixin-based system. It's not expected to be usable in this form yet, and there are test failures. Thought I'd get the work so far pushed so that I can go back to working on LCP. |
f937734
to
1577c87
Compare
This appears to be ready to review. |
…isitionLinkProcessor.fulfill
…lment post-processor.
This starts the move away from an inheritance based configuration model to an aggregation model where configurations are comprised of mixins. This retrofits the recently added FormatPriorities configuration in order to demonstrate how the model works with multiple distinct configuration types. Currently, there are a few test failures in the OPDS importer tests. This is because the SAML code now doesn't use the correct API to fetch configuration information. Affects: https://www.notion.so/lyrasis/WAYFless-URL-Support-7c201b7af25d4fddb61e70cacc47660c
1577c87
to
e706a48
Compare
This is even more ready for review than before. |
I can see no issues with the code 👍 |
I am going to merge this PR with a couple of caveats:
|
Caveats
The WAYFless URL functionality has not been fully tested. See caveats comment below in this PR.
Description
This PR adds support for WAYFless URLs.
There is a new called setting
SAML WAYFless URL Template
used for configuring acquisition link templates as described below:Now it's available only for OPDS collections.
In order to add this config setting to other collection, you need:
SAMLWAYFlessConfiguration
to the collection's configuration settings list:SAMLWAYFlessConfiguration
class as a parent of their configuration class:SAMLWAYFlessConfiguration
's properties to the collection'sSETTINGS
list directly:CirculationAPI.default_fulfilment_post_processors_map
:This will inject
SAMLWAYFlessAcquisitionLinkProcessor
to the fulfilment processing chain and will be calling it to do post-processing ofFulfilmentInfo
objects fulfilled by collection integrations.Motivation and Context
The phrase "Where Are You From?" (WAYF) is often used to characterise identity provider discovery.
Generally speaking, a discovery service is a solution to the identity provider discovery problem, a longstanding problem in the federated identity management space when there are multiple identity providers available each corresponding to a specific organisation.
Discovery service provides a browser-based interface where a user selects his or her home organization (i.e., identity provider). A service provider uses this information to initiate SAML Web Browser SSO.
Please refer to examples below to understand how typical IdP discovery service pages look like:
d5c1400d11f3/Untitled.png)
To learn how a discovery service works, the SWITCH federation has an excellent series of demos that describe and illustrate how a discovery service integrates into a typical SAML flow.
A WAYFless URL, is specific to an institution with associated users and to a web-based service or resource. It enables a user from an institution to gain federated access to the service or resource in a way that bypasses the "Where Are You From?" (WAYF) page or Discovery Service step in SAML based authentication and access protocols.
Circulation Manager does not support WAYFLess URLs since it has it own unique built-in discovery service:
However, many prominent Ebook Content Vendors such as ProQuest, Springer, Taylor and Francis, FULCRUM, etc. use WAYFLess URLs.
How Has This Been Tested?
I tested the script using the SAML testbed :
Comment out
es
,db
,cm
,cm-test
services in docker-compose.yml.Run the SAML testbed:
Set up the local Circulation Manager as it's described in the SAML testbed's README file.
Set
SAML WAYFless URL Template
configuration setting ofopds.hilbertteam.net
collection tohttps://fsso.springer.com/saml/login?idp={idp}&targetUrl={targetUrl}
:Run circulation-test:
NOTE: Replace
http://localhost:6500
with the local CM's URL.Authenticate using different credentials from a list of built-in users.
In
circulation-test
first borrowA Dictionary in Hindi and English
and then download it:Notice that CM redirected to the Springer website because it was set up as
SAML WAYFless URL Template
:Checklist