Closed chenejac closed 3 years ago
Andrew Woods said:
Thanks, [~accountid:5bb229e412ef2d4bf3a2233d]. Have you investigated a potential fix to the bug?
Benjamin Gross said:
[~accountid:557058:3f53c733-6ac2-4e92-9f12-e34e297283a3] Have you experienced this? I think perhaps I underestimated the breadth of the issue. I also experience the blank redirect if an externally authenticated account is unattached to a profile to begin with. The first login goes fine when VIVO asks the user for their name and email (in order to create a local VIVO account to be associated with the externally authenticated account). But the next time they login, blank page.
Brian Lowe said:
That is not something I've experienced personally, but it sounds pretty serious. I'll move this for now to a 1.12 blocker and see if the group agrees tomorrow or prefers to downgrade.
Benjamin Gross said:
Unfortunately the log is pretty unhelpful.
2021-03-30 13:08:39,001 DEBUG [LoginExternalAuthReturn] externalAuthID='grossb'
2021-03-30 13:08:39,002 DEBUG [LoginExternalAuthReturn] Logging in as https://vivo.mydomain.edu/individual/u1830
2021-03-30 13:08:39,022 DEBUG [BasicAuthenticator] Adding status bean: LoginStatusBean[userURI=https://vivo.mydomain.edu/individual/u1830, authenticationSource=EXTERNAL]
2021-03-30 13:08:39,029 DEBUG [LoginRedirector] 'test@mailinator.com' is not associated with an individual.
2021-03-30 13:08:39,029 DEBUG [LoginRedirector] User not recognized. Going to application home.
The URL the user sees on the blank page is /loginExternalAuthReturn. If they type in the URL of the home page they can see they are logged in, so seems the issue lies with the redirect, not the actual login mechanism.
Benjamin Gross said:
Added some additional items to the log. Seems to be a problem that getApplicationHomePageUrl() returns an empty string, and response.sendRedirect(""); doesn't work like expected. Perhaps I'm running into issues since my VIVO app is running at the Tomcat root?
Could probably determine a working redirect URL by slicing out the base URL from the request.
VIVO actually has a few methods for determining the home URL scattered around its codebase.
One of them must work...
Brian Lowe said:
Failing unit test
org.junit.ComparisonFailure: relative redirect expected:<[/vivo]> but was:<[null]> at org.junit.Assert.assertEquals(Assert.java:115) at edu.cornell.mannlib.vitro.webapp.controller.edit.AuthenticateTest.assertRedirect(AuthenticateTest.java:620) at edu.cornell.mannlib.vitro.webapp.controller.edit.AuthenticateTest.exitUnrecognizedSelfEditor(AuthenticateTest.java:512) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:168) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
Brian Lowe said:
Resolved in commit https://github.com/vivo-project/Vitro/commit/71ca39d597026f4ac58e1e3aa8828fddba9a59a0
Benjamin Gross (Migrated from VIVO-1736) said:
This only happens in a very specific case when using external login.
If a user login is associated with a profile, normally the user is redirected to their profile page after logging in. If there is no profile associated with the user login, they are redirected to the homepage.
The problem occurs when a user is associated with a profile, then the profile itself it deleted. I am guessing the link to the (now non-existent) profile remains and the redirect code doesn't have any logic to deal with this possibility. Instead, I am just seeing a blank page.