From ab8c478567982bb4ece3cabd9d9097ce68d51f01 Mon Sep 17 00:00:00 2001 From: Donavon McDowell Date: Tue, 10 Dec 2024 20:24:37 -0700 Subject: [PATCH] Added some msal stuffs! --- backend/app.js | 11 +- backend/certs/example.crt | 17 ++ backend/certs/example.key | 28 +++ backend/msal.js | 102 ++++++++++ backend/package-lock.json | 267 ++++++++++++++++++++++++- backend/package.json | 5 +- frontend/src/routes/+layout.svelte | 4 +- frontend/src/routes/login/+page.svelte | 46 +++++ 8 files changed, 471 insertions(+), 9 deletions(-) create mode 100644 backend/certs/example.crt create mode 100644 backend/certs/example.key create mode 100644 backend/msal.js diff --git a/backend/app.js b/backend/app.js index d49f709..aceef8f 100644 --- a/backend/app.js +++ b/backend/app.js @@ -1,12 +1,13 @@ // Required modules const express = require('express'); - const { MongoClient, ObjectId } = require('mongodb'); const cors = require('cors'); - -// Set up express app const app = express(); + + const port = process.env.PORT || 3000; +const mongodb_uri = process.env.MONGODB_URI || 'mongodb://localhost:27017'; +const mongodb_name = process.env.MONGODB_NAME || 'docucenter'; // Parse JSON bodies app.use(express.json({ limit: '50mb' })); // For JSON data @@ -16,8 +17,8 @@ app.use(express.urlencoded({ limit: '50mb', extended: true })); // For URL-encod app.use(cors()); // MongoDB configuration -const mongoUri = 'mongodb://localhost:27017'; // Replace with your MongoDB URI -const dbName = 'docucenter'; +const mongoUri = mongodb_uri; +const dbName = mongodb_name; let db; // Connect to MongoDB diff --git a/backend/certs/example.crt b/backend/certs/example.crt new file mode 100644 index 0000000..cd6be29 --- /dev/null +++ b/backend/certs/example.crt @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICqDCCAZACCQDWxJavO1DzuTANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtl +eGFtcGxlLmNvbTAeFw0yMjA2MTIyMDA2NDlaFw0yMzA2MTIyMDA2NDlaMBYxFDAS +BgNVBAMMC2V4YW1wbGUuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC +AQEAp4SkpX3eIN58eh/oNbiWofs7//rztEwEfzTzBB0apgUj/4hQh1dgIvZIio2k +m8Cqo/IxUT7iT3thgH21aYB8bXdNxjAW1zqdHsqONaktImoTswJq7GNlIKVbhUAo +jBm4N9Qq9FaIwwIB7wV2CQbl2+z+u6vMUiG+H8DjnVHUmGvCGlJ5//4ZFLNutz9t +W+7G6fwRin7yrhWSxYnVPWJKtUCqWxykxErMvOBQS466SmihIqCMaZgF4E1DMPqg +PQfzqDyJlq6GlmISiAUe/hKEIXA+GZCKueO3k4enfRq9JdvGUxehy5H9PbHXzg8J +hQ0AklYwI58GCKCWzlcCpL5AcwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQADRUBh +eLMSHqIkzyWxlCRTIDFovRbE5bCws0yeQHlmY6wN+uWKWMATC5gqM2g6b7TMrc13 +PQEUIo+lO9Ypf1QrNd6bJm3FQc+exu7J+WohkjkY5DG321oBCMhHvRImtj5AoEq5 +0Vk+sQx7t++lh0/dT6YFC5EaGklsbjq3uuTBmlyWortQiYSro0MIqbXxTV6Eo1gM +7/AJaLAe36T85s5KMlkmXUpvQHx4FKiIq2Y8UMww/Jv8Ggn6tJwYeuwUJlt51Q6C +7QNzhKJOB5otM1y6GsI675a50i/QSfh7Ku1hfcVX8UYDTvSrdgnru21XqpVmmY59 +bAwE/uaqeobm0plH +-----END CERTIFICATE----- \ No newline at end of file diff --git a/backend/certs/example.key b/backend/certs/example.key new file mode 100644 index 0000000..206cd49 --- /dev/null +++ b/backend/certs/example.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCnm4VM1u0oX2Am +grdvZBfX7Rb9LN60zze4zdrjU3R0WhyfIYF1jECfjpFTdro3ieKXBW+isrcXLOvk +LUcgIxL48iCAy8wSLwkSzxM9XPyxqunZQL7T/bEv0U5w5Zb4y0jUlEVIeUhRlp7k +5emM0aArRGWTZJCKXsr/aab5wQ3YnAQGnGmnMaTGIBCKX2lCzlEJ+jkOMiobDUe3 +4BzIriZ4TPlNeGYTVA7mmHehDtnZB0sJ8Qqw0hyWLNwm9bhcpcfX6Qkh9WYncPP/ +DUorswEEuUrtYSpVpU6REmljMB67+92sqm+dHO2zJcaV5YzwmFnEGgEqCuJ+8BIK +JBLaejrFAgMBAAECggEBAIC9SVdrIwDGuZD7CLEL3fCiEO1ooKubGv7dR8si2Cli +6eclEk5a62xjUqccZA6y35QGvefnhBDOFWbPjHlX14PWXzbu0xIIhNyop+uTWBmT +4UlZnPoyO/4xtCGtiBgT9R4rwUfYuL7KhcPmAU2D2pZBVBAxx4AxLZWf7nyaV+tP +NFUVjegiJOl/iqP/aXVWw362TwOvJMalTWHRuVf1CcF5VkHKzT3lLIaTu1QbevEC +o5iGBc0EJfY56ZwvPZVsSFQ+wEBCimOPxsDJkaC/cPYf68SpOULQnRTSGYQ1WuWy +/guatJ3SyDzb2sqAg13VG+olEyy8ovNOIp4YL/qaCqUCgYEA29YuOo3T7lvaf7UX +t93qs5jxc2H3RXUrcP4NUDOxbhecunKKVrGRoGTcxqtdRFllx2vbd2wIM4K6tyMq +cgNqTlFpqoKBwNZwaevVlp2NtpqkFunqYp4X4rHOnZeAJDCqjhfVIGtxtQsLnWJt +VTDbpGgC/mKO+oofZMaM33JQ198CgYEAwy3aRYxUPjsYnTf9Xu8EC9ScGJJmXzxK +h3Zbvw0QhlLKDQLoKnGHD6hyqzLbs7bXaZgV1ot7l/MolqUrJKNrqpZ50E9CXSB+ +3f5TGuq2Qo85FQJdlPAZVbEksPpnVione9e8Ccyl5X617qUB43hQTTt/MPJQsi1e +61D98XV8UdsCgYB8ue0qnZNTllvGvzlAwbDKywiavUds6giGqC1nhpyxaMYsZpYk +j8Se6vrz4QAeqlX7qi8vd2TDzPUguNv5KgTjgH9iFX+GqGPJRNu/A48GvoBA2+B2 +qVnF7bnbYbx7S/1Idy8doLg3zpd9aP29KuZDRhwEtmiGr10WcSw2DobdowKBgALc +rEOy0BVthmnfxU5cEOIfhv5xPyEMYEdmO+gsR97AXggcz8y3h3R6Utwhzcjv2G7K +9R8FQpWy0hiLaXuLDewdcsHUN7Pn4xRcQ1m0sWF+eibNtxOVBboU8+XIdjV0Psn5 +Gt/F6XTZC8/pCYMNY5gOVEoic355XdfzgxXEVENbAoGAVVFdB4UxKF5au2JlwpPR +zdP4nYu/6fJEhKzVxkpf99Yxv9j0I8IDea4dxRZe0aChuG5oU4/st7vAihavp5a8 +2LQUOsKOvHvu3qNb5Y9a5PGR5Zq43H/2zdA+EVLjNqksCmynmuZDEStJjg5hnjYF +uAm3FeZxe8R8VP9NvMoP4wY= +-----END PRIVATE KEY----- diff --git a/backend/msal.js b/backend/msal.js new file mode 100644 index 0000000..452afc1 --- /dev/null +++ b/backend/msal.js @@ -0,0 +1,102 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */ + +const fs = require('fs'); +const crypto = require('crypto'); +const express = require('express'); + +const msal = require('@azure/msal-node'); + +/** + * If you have encrypted your private key with a *pass phrase* as recommended, + * you'll need to decrypt it before passing it to msal-node for initialization. + */ +// Secrets should never be hardcoded. The dotenv npm package can be used to store secrets or certificates +// in a .env file (located in project's root directory) that should be included in .gitignore to prevent +// accidental uploads of the secrets. + +// Certificates can also be read-in from files via NodeJS's fs module. However, they should never be +// stored in the project's directory. Production apps should fetch certificates from +// Azure KeyVault (https://azure.microsoft.com/products/key-vault), or other secure key vaults. + +// Please see "Certificates and Secrets" (https://learn.microsoft.com/azure/active-directory/develop/security-best-practices-for-app-registration#certificates-and-secrets) +// for more information. +const privateKeySource = fs.readFileSync('./certs/example.key'); + +const privateKeyObject = crypto.createPrivateKey({ + key: privateKeySource, + passphrase: "2255", // enter your certificate passphrase here + format: 'pem' +}); + +const privateKey = privateKeyObject.export({ + format: 'pem', + type: 'pkcs8' +}); + +// Before running the sample, you will need to replace the values in the config +const config = { + auth: { + clientId: "3cdfac60-e7fb-4648-89d3-67966c497d35", //Client ID + authority: "https://login.microsoftonline.com/538b9b1c-23fa-4102-b36e-a4d83fc9c4c1", //Tenant ID + clientCertificate: { + thumbprint: 'DD79B973F2D634840948970C712907DF4423C982', // can be obtained when uploading certificate to Azure AD + privateKey: privateKey, + } + }, + system: { + loggerOptions: { + loggerCallback(loglevel, message, containsPii) { + console.log(message); + }, + piiLoggingEnabled: false, + logLevel: msal.LogLevel.Verbose, + } + } +}; + +// Create msal application object +const cca = new msal.ConfidentialClientApplication(config); + +// Create Express app +const app = express(); + +app.use(express.urlencoded({ extended: false })); + +app.get('/', (req, res) => { + const authCodeUrlParameters = { + scopes: ["user.read"], + redirectUri: "http://localhost:3000/redirect", + responseMode: 'form_post', + }; + + // get url to sign user in and consent to scopes needed for application + cca.getAuthCodeUrl(authCodeUrlParameters).then((response) => { + console.log(response); + res.redirect(response); + }).catch((error) => console.log(JSON.stringify(error))); +}); + +app.post('/redirect', (req, res) => { + const tokenRequest = { + code: req.body.code, + scopes: ["user.read"], + redirectUri: "http://localhost:3000/redirect", + }; + + cca.acquireTokenByCode(tokenRequest).then((response) => { + console.log("\nResponse: \n:", response); + res.status(200).send('Congratulations! You have signed in successfully'); + }).catch((error) => { + console.log(error); + res.status(500).send(error); + }); +}); + +const SERVER_PORT = process.env.PORT || 3000; + +app.listen(SERVER_PORT, () => { + console.log(`Msal Node Auth Code Sample app listening on port ${SERVER_PORT}!`) +}); \ No newline at end of file diff --git a/backend/package-lock.json b/backend/package-lock.json index 1ae2cfe..d496232 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -9,11 +9,37 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "@azure/msal-node": "^2.16.2", "body-parser": "^1.20.3", "cors": "^2.8.5", + "dotenv": "^16.4.7", "express": "^4.21.2", "mariadb": "^3.4.0", - "mongodb": "^6.12.0" + "mongodb": "^6.12.0", + "redis": "^4.7.0" + } + }, + "node_modules/@azure/msal-common": { + "version": "14.16.0", + "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-14.16.0.tgz", + "integrity": "sha512-1KOZj9IpcDSwpNiQNjt0jDYZpQvNZay7QAEi/5DLubay40iGYtLzya/jbjRPLyOTZhEKyL1MzPuw2HqBCjceYA==", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@azure/msal-node": { + "version": "2.16.2", + "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-2.16.2.tgz", + "integrity": "sha512-An7l1hEr0w1HMMh1LU+rtDtqL7/jw74ORlc9Wnh06v7TU/xpG39/Zdr1ZJu3QpjUfKJ+E0/OXMW8DRSWTlh7qQ==", + "license": "MIT", + "dependencies": { + "@azure/msal-common": "14.16.0", + "jsonwebtoken": "^9.0.0", + "uuid": "^8.3.0" + }, + "engines": { + "node": ">=16" } }, "node_modules/@mongodb-js/saslprep": { @@ -24,6 +50,65 @@ "sparse-bitfield": "^3.0.3" } }, + "node_modules/@redis/bloom": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-1.2.0.tgz", + "integrity": "sha512-HG2DFjYKbpNmVXsa0keLHp/3leGJz1mjh09f2RLGGLQZzSHpkmZWuwJbAvo3QcRY8p80m5+ZdXZdYOSBLlp7Cg==", + "license": "MIT", + "peerDependencies": { + "@redis/client": "^1.0.0" + } + }, + "node_modules/@redis/client": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@redis/client/-/client-1.6.0.tgz", + "integrity": "sha512-aR0uffYI700OEEH4gYnitAnv3vzVGXCFvYfdpu/CJKvk4pHfLPEy/JSZyrpQ+15WhXe1yJRXLtfQ84s4mEXnPg==", + "license": "MIT", + "dependencies": { + "cluster-key-slot": "1.1.2", + "generic-pool": "3.9.0", + "yallist": "4.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@redis/graph": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@redis/graph/-/graph-1.1.1.tgz", + "integrity": "sha512-FEMTcTHZozZciLRl6GiiIB4zGm5z5F3F6a6FZCyrfxdKOhFlGkiAqlexWMBzCi4DcRoyiOsuLfW+cjlGWyExOw==", + "license": "MIT", + "peerDependencies": { + "@redis/client": "^1.0.0" + } + }, + "node_modules/@redis/json": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@redis/json/-/json-1.0.7.tgz", + "integrity": "sha512-6UyXfjVaTBTJtKNG4/9Z8PSpKE6XgSyEb8iwaqDcy+uKrd/DGYHTWkUdnQDyzm727V7p21WUMhsqz5oy65kPcQ==", + "license": "MIT", + "peerDependencies": { + "@redis/client": "^1.0.0" + } + }, + "node_modules/@redis/search": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@redis/search/-/search-1.2.0.tgz", + "integrity": "sha512-tYoDBbtqOVigEDMAcTGsRlMycIIjwMCgD8eR2t0NANeQmgK/lvxNAvYyb6bZDD4frHRhIHkJu2TBRvB0ERkOmw==", + "license": "MIT", + "peerDependencies": { + "@redis/client": "^1.0.0" + } + }, + "node_modules/@redis/time-series": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@redis/time-series/-/time-series-1.1.0.tgz", + "integrity": "sha512-c1Q99M5ljsIuc4YdaCwfUEXsofakb9c8+Zse2qxTadu8TalLXuAESzLvFAvNVbkmSlvlzIQOLpBCmWI9wTOt+g==", + "license": "MIT", + "peerDependencies": { + "@redis/client": "^1.0.0" + } + }, "node_modules/@types/geojson": { "version": "7946.0.15", "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.15.tgz", @@ -98,6 +183,12 @@ "node": ">=16.20.1" } }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "license": "BSD-3-Clause" + }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -135,6 +226,15 @@ "node": ">= 0.4" } }, + "node_modules/cluster-key-slot": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz", + "integrity": "sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA==", + "license": "Apache-2.0", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -228,6 +328,18 @@ "npm": "1.2.8000 || >= 1.4.16" } }, + "node_modules/dotenv": { + "version": "16.4.7", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", + "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, "node_modules/dunder-proto": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.0.tgz", @@ -241,6 +353,15 @@ "node": ">= 0.4" } }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -369,6 +490,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/generic-pool": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/generic-pool/-/generic-pool-3.9.0.tgz", + "integrity": "sha512-hymDOu5B53XvN4QT9dBmZxPX4CWhBPPLguTZ9MMFeFa/Kg0xWVfylOVNlJji/E7yTZWFd/q9GO5TxDLq156D7g==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/get-intrinsic": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.5.tgz", @@ -473,6 +603,97 @@ "node": ">= 0.10" } }, + "node_modules/jsonwebtoken": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", + "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "license": "MIT", + "dependencies": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, + "node_modules/jsonwebtoken/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "license": "MIT", + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "license": "MIT", + "dependencies": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", + "license": "MIT" + }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", + "license": "MIT" + }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", + "license": "MIT" + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", + "license": "MIT" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "license": "MIT" + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", + "license": "MIT" + }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", + "license": "MIT" + }, "node_modules/lru-cache": { "version": "10.4.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", @@ -729,6 +950,23 @@ "node": ">= 0.8" } }, + "node_modules/redis": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/redis/-/redis-4.7.0.tgz", + "integrity": "sha512-zvmkHEAdGMn+hMRXuMBtu4Vo5P6rHQjLoHftu+lBqq8ZTA3RCVC/WzD790bkKKiNFp7d5/9PcSD19fJyyRvOdQ==", + "license": "MIT", + "workspaces": [ + "./packages/*" + ], + "dependencies": { + "@redis/bloom": "1.2.0", + "@redis/client": "1.6.0", + "@redis/graph": "1.1.1", + "@redis/json": "1.0.7", + "@redis/search": "1.2.0", + "@redis/time-series": "1.1.0" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -753,6 +991,18 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/send": { "version": "0.19.0", "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", @@ -909,6 +1159,15 @@ "node": ">= 0.4.0" } }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -936,6 +1195,12 @@ "engines": { "node": ">=16" } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "license": "ISC" } } } diff --git a/backend/package.json b/backend/package.json index ac03c3c..5a98e93 100644 --- a/backend/package.json +++ b/backend/package.json @@ -10,10 +10,13 @@ "license": "ISC", "description": "", "dependencies": { + "@azure/msal-node": "^2.16.2", "body-parser": "^1.20.3", "cors": "^2.8.5", + "dotenv": "^16.4.7", "express": "^4.21.2", "mariadb": "^3.4.0", - "mongodb": "^6.12.0" + "mongodb": "^6.12.0", + "redis": "^4.7.0" } } diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelte index 983b498..9852654 100644 --- a/frontend/src/routes/+layout.svelte +++ b/frontend/src/routes/+layout.svelte @@ -3,9 +3,9 @@ -
+
MPE Logo - Add + Add
diff --git a/frontend/src/routes/login/+page.svelte b/frontend/src/routes/login/+page.svelte index e69de29..483f5fc 100644 --- a/frontend/src/routes/login/+page.svelte +++ b/frontend/src/routes/login/+page.svelte @@ -0,0 +1,46 @@ + +
+
+

Sign in to your account

+
+ +
+
+
+ +
+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+ +
+
+ + +

+ Not a member? + Sign Up Now +

+
+
\ No newline at end of file