Skip to content

Commit

Permalink
STCOR-868 IST/FLST backport cleanup
Browse files Browse the repository at this point in the history
Some of the commits being cherry-picked on this branch relied on other
work that wasn't directly related to idle-session timeout or
fixed-length-session timeout, and hence weren't picked onto the branch
but were, in fact necessary, for this work to function correctly.

* Restore the `/oidc-landing` route
* Pass the correct arguments to `loadResources()`

Refs STCOR-868
  • Loading branch information
zburke committed Jul 25, 2024
1 parent 9a7b8d4 commit 8ef05ce
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 17 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
## [10.1.1](https://github.com/folio-org/stripes-core/tree/v10.1.1) (2024-03-25)
[Full Changelog](https://github.com/folio-org/stripes-core/compare/v10.1.0...v10.1.1)

* Utilize the `tenant` procured through the SSO login process. Refs STCOR-769.
* Use keycloak URLs in place of users-bl for tenant-switch. Refs US1153537.
* Idle-session timeout and "Keep working?" modal. Refs STCOR-776.
* Always retrieve `clientId` and `tenant` values from `config.tenantOptions` in stripes.config.js. Retires `okapi.tenant`, `okapi.clientId`, and `config.isSingleTenant`. Refs STCOR-787.
Expand Down
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class StripesCore extends Component {
const parsedTenant = storedTenant ? JSON.parse(storedTenant) : undefined;

const okapi = (typeof okapiConfig === 'object' && Object.keys(okapiConfig).length > 0)
? { ...okapiConfig, tenant: parsedTenant?.tenantName || okapiConfig.tenant, clientId: parsedTenant?.clientId || okapiConfig.clientId } : { withoutOkapi: true };
? { ...okapiConfig, tenant: parsedTenant?.tenantName || okapiConfig.tenant, clientId: parsedTenant?.clientId } : { withoutOkapi: true };

const initialState = merge({}, { okapi }, props.initialState);

Expand Down
13 changes: 13 additions & 0 deletions src/RootWithIntl.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ const RootWithIntl = ({ stripes, token = '', isAuthenticated = false, disableAut
key="sso-landing"
component={<SSORedirect stripes={connectedStripes} />}
/>
<TitledRoute
name="oidcRedirect"
path="/oidc-landing"
key="oidc-landing"
component={<OIDCRedirect stripes={stripes} />}
/>
<TitledRoute
name="logoutTimeout"
path="/logout-timeout"
Expand Down Expand Up @@ -129,6 +135,13 @@ const RootWithIntl = ({ stripes, token = '', isAuthenticated = false, disableAut
component={<CookiesProvider><SSOLanding stripes={connectedStripes} /></CookiesProvider>}
key="sso-landing"
/>
<TitledRoute
name="oidcLanding"
exact
path="/oidc-landing"
component={<CookiesProvider><OIDCLanding stripes={stripes} /></CookiesProvider>}
key="oidc-landing"
/>
<TitledRoute
name="forgotPassword"
path="/forgot-password"
Expand Down
3 changes: 2 additions & 1 deletion src/components/Login/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Login extends Component {
const buttonLabel = submissionStatus ? 'loggingIn' : 'login';
return (
<main>
<div className={styles.wrapper} style={branding.style?.login ?? {}}>
<div className={styles.wrapper} style={branding?.style?.login ?? {}}>
<div className={styles.container}>
<Row center="xs">
<Col xs={6}>
Expand Down Expand Up @@ -160,6 +160,7 @@ class Login extends Component {
validationEnabled={false}
hasClearIcon={false}
autoComplete="current-password"
required
/>
</Col>
</Row>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Login/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from './LoginCtrl';
export { default } from './Login';
5 changes: 1 addition & 4 deletions src/components/OIDCLanding.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,8 @@ const OIDCLanding = () => {
<FormattedMessage id="errors.saml.missingToken" />
</div>
<div>
<h3>code</h3>
{potp}
<h3>error</h3>
<code>
{JSON.stringify(samlError, null, 2)}
{JSON.stringify(samlError.current, null, 2)}
</code>
</div>
<Redirect to="/" />
Expand Down
8 changes: 0 additions & 8 deletions src/discoverServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,6 @@ function fetchModules(store) {
});
}

/*
* This function probes Okapi to discover what versions of what
* interfaces are supported by the services that it is proxying
* for. This information can be used to configure the UI at run-time
* (e.g. not attempting to fetch loan information for a
* non-circulating library that doesn't provide the circ interface)
*/
export function discoverServices(store) {
const promises = [];
if (config.tenantOptions) {
Expand All @@ -236,7 +229,6 @@ export function discoverServices(store) {
});
}


export function discoveryReducer(state = {}, action) {
switch (action.type) {
case 'DISCOVERY_APPLICATIONS':
Expand Down
2 changes: 1 addition & 1 deletion src/loginServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ export function validateUser(okapiUrl, store, tenant, session) {
tokenExpiration,
}));

return loadResources(okapiUrl, store, sessionTenant, user.id);
return loadResources(store, sessionTenant, user.id);
});
} else {
store.dispatch(clearCurrentUser());
Expand Down

0 comments on commit 8ef05ce

Please sign in to comment.