Preserve information about saml session when logging out previous user V2#90449
Conversation
…when loging out previous user""
|
PR got revert last time because of problems on Staging. I'm working setting up account/domain that I could use to test SSO flow on staging |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
@jnowakow Is it a straight revert? If it's straight revert maybe we don't need full review. Why did we revert it on the first place? There are a couple of things linked |
|
@jnowakow This was already reverted, so I think we can close this PR. Do we have any plans to open a new PR for a different fix? |
|
@pecanoro, @huult, it's straight revert. Original PR was reverted to fix this issue. Problem is that it was bug was found on staging and I can't test it on this environment. I can only test on dev where everything works fine. I've tried setting up domain that works on staging but without success now. #90114 looks like backend redirects to wrong URL so it's not issue introduced by this PR. I suspect that it's because applausetester+saml1@applause.expensifail.com is redirected back to |
|
However, I'll take a look at the links configuration and will see if something can be improved/simplified |
|
@jnowakow What are next steps then? I am bit confused about the last message 😄 |
|
Yes, we resolved this in the Slack thread: @jnowakow Please close this PR. |
@huult it's different issue |
It looks like navigation related issue not connected this one. Looks like when |
Done! |
|
@huult Friendly bump! |
@pecanoro @jnowakow has a question for the internal team and is waiting for their input: #90449 (comment) |
|
@huult All yours again! |
| const isWeb = getPlatform() === CONST.PLATFORM.WEB; | ||
| const queryString = isWeb ? `referer=ecash&authToken=${authToken}` : `appversion=${pkg.version}&referer=ecash&authToken=${authToken}`; | ||
| const expectedURL = isWeb ? CONFIG.EXPENSIFY.NEW_EXPENSIFY_URL : CONST.SAML_REDIRECT_URL; | ||
|
|
There was a problem hiding this comment.
Please remove this space, it's unnecessary.
| // Even if the user was already authenticated in NewDot, we need to reauthenticate them with shortLivedAuthToken, | ||
| // because the old authToken stored in Onyx may be invalid. | ||
| signInWithShortLivedAuthToken(shortLivedAuthToken); | ||
| signInWithShortLivedAuthToken(shortLivedAuthToken, !!isSAML); |
There was a problem hiding this comment.
I see this change is similar to your previous change, but it is causing an issue: #90114. Could you please test this?
There was a problem hiding this comment.
It's crucial line of the PR. #90114 is caused by configuration issue on staging. We were discussing it
There was a problem hiding this comment.
We were discussing it
If possible, could you please mention this discussion here as well? Thanks. It will make future investigations easier if we encounter a similar issue again.
|
Could you check the failed checks? |
| // Even if the user was already authenticated in NewDot, we need to reauthenticate them with shortLivedAuthToken, | ||
| // because the old authToken stored in Onyx may be invalid. | ||
| signInWithShortLivedAuthToken(shortLivedAuthToken); | ||
| signInWithShortLivedAuthToken(shortLivedAuthToken, !!isSAML); |
There was a problem hiding this comment.
| signInWithShortLivedAuthToken(shortLivedAuthToken, !!isSAML); | |
| const {isProduction} = useEnvironment(); | |
| ... | |
| const shouldPassSAML = isProduction ? !!isSAML : undefined; | |
| signInWithShortLivedAuthToken(shortLivedAuthToken, shouldPassSAML); |
@jnowakow I think this is only needed for production, so we should add a check like above. Also, please add a comment explaining why we need to pass SAML in production.
There was a problem hiding this comment.
Why is it needed only for production? We shouldn't ignore this information on any environment
There was a problem hiding this comment.
If we use this option for staging, will this issue come back? #90114
There was a problem hiding this comment.
If IdP configuration won't be fixed then probably yes. But adding this check means "fix the bug on production and leave it on staging/dev" so I think it's even more hacky than what I propose earlier
There was a problem hiding this comment.
I think it's different because we don’t currently support staging and dev, so isSAML is only passed in production when calling signInWithShortLivedAuthToken. Adding this as suggested seems reasonable. But if there are concerns, we should also check with @pecanoro and @AndrewGable.
There was a problem hiding this comment.
Dev works if you have correct IdP, so I don't think we should block. But let's wait for @pecanoro or @AndrewGable for their opinion
Failing tests don't look related. Merging main should fix it |
|
I think the next step is for @AndrewGable to share his thoughts on this. |
|
I can help with this as thread |
|
I'll create another PR for this one once the SSO setup is complete. |
|
@mateuuszzzzz, I'm not sure whether you'll be taking over this PR since @suneox has already been assigned to it. |
|
Got it! I was OOO last week and missed this fact 😅 Anyways, let me know if you need any help from me regarding this PR |
|
Closing per #85937 (comment) |
Explanation of Change
SSO login works by redirecting user to www.expensify.com then to IdP and back to App. All necessary information are passed in the URL. One of parameter is
isSAML. It's important information stored on session object. Without it logout is not working properly because we do not logout user via SSO. One piece of logic in the OD -> ND redirection is navigation toLogoutPreviousUserPage. This screen ignoredisSAMLparameter from URL causing problem with logout.Fixed Issues
$ #85937
PROPOSAL: N/A
Tests
Offline tests
N/A
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
SLO-fixed.mov