-
Notifications
You must be signed in to change notification settings - Fork 438
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
Ensure HALEndpointService doesn't use stale responses #2670
Ensure HALEndpointService doesn't use stale responses #2670
Conversation
@artlowel thanks for this! This seems to have made logging in more consistent. I still see a 3-4 second page on the log in screen when logging in via a url like I don't know if that's related or can be fixed so the user doesn't see that page before being sent onto the final place? |
@misilot you're welcome! The reason you're not immediately logged in when you get redirected back is because dspace still needs to call the login endpoint with the shibboleth cookie at that point. So you go to the Shibboleth server to get the credentials to log you in, but they still need to be used to do so by the time you get back to DSpace. As far as I can tell, that's the way it has always worked in DSpace 7. It's conceivable that there's a way of doing this that would be less confusing for the user, but that isn't in the scope of this PR |
I found an issue with this PR. Putting it in draft until it's fixed |
Hi @artlowel not sure if the same thing, I did notice that with this patch that when using http://localhost:4000 the shibboleth login option is not visible, but it is there when coming from our deployed site. |
@misilot maybe, if you were using dev mode. The PR worked fine in prod mode. The issue was that in dev mode the initial The symptom was that in dev mode the login dropdown would be empty, and you'd see those same I've addressed this by also introducing a ResponsePendingStale state, which didn't exist before. If something was set to stale while the response was still pending it would end up in the state ErrorStale. With this PR, If a request is set to stale while its response is still pending, the response will also be set to stale when it comes in. (The reason for that is that this might happen when you've pushed an update to the server, and even though you haven't received a response yet, since the request was made before you pushed the changes, we should treat the response as stale too) This was also to root cause of #2577 btw. So this PR should now also address the comment I made on that issue. Reviewers can verify that this is the case by rolling back the changes to #2596 on this PR, following the steps on the issue and verifying that the issue is still fixed. I would however still keep those changes as they're useful anyway. |
We (Colorado State University) tested this PR with Shibboleth login in production mode with 7.6.1 that is unmodified otherwise and it seems to resolve the issue for us. We've not gotten the |
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 @artlowel ! Tested this with our Shibboleth Docker image (using https://samltest.id/), and it appears to be working. I'm not seeing any errors and #2669 appears to be resolved (I attempted the login several times with no issues).
I also tried other areas of DSpace just to make sure there were no side effects. Attempted a regular password authentication, new submission, import from PubMed, bulk access mgt tool, collection-based theming, etc. I know none of those are related to this, but wanted to verify that there's nothing else obviously wrong.
Overall, the code looks reasonable to me. I'm not seeing any side effects & it appears to fix the bug. That all said, I would like @atarix83 's feedback before we merge this, in case he sees anything that I may have missed. Thanks!
Yup, in dev mode the Login option disappears :( |
@artlowel yup, I just reapplied the patch this morning to try the newer changes. |
@misilot Do you see any |
Nope, but now I am really confused, as the button is clearly there now. 🤔 Sorry for the noise, as it seems to be there. Just wish it would redirect back to localhost:4000 and not the server so it would consistently login to the dev environment (probably need to put a ticket in for this) Actually it seems to be there sometimes, and not there other times. |
@misilot I don't think that redirect can work on localhost. The shib server also has to be able to contact it, and since localhost is relative to the machine you run it on, it won't end up on your computer. What you can do is use your production REST API as a backend for the local client. Then, when you login from localhost, and get redirected back to your production server and are logged in there, is to open the network tools of your browser, find the |
I applied this patch at The University of Minnesota Libraries, and we are no longer encountering problems when logging in via Shibboleth. |
The same here as per my comment in DSpace/DSpace#9109 - Shibboleth issues seem to be resolved. |
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 @artlowel for this PR
I've looked at the code and it looks good to me. I've tested the application and didn't find any issue.
I've verified that this comment has been addressed by this PR.
I can't really test shibboleth authentication, but i see it's been already verified and confirmed by several institutions within this PR
Successfully created backport PR for |
Just applied this patch on 7.6.1 and it has solved the problem. Response time is okay. |
References
Description
#2669 happens because when you get redirected back from the Shibboleth server, the requests to log you in with the dspace rest api using the shib cookie tend to fail because one of those tends to be stale: it's fired just after one of these
invalidateRootCache
calls. When that happens the login process stopsInstructions for Reviewers
This PR fixes that by filtering out stale responses.
That change also makes it possible to replace the workaround in ServerCheckGuard with a call to invalidateRootCache()
This issue can happen at any time, it's not related to Shibboleth specifically. But since it's a timing issue, the easiest way I found to reliably reproduce it, is by logging in with Shibboleth
So:
undefined doesn't contain the link …
errors in the consoleChecklist
yarn lint
yarn check-circ-deps
)package.json
), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.