Skip to content

Commit

Permalink
Remove dead code for obsolete okta wic integration (#1779)
Browse files Browse the repository at this point in the history
  • Loading branch information
entrotech authored Jul 6, 2024
1 parent c6d6b7b commit 4b4fd57
Show file tree
Hide file tree
Showing 21 changed files with 29 additions and 1,598 deletions.
515 changes: 3 additions & 512 deletions client/package-lock.json

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@fortawesome/free-solid-svg-icons": "^6.1.1",
"@fortawesome/react-fontawesome": "^0.2.0",
"@okta/okta-auth-js": "^7.5.1",
"@okta/okta-react": "^6.7.0",
"@react-pdf/renderer": "^3.1.9",
"axios": "^1.6.1",
"clsx": "^2.0.0",
Expand Down
28 changes: 1 addition & 27 deletions client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ import Feedback from "./components/Feedback/FeedbackPage";
import ErrorPage from "./components/ErrorPage";
import Offline from "./components/Offline";
import Logout from "./components/Authorization/Logout";
import ProfilePage from "./components/Okta/ProfilePage";
import { LoginCallback } from "@okta/okta-react";
import { getConfigs } from "./helpers/Config";
import { OktaAuth } from "@okta/okta-auth-js";

const calculationPath = "/calculation/:page/:projectId?/*";

Expand All @@ -58,21 +55,7 @@ const App = () => {
}
loader={async () => {
const configs = await getConfigs();
const clientId = configs.OKTA_CLIENT_ID;
const issuer = configs.OKTA_ISSUER;
const disableHttpsCheck =
configs.OKTA_TESTING_DISABLE_HTTPS_CHECK || "T";
const redirectUri = `${window.location.origin}/login/callback`;
const oidc = {
clientId,
issuer,
redirectUri,
scopes: ["openid", "profile", "email"],
pkce: true,
disableHttpsCheck
};

return { oktaAuth: new OktaAuth(oidc), configs };
return { configs };
}}
>
{/* These routes either have no sidebar or use a custom sidebar */}
Expand Down Expand Up @@ -124,19 +107,10 @@ const App = () => {
element={<TermsAndConditionsPage />}
/>
<Route path="/privacypolicy" element={<PrivacyPolicy />} />
<Route path="/profile" element={<ProfilePage />} />
<Route path="/unauthorized" element={<Unauthorized />} />
<Route path="/register/:email?" element={<Register />} />
<Route path="/updateaccount/:email?" element={<UpdateAccount />} />
<Route path="/confirm/:token?" element={<ConfirmEmail />} />
<Route
path="/login/callback"
element={
<LoginCallback
loadingElement={<h3 id="loading-icon">Loading...</h3>}
/>
}
/>
<Route path="/login/:email?" element={<Login />} />
<Route path="/logout" element={<Logout />} />
<Route path="/forgotpassword" element={<ForgotPassword />} />
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Authorization/Logout.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const Logout = () => {
const navigate = useNavigate();
const handleLogout = async () => {
await accountService.logout();
// Redirect to the "/" page after the logout
navigate("/");
// Redirect to the "/login" page after the logout
navigate("/login");
};
// Call handleLogout when the component mounts
handleLogout();
Expand Down
6 changes: 5 additions & 1 deletion client/src/components/Feedback/FeedbackPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ const FeedbackPage = ({ contentContainerRef }) => {
const classes = useStyles();
const toast = useToast();
const account = userContext.account;
const projects = account.email ? GetUserProjects(account.email) : [];
const projects = !account
? null
: account.email
? GetUserProjects(account.email)
: [];
const [selectedProjects, setSelectedProjects] = useState([]);

useEffect(() => {
Expand Down
46 changes: 13 additions & 33 deletions client/src/components/Layout/ClientAreaLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import Header from "./Header";
import Footer from "./Footer";
import TermsAndConditionsModal from "../TermsAndConditions/TermsAndConditionsModal";
import ChecklistModal from "../Checklist/ChecklistModal";
import OktaAuthProvider from "../Okta/OktaAuthProvider";
import OktaTdmAuthProvider from "../Okta/OktaTdmAuthProvider";
import TdmAuthProvider from "./TdmAuthProvider";
import ConfigContext from "../../contexts/ConfigContext";

Expand Down Expand Up @@ -48,37 +46,19 @@ const ClientAreaLayout = ({ appContainerRef }) => {
return (
<div className={classes.app} id="app-container" ref={appContainerRef}>
<ConfigContext.Provider value={configs}>
{configs["OKTA_ENABLE"] && configs["OKTA_ENABLE"] === "T" ? (
<OktaAuthProvider>
<OktaTdmAuthProvider>
<TermsAndConditionsModal
hasAcceptedTerms={hasAcceptedTerms}
onAcceptTerms={onAcceptTerms}
/>
<ChecklistModal
checklistModalOpen={checklistModalOpen}
toggleChecklistModal={toggleChecklistModal}
/>
<Header />
<Outlet />
<Footer toggleChecklistModal={toggleChecklistModal} />
</OktaTdmAuthProvider>
</OktaAuthProvider>
) : (
<TdmAuthProvider>
<TermsAndConditionsModal
hasAcceptedTerms={hasAcceptedTerms}
onAcceptTerms={onAcceptTerms}
/>
<ChecklistModal
checklistModalOpen={checklistModalOpen}
toggleChecklistModal={toggleChecklistModal}
/>
<Header />
<Outlet />
<Footer toggleChecklistModal={toggleChecklistModal} />
</TdmAuthProvider>
)}
<TdmAuthProvider>
<TermsAndConditionsModal
hasAcceptedTerms={hasAcceptedTerms}
onAcceptTerms={onAcceptTerms}
/>
<ChecklistModal
checklistModalOpen={checklistModalOpen}
toggleChecklistModal={toggleChecklistModal}
/>
<Header />
<Outlet />
<Footer toggleChecklistModal={toggleChecklistModal} />
</TdmAuthProvider>
</ConfigContext.Provider>
</div>
);
Expand Down
12 changes: 3 additions & 9 deletions client/src/components/Layout/Header.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import React, { useState, useContext } from "react";
import React, { useState } from "react";
import { createUseStyles } from "react-jss";
import clsx from "clsx";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faBars } from "@fortawesome/free-solid-svg-icons";
import logo from "../../images/ladot_white.png";
import NavBar from "./NavBar";
import OktaNavBar from "../Okta/OktaNavBar";
import { Environment } from "../../helpers/Environment";
import ConfigContext from "../../contexts/ConfigContext";

const useStyles = createUseStyles({
header: {
Expand Down Expand Up @@ -78,7 +76,6 @@ const useStyles = createUseStyles({
const Header = () => {
const classes = useStyles();
const [navbarOpen, setNavbarOpen] = useState(false);
const configs = useContext(ConfigContext);

const handleHamburgerMenuClick = () => setNavbarOpen(!navbarOpen);

Expand All @@ -104,11 +101,8 @@ const Header = () => {
>
<FontAwesomeIcon icon={faBars} className={classes.hamburger} />
</button>
{configs.OKTA_ENABLE && configs.OKTA_ENABLE === "T" ? (
<OktaNavBar navbarOpen={navbarOpen} setNavbarOpen={setNavbarOpen} />
) : (
<NavBar navbarOpen={navbarOpen} setNavbarOpen={setNavbarOpen} />
)}

<NavBar navbarOpen={navbarOpen} setNavbarOpen={setNavbarOpen} />
</div>
);
};
Expand Down
62 changes: 0 additions & 62 deletions client/src/components/Okta/LoginButton.jsx

This file was deleted.

81 changes: 0 additions & 81 deletions client/src/components/Okta/NavBarLogin.jsx

This file was deleted.

25 changes: 0 additions & 25 deletions client/src/components/Okta/OktaAuthProvider.jsx

This file was deleted.

Loading

0 comments on commit 4b4fd57

Please sign in to comment.