Skip to content

Commit

Permalink
Implemented session timeout modal
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Jun 3, 2021
1 parent fc4e141 commit 7b6583f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 6 deletions.
3 changes: 3 additions & 0 deletions backend/src/main/resources/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,9 @@ message.invalid-regex-pattern=Invalid Regular Expression

message.invalid-signing=Unless the response or the assertions are signed, SAML security is compromised and the service should reject the SAML response. (If it doesn\u0027t, investigate, as that is serious unless the HTTP-Artifact binding is in use.)

message.session-timeout-heading=Session timed out
message.session-timeout-body=Your session has timed out. Please login again.

tooltip.entity-id=Entity ID
tooltip.service-provider-name=Service Provider Name (Dashboard Display Only)
tooltip.force-authn=Disallows use (or reuse) of authentication results and login flows that don\u0027t provide a real-time proof of user presence in the login process
Expand Down
2 changes: 1 addition & 1 deletion ui/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="favicon.ico" />
<meta charset="utf-8">
<title>Shibboleth IDP UI</title>
<base href="/">
Expand Down
17 changes: 12 additions & 5 deletions ui/src/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ import { NewSource } from './metadata/new/NewSource';
import { NewProvider } from './metadata/new/NewProvider';
import { Filter } from './metadata/Filter';
import { Contention } from './metadata/contention/ContentionContext';
import { SessionModal } from './core/user/SessionModal';
import Button from 'react-bootstrap/esm/Button';


function App() {

const [showTimeout, setShowTimeout] = React.useState();

const httpOptions = {
redirect: 'manual',
interceptors: {
Expand All @@ -37,13 +41,13 @@ function App() {

return options;
},
/*response: async ({response}) => {
response: async ({response}) => {
if (response.type === "opaqueredirect") {
// window.location.reload();
} else {
return response;
setShowTimeout(true);
}
}*/

return response;
}
}
};

Expand All @@ -53,6 +57,9 @@ function App() {
<Notifications>
<UserProvider>
<I18nProvider>
<SessionModal show={showTimeout}>
<Button variant="primary" onClick={() => window.location.reload()}>Log in</Button>
</SessionModal>
<Contention>
<UserConfirmation>
{(message, confirm, confirmCallback, setConfirm, getConfirmation) =>
Expand Down
27 changes: 27 additions & 0 deletions ui/src/app/core/user/SessionModal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react';

import Modal from 'react-bootstrap/Modal';

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import Translate from '../../i18n/components/translate';

export function SessionModal({ show, children }) {

return (
<>
<Modal show={show}>
<Modal.Header><Translate value="message.session-timeout-heading">Session timed out</Translate></Modal.Header>
<Modal.Body className="d-flex align-content-center">
<FontAwesomeIcon className="text-danger mr-4" size="4x" icon={faExclamationTriangle} />
<p className="text-danger font-weight-bold mb-0">
<Translate value="message.session-timeout-body">Your session has timed out. Please login again.</Translate>
</p>
</Modal.Body>
<Modal.Footer>
{children}
</Modal.Footer>
</Modal>
</>
);
}

0 comments on commit 7b6583f

Please sign in to comment.