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-933 fetch /saml/check when starting a new session #1582

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
STCOR-933 fetch /saml/check when starting a new session
This is a follow-up to the botched implementation of STCOR-816 in
PR #1432. The description there is "When restoring an existing
session..." but in fact the implementation is "When starting a new
session or restoring an existing one...". When starting a new session,
however, discovery has not happened yet, so there is no information
about what interfaces are present, and the conditional would always
return false.

The implementation here corrects the conditional:
1. if we are starting a new session
2. if we are resuming an existing session and the `login-saml` interface
   is present.

Refs STCOR-933
zburke committed Jan 7, 2025
commit 849cf0835a6af28fe81533ff4a2a297c28c9bc0b
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
* Don't override initial discovery and okapi data in test mocks. Refs STCOR-913.
* `<Logout>` must consume `QueryClient` in order to supply it to `loginServices::logout()`. Refs STCOR-907.
* On resuming session, spread session and `_self` together to preserve session values. Refs STCOR-912.
* Fetch `/saml/check` when starting a new session, i.e. before discovery. Refs STCOR-933, STCOR-816.

## [10.2.0](https://github.com/folio-org/stripes-core/tree/v10.2.0) (2024-10-11)
[Full Changelog](https://github.com/folio-org/stripes-core/compare/v10.1.1...v10.2.0)
7 changes: 5 additions & 2 deletions src/loginServices.js
Original file line number Diff line number Diff line change
@@ -851,8 +851,11 @@ export function checkOkapiSession(okapiUrl, store, tenant) {
.then((sess) => {
return sess?.user?.id ? validateUser(okapiUrl, store, tenant, sess) : null;
})
.then(() => {
if (store.getState().discovery?.interfaces?.['login-saml']) {
.then((res) => {
// check whether SSO is enabled if either
// 1. res is null (when we are starting a new session)
// 2. login-saml interface is present (when we are resuming an existing session)
if (!res || store.getState().discovery?.interfaces?.['login-saml']) {
return getSSOEnabled(okapiUrl, store, tenant);
}
return Promise.resolve();

Unchanged files with check annotations Beta

}
return cached;
}, [plugins]);

Check warning on line 35 in src/Pluggable.js

GitHub Actions / ui / Install and lint / Install and lint

React Hook useMemo has missing dependencies: 'props.stripes' and 'props.type'. Either include them or remove the dependency array
if (cachedPlugins.length) {
return cachedPlugins.map(({ plugin, Child }) => (