Skip to content
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

[STCOR-787] Always retrieve clientId and tenant values from config.tenantOptions in stripes.config.js #1487

Merged
merged 12 commits into from
Jun 10, 2024

Conversation

ryandberger
Copy link
Member

  • Fulfills STCOR-787.
  • Removed dependence on okapi.tenant and okapi.clientId since those same values are now defined in config.tenantOptions.
  • Removed dependence on config.isSingleTenant since a single tenant in config.tenantOptions should always caused the tenant selection screen to be skipped.
  • Unrelated: add a fallback in loginServices.jsif user object not returned from local storage, then default to user from /_self response. I ran into this issue causing login to crash occasionally on localhost and it was annoying, so adding a graceful fallback here.

@ryandberger ryandberger requested review from zburke and aidynoJ May 31, 2024 19:07

This comment has been minimized.

Copy link

github-actions bot commented May 31, 2024

Jest Unit Test Statistics

228 tests  +2   228 ✔️ +2   1m 0s ⏱️ -1s
  45 suites +1       0 💤 ±0 
    1 files   ±0       0 ±0 

Results for commit 9ce0d04. ± Comparison against base commit 13001bf.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented May 31, 2024

BigTest Unit Test Statistics

    1 files  ±0      1 suites  ±0   10s ⏱️ ±0s
266 tests ±0  260 ✔️ ±0  6 💤 ±0  0 ±0 
269 runs  ±0  263 ✔️ ±0  6 💤 ±0  0 ±0 

Results for commit 9ce0d04. ± Comparison against base commit 13001bf.

♻️ This comment has been updated with latest results.

@folio-org folio-org deleted a comment from sonarcloud bot Jun 4, 2024
Copy link
Member

@zburke zburke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we confident about support for legacy stripes.config.js configurations that only okapi.tenant? Do we consider this a breaking change? i.e. even if apps consumeing stripes don't have to change because we continue to populate stripes.okapi.tenant, do hosting providers using stripes.config.js have to change? Do we want that?

src/RootWithIntl.test.js Outdated Show resolved Hide resolved
src/components/OIDCLanding.js Outdated Show resolved Hide resolved
return loadResources(store, sessionTenant, user.id);
return loadResources(store, sessionTenant, user?.id ?? data.user?.id);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I've seen this too but not been able to figure out how things get into this state. It is mitigated in the community builds in #1466.

@ryandberger
Copy link
Member Author

Are we confident about support for legacy stripes.config.js configurations that only okapi.tenant? Do we consider this a breaking change? i.e. even if apps consumeing stripes don't have to change because we continue to populate stripes.okapi.tenant, do hosting providers using stripes.config.js have to change? Do we want that?

Are we confident about support for legacy stripes.config.js configurations that only okapi.tenant? Do we consider this a breaking change? i.e. even if apps consumeing stripes don't have to change because we continue to populate stripes.okapi.tenant, do hosting providers using stripes.config.js have to change? Do we want that?

Good point. The story description suggested we drop support for okapi.tenant, but instead I should rework this to be backwards-compatible.

@zburke
Copy link
Member

zburke commented Jun 4, 2024

Sorry; my bad for failing to write a clearer story.

@ryandberger ryandberger requested a review from zburke June 7, 2024 18:49
@ryandberger
Copy link
Member Author

Sorry; my bad for failing to write a clearer story.

This has been updated to allow for backwards-compatibility with the okapi.tenant and okapi.clientId fields the community uses.

Copy link

sonarcloud bot commented Jun 7, 2024

@ryandberger ryandberger merged commit ab7f0b5 into keycloak-ramsons Jun 10, 2024
6 checks passed
@ryandberger ryandberger deleted the STCOR-787 branch June 10, 2024 12:16
zburke pushed a commit that referenced this pull request Jun 11, 2024
…nantOptions in stripes.config.js (#1487)

* Retrieve clientId and tenant values from config.tenantOptions before login

* Fix tenant gathering

* Remove isSingleTenant param which is redundant

* If user object not returned from local storage, then default user from /_self response

* Update CHANGELOG.md

* Revert PreLoginLanding which uses okapi values

* Remove space

* Rework flow to immediately set config to okapi for compatibility.

* Lint fix

* Fix unit test
zburke pushed a commit that referenced this pull request Jul 25, 2024
…nantOptions in stripes.config.js (#1487)

* Retrieve clientId and tenant values from config.tenantOptions before login

* Fix tenant gathering

* Remove isSingleTenant param which is redundant

* If user object not returned from local storage, then default user from /_self response

* Update CHANGELOG.md

* Revert PreLoginLanding which uses okapi values

* Remove space

* Rework flow to immediately set config to okapi for compatibility.

* Lint fix

* Fix unit test

(cherry picked from commit e738a2f)
zburke added a commit that referenced this pull request Sep 20, 2024
The time has come. The time is now. 
`keycloak-eureka` will you please merge now!
You can go in a merge commit. You can squash with ease.
You can go in a rebase. But please merge. Please!

* STCOR-773 #1385: Handle Eureka-based discovery
* #1388: handle absent `provides` property on interfaces in Settings > About
* STCOR-790 #1389: Pass client-id from stripes-config to keycloak
* STCOR-794 #1400: Reset pre-login tenant-selection form when navigating back to it
* STCOR-795 #1399: When `users-keycloak` interface is present, use its API for password-reset
* STCOR-796 #1410: replace x-okapi-token credentials with RTR and cookies
* STCOR-811 #1417: retrieve AT/RT expiration data from `/authn/token` response
* STCOR-812 #1416: include `X-Okapi-Tenant` header in call to `/authn/logout`
* STCOR-813 #1421: correctly parse `.../_self` permissions
* STCOR-810 #1418 #1427 #1429: leverage `stripes-config::config.tenantOptions` in place of deprecated tenant-entitlement values
* STCOR-803 #1426: logout immediately, without confirming or redirecting through keycloak
* STCOR-816 #1432: only call `/saml/check` when `login-saml` interface is present
* STCOR-789 #1442: restore original URL after login
* STCOR-820 #1445: optionally retrieve password-reset token from path (or query-string)
* STCOR-845 #1462: correctly handle redirect after password-change
* STCOR-787 #1487 #1492: retrieve clientId and tenant from stripes-config::config.tenantOptions
* STCOR-859 #1489: correctly list UI apps under apps/modules/interfaces column of Settings > About
* STCOR-776 #1490: show idle-session modal with countdown timer before logout
* STCOR-864 #1498: correctly evaluate `typeof stripes.okapi`
* STCOR-865 #1500: call `logout()` exclusively from `/logout*` routes
* STCOR-834 #1491`: refactor `useUserTenantPermissions` to switch on `roles` interface presence
* STCOR-866 #1502: include `/users-keycloak/_self` in list of authentication-related endpoints
* STCOR-867 #1505 #1506: store permission displaynames in redux
* STCOR-862 #1503: handle fixed-length-session timeout
* STCOR-869 #1513: avoid storing `/logout*` as a return-to URL; ensure `/logout` is called with a valid token
* STCOR-872 #1520: return query-keys from `useChunkedCQLFetch()`
* STCOR-874 #1521: provide `key` to `<SessionEventContainer>` components
* STCOR-873 #1519: `useChunkedCQLFetch()` should use `tenantId` argument when present
* STCOR-876 #1526: restore original URL after login (regression of STCOR-789)
* STCOR-885 #1531: clear original URL from storage after login-and-redirect
* STCOR-889 #1536: include all reference interfaces in optionalOkapiInterfaces

I said MERGE and MERGE I meant....
The time had come ... so this branch went.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants