Skip to content

Commit

Permalink
Merge pull request #132 from bcgov/feature/naveed-sso-new-package
Browse files Browse the repository at this point in the history
Feature/naveed sso new package
  • Loading branch information
JlevesqueAtBC authored Jul 12, 2024
2 parents 6c05449 + 107d00c commit b9c30b5
Show file tree
Hide file tree
Showing 21 changed files with 86 additions and 306 deletions.
11 changes: 11 additions & 0 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"dependencies": {
"@aws-sdk/client-s3": "^3.598.0",
"@bcgov/citz-imb-sso-express": "^1.0.0",
"@types/cors": "^2.8.13",
"@types/keycloak-connect": "^7.0.0",
"@types/mime-types": "^2.1.4",
Expand Down
17 changes: 9 additions & 8 deletions backend/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ import TransferService from "./service/transfer-service";
import { specs, swaggerUi } from "./config/swagger/swagger-config";
import cors from "cors";
import bodyParser from "body-parser";
import authRoutes from "./routes/authRoutes";
import { authenticateJWT } from "./middleware/auth-middleware";
import * as sessionTypes from "./types/custom-types";
import logger from "./config/logs/winston-config";
import cookieParser from "cookie-parser";
import path from "path";
import crypto from 'crypto';
import fs from 'fs';
import multer from "multer";
import { protectedRoute, sso } from '@bcgov/citz-imb-sso-express';

import { ITransfer } from "./models/interfaces/ITransfer";
const app = express();
sso(app);

// Middleware to serve static files

Expand All @@ -43,7 +44,7 @@ app.use(
);


app.use(authRoutes);
// app.use(authRoutes);
app.use(express.json());


Expand All @@ -52,7 +53,7 @@ app.get("/", (req, res) => {
res.status(200).json("API Is Healthy");
});

app.get('/dashboard', authenticateJWT, (req: any, res) => {
app.get('/dashboard', protectedRoute(), (req: any, res) => {
logger.info('Dashboard route called');
res.json({ message: 'This is a protected route', user: req.user });
});
Expand All @@ -61,10 +62,10 @@ app.use("/api", transferRouter);
app.use("/api", digitalFileListRoute);
app.use("/api", digitalFileRoute);
app.use("/api", uploadFilesRoute);
app.get('/userinfo', authenticateJWT, (req: any, res) => {
logger.info('Userinfo route called');
res.json(req.user.userinfo);
});
// app.get('/userinfo', authenticateJWT, (req: any, res) => {
// logger.info('Userinfo route called');
// res.json(req.user.userinfo);
// });
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(specs));
app.use(function (req: Request, res: Response, next: NextFunction) {
console.log(
Expand Down
27 changes: 0 additions & 27 deletions backend/src/auth/keycloak-config.ts

This file was deleted.

20 changes: 0 additions & 20 deletions backend/src/controller/authController.ts

This file was deleted.

21 changes: 0 additions & 21 deletions backend/src/middleware/auth-middleware.ts

This file was deleted.

74 changes: 0 additions & 74 deletions backend/src/routes/authRoutes.ts

This file was deleted.

14 changes: 0 additions & 14 deletions backend/src/utils/jwt-utils.ts

This file was deleted.

15 changes: 12 additions & 3 deletions backend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,15 @@
"@babel/helper-validator-identifier" "^7.24.6"
to-fast-properties "^2.0.0"

"@bcgov/citz-imb-sso-express@^1.0.0":
version "1.0.0"
resolved "https://registry.npmjs.org/@bcgov/citz-imb-sso-express/-/citz-imb-sso-express-1.0.0.tgz"
integrity sha512-Z4kinfKnPHMh5sEr6YmmcakMD1MbZ2JGyC3TNf21i92G0Avr3AKKQJ6wYBzc7nygjJx8be2U774wekxum3ylAQ==
dependencies:
cookie-parser "1.4.6"
cors "2.8.5"
express "4.19.2"

"@bcoe/v8-coverage@^0.2.3":
version "0.2.3"
resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz"
Expand Down Expand Up @@ -2833,7 +2842,7 @@ convert-source-map@^2.0.0:
resolved "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz"
integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==

cookie-parser@^1.4.6:
cookie-parser@^1.4.6, [email protected]:
version "1.4.6"
resolved "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.6.tgz"
integrity sha512-z3IzaNjdwUC2olLIB5/ITd0/setiaFMLYiZJle7xg5Fe9KWAceil7xszYfHHBtDFYLSgJduS2Ty0P1uJdPDJeA==
Expand Down Expand Up @@ -2866,7 +2875,7 @@ core-util-is@~1.0.0:
resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz"
integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==

cors@^2.8.5:
cors@^2.8.5, [email protected]:
version "2.8.5"
resolved "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz"
integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==
Expand Down Expand Up @@ -3311,7 +3320,7 @@ express-validator@^7.0.1:
lodash "^4.17.21"
validator "~13.12.0"

express@^4.19.2, "express@>=4.0.0 || >=5.0.0-beta":
express@^4.19.2, "express@>=4.0.0 || >=5.0.0-beta", [email protected]:
version "4.19.2"
resolved "https://registry.npmjs.org/express/-/express-4.19.2.tgz"
integrity sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==
Expand Down
2 changes: 1 addition & 1 deletion frontend/.env.dev
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VITE_API_URL=http://localhost:5000
VITE_API_URL=http://localhost:5000/
15 changes: 15 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@bcgov/citz-imb-sso-react": "^1.0.1",
"@date-io/date-fns": "^2.15.0",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
Expand Down
6 changes: 1 addition & 5 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,20 @@ import {
import TransferViewStatus from "./views/ViewTransferStatus/TransferStatusView";
import Landing from "./views/LandingPage/Landing";
import MyAppBar from "./components/layout/AppBar";
import axios from "axios";
import { AuthProvider } from "./auth/AuthContext";
import PrivateRoute from "./auth/PrivateRoute";
import Dashboard from "./views/Dashboard/Dashboard";
import CreateDigitalFileList from "./views/CreateDigitalFileList/CreateDigitalFileList";
import TransferViewEdit from "./views/ViewTransferStatus/TransferViewEdit";
import SendRecords from "./views/SendRecords/SendRecords";
import { SendRecordsEDRMS } from "./views/SendRecords/SendRecordsEDRMS";
import { SendRecordsLAN } from "./views/SendRecords/SendRecordsLAN";
import PrivateRoute from "./auth/PrivateRoute";

//import { bcGovTheme } from "./assets/themes/bcGovTheme";


const App: React.FC = () => {
return (
<ThemeProvider theme={bcGovTheme}>
<AuthProvider>
<CssBaseline />
<Router>
<MyAppBar />
Expand All @@ -42,7 +39,6 @@ const App: React.FC = () => {
</Route>
</Routes>
</Router>
</AuthProvider>
</ThemeProvider>
);
}
Expand Down
Loading

0 comments on commit b9c30b5

Please sign in to comment.