diff --git a/Api/.env b/Api/.env index c1170136..066ac050 100644 --- a/Api/.env +++ b/Api/.env @@ -8,24 +8,81 @@ #!######################################################################## #*/ -POAM_DB_HOST="localhost" #POAM database host, referenced in Api/utils/config.js -POAM_DB_USER="root" #POAM database user, referenced in Api/utils/config.js -POAM_DB_PASSWORD="root" #POAM database password, referenced in Api/utils/config.js -POAM_DB_SCHEMA="poamtracking" #POAM database name, referenced in Api/utils/config.js -POAM_DB_TYPE="mysql" #POAM database dialect, referenced in Api/utils/config.js -POAM_DB_PORT="3306" #POAM database port, referenced in Api/utils/config.js -POAM_DB_MAX_CONNECTIONS="25" #POAM database max connections, referenced in Api/utils/config.js - -USERSERVICE_DB_HOST="localhost" #Userservice database host, referenced in Api/services/mysql/userservice.js -USERSERVICE_DB_PORT="3306" #Userservice database port, referenced in Api/services/mysql/userservice.js -USERSERVICE_DB_USER="root" #Userservice database user, referenced in Api/services/mysql/userservice.js -USERSERVICE_DB_PASSWORD="root" #Userservice database password, referenced in Api/services/mysql/userservice.js -USERSERVICE_DB_DATABASE="poamtracking" #Userservice database name, referenced in Api/services/mysql/userservice.js -USERSERVICE_DB_DIALECT="mysql" #Userservice database dialect, referenced in Api/services/mysql/userservice.js -USERSERVICE_DB_MAX_CONNECTIONS="25" #Userservice database max connections, referenced in Api/services/mysql/userservice.js -USERSERVICE_DB_MIN_CONNECTIONS="0" #Userservice database min connections, referenced in Api/services/mysql/userservice.js" -USERSERVICE_DB_ACQUIRE="30000" #Userservice database acquire, referenced in Api/services/mysql/userservice.js -USERSERVICE_DB_IDLE="10000" #Userservice database idle, referenced in Api/services/mysql/userservice.js - - -JWT_SECRET_KEY="wpm_token" #JWT secret key, referenced in Api/utils/token-generator.js +# referenced in Api/utils/config.js +COMMIT_BRANCH="na" +COMMIT_SHA="na" +COMMIT_TAG="na" +COMMIT_DESCRIBE="na" + +#settings config +POAM_DEV_RESPONSE_VALIDATION="none" + +#client config +POAM_CLIENT_ID="stig-manager" +POAM_CLIENT_API_BASE="api" +POAM_CLIENT_DISABLED="true" +POAM_CLIENT_DIRECTORY="../../client/dist" + +#welcome congif +POAM_CLIENT_WELCOME_IMAGE="" +POAM_CLIENT_WELCOME_MESSAGE="" +POAM_CLIENT_WELCOME_TITLE="" +POAM_CLIENT_WELCOME_LINK="" + +#docs config +POAM_DOCS_DISABLED="true" +POAM_DOCS_DIRECTORY="../../docs/_build/html" + +#http config +POAM_API_ADDRESS="0.0.0.0" +POAM_API_PORT="54000" +POAM_API_MAX_JSON_BODY="5242880" +POAM_API_MAX_UPLOAD="1073741824" + +#database config +POAM_DB_HOST="localhost" +POAM_DB_USER="root" +POAM_DB_PASSWORD="root" +POAM_DB_REVERT="true" +POAM_DB_SCHEMA="poamtracking" +POAM_DB_TYPE="mysql" +POAM_DB_PORT="3306" +POAM_DB_MAX_CONNECTIONS="25" + +POAM_OIDC_PROVIDER="http://localhost:8080/realms/RMFTools" +POAM_API_AUTHORITY="http://localhost:8080/realms/RMFTools" + +#init config +POAM_INIT_IMPORT_STIGS="true" +POAM_INIT_IMPORT_SCAP="true" + +#swagger config +POAM_SWAGGER_OIDC_PROVIDER="http://localhost:8080/realms/RMFTools" +POAM_SWAGGER_ENABLED="true" +POAM_SWAGGER_SERVER="http://localhost:54000/api" +POAM_SWAGGER_REDIRECT="http://localhost:54000/api-docs/oauth2-redirect.html" + +#oauth config +POAM_JWT_SCOPE_CLAIM="scope" +POAM_JWT_USERNAME_CLAIM="preferred_username" +POAM_JWT_NAME_CLAIM="name" +POAM_JWT_SERVICENAME_CLAIM="clientId" +POAM_JWT_EMAIL_CLAIM="email" + +#log config +POAM_LOG_MODE="combined" + +#userservice config +USERSERVICE_DB_HOST="localhost" +USERSERVICE_DB_PORT="3306" +USERSERVICE_DB_USER="root" +USERSERVICE_DB_PASSWORD="root" +USERSERVICE_DB_DATABASE="poamtracking" +USERSERVICE_DB_DIALECT="mysql" +USERSERVICE_DB_MAX_CONNECTIONS="25" +USERSERVICE_DB_MIN_CONNECTIONS="0" +USERSERVICE_DB_ACQUIRE="30000" +USERSERVICE_DB_IDLE="10000" + +#JWT secret key, referenced in Api/utils/token-generator.js +JWT_SECRET_KEY="wpm_token" diff --git a/Api/Controllers/STIGMANAsset.controller.js b/Api/Controllers/STIGMANAsset.controller.js new file mode 100644 index 00000000..21de203e --- /dev/null +++ b/Api/Controllers/STIGMANAsset.controller.js @@ -0,0 +1,44 @@ +const express = require('express'); +const db = require('../utils/sequelize'); +const router = express.Router(); + +async function importAssets(req, res) { + try { + const { assets } = req.body; + + // Handle Assets + for (const asset of assets) { + const collection = asset.collection || {}; + const assetData = { + assetId: asset.assetId, + assetName: asset.name, + fullyQualifiedDomainName: asset.fqdn || '', + description: asset.description || '', + ipAddress: asset.ip || '', + macAddress: asset.mac || '', + nonComputing: asset.noncomputing ? 1 : 0, + collectionId: collection.collectionId || null, + metadata: asset.metadata ? JSON.stringify(asset.metadata) : '{}', + }; + + // Find or create the asset + const [assetRecord, assetCreated] = await db.Asset.findOrCreate({ + where: { assetName: asset.name }, + defaults: assetData + }); + + if (!assetCreated) { + await assetRecord.update(assetData); + } + } + + res.status(200).json({ message: 'Assets Imported Successfully' }); + } catch (error) { + console.error(error); + res.status(500).json({ message: 'Internal Server Error' }); + } +} + +module.exports = { + importAssets +}; diff --git a/Api/Controllers/STIGMANCollection.controller.js b/Api/Controllers/STIGMANCollection.controller.js new file mode 100644 index 00000000..c73c1bfb --- /dev/null +++ b/Api/Controllers/STIGMANCollection.controller.js @@ -0,0 +1,61 @@ +const express = require('express'); +const db = require('../utils/sequelize.js'); +const router = express.Router(); + +async function importCollectionAndAssets(req, res) { + try { + const { collection, assets } = req.body; + + // Handle Collection + const collectionData = { + collectionId: collection.collectionId, + collectionName: collection.name, + description: collection.description || '', + metadata: collection.metadata ? JSON.stringify(collection.metadata) : '{}', + settings: collection.settings ? JSON.stringify(collection.settings) : '{}' + }; + + const [collectionRecord, created] = await db.Collection.findOrCreate({ + where: { collectionName: collection.name }, + defaults: collectionData + }); + + if (!created) { + await collectionRecord.update(collectionData); + } + + // Handle Assets + for (const asset of assets) { + const assetData = { + assetId: asset.assetId, + assetName: asset.name, + fullyQualifiedDomainName: asset.fqdn || '', + description: asset.description || '', + ipAddress: asset.ip || '', + macAddress: asset.mac || '', + nonComputing: asset.noncomputing ? 1 : 0, + collectionId: collectionRecord.collectionId, // Ensure this is correctly assigned + metadata: asset.metadata ? JSON.stringify(asset.metadata) : '{}', + }; + + const [assetRecord, assetCreated] = await db.Asset.findOrCreate({ + where: { assetName: asset.name }, // Assuming assetName is unique + defaults: assetData + }); + + if (!assetCreated) { + await assetRecord.update(assetData); + } + } + + res.status(200).json({ message: 'Collection and Assets Imported Successfully' }); + } catch (error) { + // Log the error and send a server error response + console.error(error); + res.status(500).json({ message: 'Internal Server Error' }); + } +}; + +module.exports = { + importCollectionAndAssets +}; diff --git a/Api/Models/asset.model.js b/Api/Models/asset.model.js new file mode 100644 index 00000000..ac3ba063 --- /dev/null +++ b/Api/Models/asset.model.js @@ -0,0 +1,58 @@ +module.exports = (sequelize, DataTypes) => { + const Asset = sequelize.define('Asset', { + assetId: { + type: DataTypes.INTEGER, + primaryKey: true, + autoIncrement: true, + }, + assetName: { + type: DataTypes.STRING(255), + allowNull: false, + unique: true, + }, + fullyQualifiedDomainName: { + type: DataTypes.STRING(255), + }, + collectionId: { + type: DataTypes.INTEGER, + allowNull: false, + }, + description: { + type: DataTypes.STRING(75), + }, + ipAddress: { + type: DataTypes.STRING(20), + }, + macAddress: { + type: DataTypes.STRING(50), + }, + nonComputing: { + type: DataTypes.TINYINT(1), + defaultValue: '0', + }, + metadata: { + type: DataTypes.JSON, + }, + state: { + type: DataTypes.ENUM('enabled', 'disabled'), + }, + stateDate: { + type: DataTypes.DATE, + }, + stateUserId: { + type: DataTypes.INTEGER, + }, + isEnabled: { + type: DataTypes.VIRTUAL, + get() { + const state = this.getDataValue('state'); + return state === 'enabled' ? 1 : 0; + } + }, + }, { + tableName: 'asset', + timestamps: false, + }); + + return Asset; +}; diff --git a/Api/Models/collection.model.js b/Api/Models/collection.model.js new file mode 100644 index 00000000..a2eeda99 --- /dev/null +++ b/Api/Models/collection.model.js @@ -0,0 +1,67 @@ +module.exports = (sequelize, DataTypes) => { + const Collection = sequelize.define('Collection', { + collectionId: { + type: DataTypes.INTEGER, + primaryKey: true, + autoIncrement: true, + }, + collectionName: { + type: DataTypes.STRING(50), + allowNull: false, + }, + description: { + type: DataTypes.STRING(255), + }, + created: { + type: DataTypes.DATE, + defaultValue: DataTypes.NOW, + }, + grantCount: { + type: DataTypes.INTEGER, + defaultValue: '0', + }, + assetCount: { + type: DataTypes.INTEGER, + defaultValue: '0', + }, + poamCount: { + type: DataTypes.INTEGER, + defaultValue: '0', + }, + settings: { + type: DataTypes.JSON, + }, + metadata: { + type: DataTypes.JSON, + }, + state: { + type: DataTypes.ENUM('enabled', 'disabled'), + }, + createdUserId: { + type: DataTypes.INTEGER, + }, + stateDate: { + type: DataTypes.DATE, + }, + stateUserId: { + type: DataTypes.INTEGER, + }, + isEnabled: { + type: DataTypes.VIRTUAL, + get() { + return this.getDataValue('state') === 'enabled'; + } + }, + isNameUnavailable: { + type: DataTypes.VIRTUAL, + get() { + return this.getDataValue('state') === 'cloning' || this.getDataValue('state') === 'enabled'; + } + }, + }, { + tableName: 'collection', + timestamps: false, + }); + + return Collection; +}; \ No newline at end of file diff --git a/Api/Services/mysql/assetService.js b/Api/Services/mysql/assetService.js index ff2e99d1..8f9e3ed6 100644 --- a/Api/Services/mysql/assetService.js +++ b/Api/Services/mysql/assetService.js @@ -14,335 +14,335 @@ const dbUtils = require('./utils') const mysql = require('mysql2') exports.getAssets = async function getAssets(req, res, next) { - console.log("getAssets (Service) ..."); - - try { - let connection - connection = await dbUtils.pool.getConnection() - let sql = "SELECT * FROM poamtracking.asset ORDER BY assetName;" - //console.log("getLabels sql: ", sql) - - let [rowAssets] = await connection.query(sql) - console.log("rowAssets: ", rowAssets[0]) - await connection.release() - - var size = Object.keys(rowAssets).length - - var assets = [] - - for (let counter = 0; counter < size; counter++) { - // console.log("Before setting permissions size: ", size, ", counter: ",counter); - - assets.push({ - "assetId": rowAssets[counter].assetId, - "assetName": rowAssets[counter].assetName, - "description": rowAssets[counter].description, - "fullyQualifiedDomainName": rowAssets[counter].fullyqualifiedDomainName, - "collectionId": rowAssets[counter].collectionId, - "ipAddress": rowAssets[counter].ipAddress, - "macAddress": rowAssets[counter].macAddress, - // "nonComputing": rowAssets[counter].nonComputing - }); - } + console.log("getAssets (Service) ..."); + + try { + let connection + connection = await dbUtils.pool.getConnection() + let sql = "SELECT * FROM poamtracking.asset ORDER BY assetName;" + //console.log("getLabels sql: ", sql) + + let [rowAssets] = await connection.query(sql) + console.log("rowAssets: ", rowAssets[0]) + await connection.release() + + var size = Object.keys(rowAssets).length + + var assets = [] + + for (let counter = 0; counter < size; counter++) { + // console.log("Before setting permissions size: ", size, ", counter: ",counter); + + assets.push({ + "assetId": rowAssets[counter].assetId, + "assetName": rowAssets[counter].assetName, + "description": rowAssets[counter].description, + "fullyQualifiedDomainName": rowAssets[counter].fullyqualifiedDomainName, + "collectionId": rowAssets[counter].collectionId, + "ipAddress": rowAssets[counter].ipAddress, + "macAddress": rowAssets[counter].macAddress, + // "nonComputing": rowAssets[counter].nonComputing + }); + } - return { assets }; + return { assets }; - } - catch (error) { - let errorResponse = { null: "null" } - //await connection.release() - return errorResponse; - } + } + catch (error) { + let errorResponse = { null: "null" } + //await connection.release() + return errorResponse; + } } exports.getAssetsByCollection = async function getAssetsByCollection(req, res, next) { - console.log("getAssetsByCollection (Service) ..."); - if (!req.params.collectionId) { - console.info('getAssetsByCollection collectionId not provided.'); - return next({ - status: 422, - errors: { - collectionId: 'is required', - } - }); + console.log("getAssetsByCollection (Service) ..."); + if (!req.params.collectionId) { + console.info('getAssetsByCollection collectionId not provided.'); + return next({ + status: 422, + errors: { + collectionId: 'is required', + } + }); + } + + try { + let connection + connection = await dbUtils.pool.getConnection() + let sql = "SELECT * FROM poamtracking.asset WHERE collectionId = ? ORDER BY assetName;" + //console.log("getLabels sql: ", sql) + + let [rowAssets] = await connection.query(sql, req.params.collectionId) + console.log("rowAssets: ", rowAssets[0]) + await connection.release() + + var size = Object.keys(rowAssets).length + + var assets = [] + + for (let counter = 0; counter < size; counter++) { + // console.log("Before setting permissions size: ", size, ", counter: ",counter); + + assets.push({ + ...rowAssets[counter] + }); } - try { - let connection - connection = await dbUtils.pool.getConnection() - let sql = "SELECT * FROM poamtracking.asset WHERE collectionId = ? ORDER BY assetName;" - //console.log("getLabels sql: ", sql) - - let [rowAssets] = await connection.query(sql, req.params.collectionId) - console.log("rowAssets: ", rowAssets[0]) - await connection.release() - - var size = Object.keys(rowAssets).length - - var assets = [] - - for (let counter = 0; counter < size; counter++) { - // console.log("Before setting permissions size: ", size, ", counter: ",counter); - - assets.push({ - ...rowAssets[counter] - }); - } - - return { assets }; + return { assets }; - } - catch (error) { - let errorResponse = { null: "null" } - //await connection.release() - return errorResponse; - } + } + catch (error) { + let errorResponse = { null: "null" } + //await connection.release() + return errorResponse; + } } exports.getAsset = async function getAsset(req, res, next) { - // res.status(201).json({ message: "getAsset (Service) Method called successfully" }); - - if (!req.params.assetId) { - console.info('getLabel labelId not provided.'); - return next({ - status: 422, - errors: { - assetId: 'is required', - } - }); - } - - try { - let connection - connection = await dbUtils.pool.getConnection() - let sql = "SELECT * FROM poamtracking.asset WHERE assetId=" + req.params.assetId + ";" - // console.log("getAsset sql: ", sql) - - let [rowAsset] = await connection.query(sql) - console.log("rowAsset: ", rowAsset[0]) - await connection.release() - - var asset = [rowAsset[0]] - - return { asset }; - } - catch (error) { - let errorResponse = { null: "null" } - //await connection.release() - return errorResponse; - } + // res.status(201).json({ message: "getAsset (Service) Method called successfully" }); + + if (!req.params.assetId) { + console.info('getLabel labelId not provided.'); + return next({ + status: 422, + errors: { + assetId: 'is required', + } + }); + } + + try { + let connection + connection = await dbUtils.pool.getConnection() + let sql = "SELECT * FROM poamtracking.asset WHERE assetId=" + req.params.assetId + ";" + // console.log("getAsset sql: ", sql) + + let [rowAsset] = await connection.query(sql) + console.log("rowAsset: ", rowAsset[0]) + await connection.release() + + var asset = [rowAsset[0]] + + return { asset }; + } + catch (error) { + let errorResponse = { null: "null" } + //await connection.release() + return errorResponse; + } } exports.postAsset = async function posAsset(req, res, next) { - // res.status(201).json({ message: "postAsset (Service) Method called successfully" }); - // console.log("postAsset req.body: ", req.body) - - if (!req.body.assetName) { - console.info('postAsset assetName not provided.'); - return next({ - status: 422, - errors: { - assetName: 'is required', - } - }); - } - - if (!req.body.collectionId) { - console.info('postAsset collectionId not provided.'); - return next({ - status: 422, - errors: { - collectionId: 'is required', - } - }); - } - - if (!req.body.ipAddress) { - console.info('postAsset ipAddressnot provided.'); - return next({ - status: 422, - errors: { - ipAddress: 'is required', - } - }); - } - - // if (!req.body.nonComputing) { - // console.info('postAsset nonComputing not provided.'); - // return next({ - // status: 422, - // errors: { - // nonComputing: 'is required', - // } - // }); - // } - - try { - let connection - connection = await dbUtils.pool.getConnection() - - let sql_query = `INSERT INTO poamtracking.asset (assetName, fullyQualifiedDomainName, + // res.status(201).json({ message: "postAsset (Service) Method called successfully" }); + // console.log("postAsset req.body: ", req.body) + + if (!req.body.assetName) { + console.info('postAsset assetName not provided.'); + return next({ + status: 422, + errors: { + assetName: 'is required', + } + }); + } + + if (!req.body.collectionId) { + console.info('postAsset collectionId not provided.'); + return next({ + status: 422, + errors: { + collectionId: 'is required', + } + }); + } + + if (!req.body.ipAddress) { + console.info('postAsset ipAddressnot provided.'); + return next({ + status: 422, + errors: { + ipAddress: 'is required', + } + }); + } + + // if (!req.body.nonComputing) { + // console.info('postAsset nonComputing not provided.'); + // return next({ + // status: 422, + // errors: { + // nonComputing: 'is required', + // } + // }); + // } + + try { + let connection + connection = await dbUtils.pool.getConnection() + + let sql_query = `INSERT INTO poamtracking.asset (assetName, fullyQualifiedDomainName, collectionId, description, ipAddress, macAddress) values (?, ?, ?, ?, ?, ?)` - await connection.query(sql_query, [req.body.assetName, req.body.fullyQualifiedDomainName, - req.body.collectionId, req.body.description, req.body.ipAddress, - req.body.macAddress]) - await connection.release() - - let sql = "SELECT * FROM poamtracking.asset WHERE assetName = '" + req.body.assetName + "';" - let [rowAsset] = await connection.query(sql) - console.log("rowAsset: ", rowAsset[0]) - await connection.release() - - // console.log("userID: ", user[0].userId) - if (req.body.labels) { - let labels = req.body.labels; - // console.log("collectionRequest: ",collectionRequest) - labels.forEach(async label => { - connection = await dbUtils.pool.getConnection() - - let sql_query = `INSERT INTO poamtracking.assetLabels (assetId, labelId) values (?, ?)` - - await connection.query(sql_query, [rowAsset[0].assetId, label.labelId]) - await connection.release() - }); - } - - var assetLabel = rowAsset[0] - - // const message = new Object() - // message.assetId = rowAsset[0].assetId - // message.assetName = rowAsset[0].assetName - // message.fullyQualifiedDomainName = rowAsset[0].fullyQualifiedDomainName - // message.collectionId = rowAsset[0].collectionId - // message.description = rowAsset[0].description - // message.ipAddress = rowAsset[0].ipAddress - // message.macAddress = rowAsset[0].macAddress - // message.nonComputing = rowAsset[0].nonComputing - - return (assetLabel) - } - catch (error) { - console.log("error: ", error) - let errorResponse = { null: "null" } - //await connection.release() - return errorResponse; - } -} - -exports.putAsset = async function putAsset(req, res, next) { - // res.status(201).json({ message: "putPermission (Service) Method called successfully" }); - - if (!req.body.assetId) { - console.info('putAsset assetId not provided.'); - return next({ - status: 422, - errors: { - assetId: 'is required', - } - }); - } - - if (!req.body.assetName) { - console.info('putAsset assetName not provided.'); - return next({ - status: 422, - errors: { - assetName: 'is required', - } - }); - } - - if (!req.body.collectionId) { - console.info('putAsset collectionId not provided.'); - return next({ - status: 422, - errors: { - collectionId: 'is required', - } - }); - } - - if (!req.body.ipAddress) { - console.info('putAsset ipAddress not provided.'); - return next({ - status: 422, - errors: { - ipAddress: 'is required', - } - }); - } - - if (!req.body.description) req.body.description = ""; - if (!req.body.fullyQualifiedDomainName) req.body.fullyQualifiedDomainName = ""; - if (!req.body.macAddress) req.body.macAddress = ""; - - try { - let connection + await connection.query(sql_query, [req.body.assetName, req.body.fullyQualifiedDomainName, + req.body.collectionId, req.body.description, req.body.ipAddress, + req.body.macAddress]) + await connection.release() + + let sql = "SELECT * FROM poamtracking.asset WHERE assetName = '" + req.body.assetName + "';" + let [rowAsset] = await connection.query(sql) + console.log("rowAsset: ", rowAsset[0]) + await connection.release() + + // console.log("userID: ", user[0].userId) + if (req.body.labels) { + let labels = req.body.labels; + // console.log("collectionRequest: ",collectionRequest) + labels.forEach(async label => { connection = await dbUtils.pool.getConnection() - let sql_query = "UPDATE poamtracking.asset SET assetName= ?, fullyQualifiedDomainName= ?, " + - "collectionId= ?, description= ?, ipAddress= ?, macAddress= ? " + - "WHERE assetId = " + req.body.assetId + ";" + let sql_query = `INSERT INTO poamtracking.assetLabels (assetId, labelId) values (?, ?)` - await connection.query(sql_query, [req.body.assetName, req.body.fullyQualifiedDomainName, - req.body.collectionId, req.body.description, req.body.ipAddress, - req.body.macAddress]) + await connection.query(sql_query, [rowAsset[0].assetId, label.labelId]) await connection.release() + }); + } - let sql = "SELECT * FROM poamtracking.asset WHERE assetId = '" + req.body.assetId + "';" - let [rowAsset] = await connection.query(sql) - //console.log("rowAsset: ", rowAsset[0]) - await connection.release() + var assetLabel = rowAsset[0] + + // const message = new Object() + // message.assetId = rowAsset[0].assetId + // message.assetName = rowAsset[0].assetName + // message.fullyQualifiedDomainName = rowAsset[0].fullyQualifiedDomainName + // message.collectionId = rowAsset[0].collectionId + // message.description = rowAsset[0].description + // message.ipAddress = rowAsset[0].ipAddress + // message.macAddress = rowAsset[0].macAddress + // message.nonComputing = rowAsset[0].nonComputing + + return (assetLabel) + } + catch (error) { + console.log("error: ", error) + let errorResponse = { null: "null" } + //await connection.release() + return errorResponse; + } +} - const message = new Object() - message.assetId = rowAsset[0].assetId - message.assetName = rowAsset[0].assetName - message.fullyQualifiedDomainName = rowAsset[0].fullyQualifiedDomainName - message.collectionId = rowAsset[0].collectionId - message.description = rowAsset[0].description - message.ipAddress = rowAsset[0].ipAddress - message.macAddress = rowAsset[0].macAddress - // message.nonComputing = rowAsset[0].nonComputing - return (message) - } - catch (error) { - let errorResponse = { null: "null" } - await connection.release() - return errorResponse; - } +exports.putAsset = async function putAsset(req, res, next) { + // res.status(201).json({ message: "putPermission (Service) Method called successfully" }); + + if (!req.body.assetId) { + console.info('putAsset assetId not provided.'); + return next({ + status: 422, + errors: { + assetId: 'is required', + } + }); + } + + if (!req.body.assetName) { + console.info('putAsset assetName not provided.'); + return next({ + status: 422, + errors: { + assetName: 'is required', + } + }); + } + + if (!req.body.collectionId) { + console.info('putAsset collectionId not provided.'); + return next({ + status: 422, + errors: { + collectionId: 'is required', + } + }); + } + + if (!req.body.ipAddress) { + console.info('putAsset ipAddress not provided.'); + return next({ + status: 422, + errors: { + ipAddress: 'is required', + } + }); + } + + if (!req.body.description) req.body.description = ""; + if (!req.body.fullyQualifiedDomainName) req.body.fullyQualifiedDomainName = ""; + if (!req.body.macAddress) req.body.macAddress = ""; + + try { + let connection + connection = await dbUtils.pool.getConnection() + + let sql_query = "UPDATE poamtracking.asset SET assetName= ?, fullyQualifiedDomainName= ?, " + + "collectionId= ?, description= ?, ipAddress= ?, macAddress= ? " + + "WHERE assetId = " + req.body.assetId + ";" + + await connection.query(sql_query, [req.body.assetName, req.body.fullyQualifiedDomainName, + req.body.collectionId, req.body.description, req.body.ipAddress, + req.body.macAddress]) + await connection.release() + + let sql = "SELECT * FROM poamtracking.asset WHERE assetId = '" + req.body.assetId + "';" + let [rowAsset] = await connection.query(sql) + //console.log("rowAsset: ", rowAsset[0]) + await connection.release() + + const message = new Object() + message.assetId = rowAsset[0].assetId + message.assetName = rowAsset[0].assetName + message.fullyQualifiedDomainName = rowAsset[0].fullyQualifiedDomainName + message.collectionId = rowAsset[0].collectionId + message.description = rowAsset[0].description + message.ipAddress = rowAsset[0].ipAddress + message.macAddress = rowAsset[0].macAddress + // message.nonComputing = rowAsset[0].nonComputing + return (message) + } + catch (error) { + let errorResponse = { null: "null" } + await connection.release() + return errorResponse; + } } exports.deleteAsset = async function deleteAsset(req, res, next) { - // res.status(201).json({ message: "deletePermission (Service) Method called successfully" }); - if (!req.params.assetId) { - console.info('deleteAsset assetId not provided.'); - return next({ - status: 422, - errors: { - assetId: 'is required', - } - }); - } - - try { - let connection - connection = await dbUtils.pool.getConnection() - let sql = "DELETE FROM poamtracking.asset WHERE assetId=" + req.params.assetId + ";" - //console.log("deleteLabel sql: ", sql) - - await connection.query(sql) - // console.log("rowPermissions: ", rowPermissions[0]) - await connection.release() - - var asset = [] - - return { asset }; - } - catch (error) { - let errorResponse = { null: "null" } - await connection.release() - return errorResponse; - } + // res.status(201).json({ message: "deletePermission (Service) Method called successfully" }); + if (!req.params.assetId) { + console.info('deleteAsset assetId not provided.'); + return next({ + status: 422, + errors: { + assetId: 'is required', + } + }); + } + + try { + let connection + connection = await dbUtils.pool.getConnection() + let sql = "DELETE FROM poamtracking.asset WHERE assetId=" + req.params.assetId + ";" + //console.log("deleteLabel sql: ", sql) + + await connection.query(sql) + // console.log("rowPermissions: ", rowPermissions[0]) + await connection.release() + + var asset = [] + + return { asset }; + } + catch (error) { + let errorResponse = { null: "null" } + await connection.release() + return errorResponse; + } } \ No newline at end of file diff --git a/Api/index.js b/Api/index.js index 69f2bba4..81ed0c13 100644 --- a/Api/index.js +++ b/Api/index.js @@ -1,7 +1,8 @@ /* !####################################################################### ! C-PATTM SOFTWARE -! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file +! CRANE C-PATTM plan of action and milestones software. Use is governed by the +! Open Source Academic Research License Agreement contained in the file ! crane_C_PAT.1_license.txt, which is part of this software package. BY ! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND ! CONDITIONS OF THE LICENSE. @@ -12,118 +13,84 @@ require('dotenv').config(); const express = require('express'); const mysql = require('mysql2'); const app = express(); -const PORT = 8086 -const HOST = 'localhost' +const PORT = 8086; +const HOST = 'localhost'; var passport = require('passport'); const sequelize = require('./utils/sequelize'); -const path = require('path') -const multer = require('multer') -const http = require('http') +const path = require('path'); +const multer = require('multer'); +const http = require('http'); const cors = require('cors'); -const authAPI = require('./utils/authAPI') +const authAPI = require('./utils/authAPI'); const upload = multer({ storage: multer.memoryStorage() }); const poamUploadRoutes = require('./Routes/poamUpload.routes'); -//const server = http.createServer(app) +const STIGMANCollectionController = require('./Controllers/STIGMANCollection.controller'); +const STIGMANAssetController = require('./Controllers/STIGMANAsset.controller'); -const { middleware: openApiMiddleware, resolvers } = require('express-openapi-validator') -const eovPath = path.dirname(require.resolve('express-openapi-validator')) -const eovErrors = require(path.join(eovPath, 'framework', 'types.js')) -const config = require('./utils/config') -const { init } = require('./utils/config'); +const { middleware: openApiMiddleware } = require('express-openapi-validator'); +const apiSpecPath = path.join(__dirname, './specification/poam-manager.yaml'); +const eovPath = path.dirname(require.resolve('express-openapi-validator')); +const eovErrors = require(path.join(eovPath, 'framework', 'types.js')); +const config = require('./utils/config'); -let storage = multer.memoryStorage() -initAuth() -//process.on('uncaughtException', (err, origin) =>{console.log('CAUGHT')}) -//process.on('unhandledRejection', (reason, promise) => {console.log('CaughtRejection')}) +let storage = multer.memoryStorage(); +initAuth(); app.use(cors()); app.use(express.json({ - strict: false, //all root to be any JSON value, per https://datatracker.ietf.org/doc/html/rfc7159#section-2 - limit: parseInt('1048576') //TODO: Set this to a reasonable value. Measured in bytes, so currently 1mb. -})); + strict: false, // allow root to be any JSON value + limit: parseInt('1048576') // TODO: Set to a reasonable value. Measured in bytes (currently 1MB). +})); app.use('/api/poamimport', poamUploadRoutes); - -const apiSpecPath = path.join(__dirname,'./specification/poam-manager.yaml') -app.use("/", openApiMiddleware ({ - apiSpec: apiSpecPath, - validateRequests:{ - coerceTypes:false, - allowUnknownQueryParameters: false, - - }, - validateResponses: true, - validateApiSpec: true, - $refParser:{ - mode: 'dereference', - }, - operationHandlers: { - basePath: path.join(__dirname, 'controllers'), - resolver: modulePathResolver - }, - validateSecurity: { - handlers:{ - oauth: authAPI.verifyRequest - } - }, - -})) +app.use("/", openApiMiddleware({ + apiSpec: apiSpecPath, + validateRequests: { + coerceTypes: false, + allowUnknownQueryParameters: false, + }, + validateResponses: true, + validateApiSpec: true, + $refParser: { + mode: 'dereference', + }, + operationHandlers: { + basePath: path.join(__dirname, 'controllers'), + resolver: modulePathResolver + }, + validateSecurity: { + handlers: { + oauth: authAPI.verifyRequest + } + }, +})); + +app.post('/api/stigmancollectionimport', STIGMANCollectionController.importCollectionAndAssets); +app.post('/api/stigmanassetimport', STIGMANAssetController.importAssets); require('./utils/passport'); -async function initAuth(){ - await authAPI.initializeAuth() - +async function initAuth() { + await authAPI.initializeAuth(); } -//app.use((err,req,res,next) =>{ - //format error -// res.status(err.status || 500).json({ -// message: err.message, -// errors: err.errors, -// }); -//}); - - -/* -app.listen( - - PORT, - '0.0.0.0', - () => console.log(`It's alive on http://${HOST}:${PORT}`) - - -) -*/ - - let db = require(`./Services/${config.database.type}/utils`) - try{ - db.initializeDatabase(); - } - catch (e){ - console.log(e) - } - - const server = http.createServer(app).listen(PORT,() => console.log(`It's alive on http://${HOST}:${PORT}`)) - - - - -function modulePathResolver(handlersPath, route, apiDoc) -{ - const pathKey = route.openApiRoute.substring(route.basePath.length); - const schema = apiDoc.paths[pathKey][route.method.toLowerCase()]; - //const [controller, method] = schema ['operationID'].split('.'); - const controller = schema.tags[0] - const method = schema['operationId'] - const modulePath = path.join(handlersPath, controller) - const handler = require(modulePath); - if(handler[method] === undefined){ - throw new Error(`Could not find a [${method}] function in ${modulePath} when tyring to route [${route.method} ${route.expressRoute}]. Pathkey: ${pathKey} Schema: ${schema} Controller: ${controller} method: ${method} ModulePath: ${modulePath} Handler: ${handler}`,); - - } - - - return handler[method]; - - +let db = require(`./Services/${config.database.type}/utils`); +try { + db.initializeDatabase(); +} catch (e) { + console.log(e); } + +const server = http.createServer(app).listen(PORT, () => console.log(`It's alive on http://${HOST}:${PORT}`)); + +function modulePathResolver(handlersPath, route, apiDoc) { + const pathKey = route.openApiRoute.substring(route.basePath.length); + const schema = apiDoc.paths[pathKey][route.method.toLowerCase()]; + const controller = schema.tags[0]; + const method = schema['operationId']; + const modulePath = path.join(handlersPath, controller); + const handler = require(modulePath); + if (handler[method] === undefined) { + throw new Error(`Could not find a [${method}] function in ${modulePath} when trying to route [${route.method} ${route.expressRoute}]. Pathkey: ${pathKey} Schema: ${schema} Controller: ${controller} method: ${method} ModulePath: ${modulePath} Handler: ${handler}`); + } + return handler[method]; +} \ No newline at end of file diff --git a/Api/specification/poam-manager.yaml b/Api/specification/poam-manager.yaml index 88bae0df..f87766e3 100644 --- a/Api/specification/poam-manager.yaml +++ b/Api/specification/poam-manager.yaml @@ -61,10 +61,113 @@ paths: - oauth: - 'c-pat:read' + /api/stigmancollectionimport: + post: + summary: Import collection and assets + operationId: importCollectionAndAssets + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + collection: + $ref: '#/components/schemas/Collection' + assets: + type: array + items: + $ref: '#/components/schemas/Asset' + responses: + '200': + description: Collection and assets imported successfully + content: + application/json: + schema: + type: object + properties: + message: + type: string + '400': + description: Bad request - invalid data format or missing data + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '500': + description: Server error + content: + application/json: + schema: + $ref: '#/components/schemas/error' + tags: + - STIGMANCollection.controller + security: + - oauth: + - 'c-pat:read' + + /api/stigmanassetimport: + post: + summary: Import assets + operationId: importAssets + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + assets: + type: array + items: + $ref: '#/components/schemas/Asset' + responses: + '200': + description: Assets imported successfully + content: + application/json: + schema: + type: object + properties: + message: + type: string + '400': + description: Bad request - invalid data format or missing data + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '500': + description: Server error + content: + application/json: + schema: + $ref: '#/components/schemas/error' + tags: + - STIGMANAsset.controller + security: + - oauth: + - 'c-pat:read' + /assets: get: summary: Return all assets operationId: getAssets + parameters: + - name: page + in: query + description: Page number of the assets list + required: false + schema: + type: integer + default: 1 + - name: pageSize + in: query + description: Number of assets per page + required: false + schema: + type: integer + default: 20 responses: '200': description: Asset array response @@ -2122,6 +2225,28 @@ paths: components: schemas: + Collection: + type: object + properties: + collectionId: + type: string + name: + type: string + description: + type: string + nullable: true + metadata: + type: object + required: + - collectionId + - name + Asset: + type: object + properties: + assetId: + type: string + name: + type: string asset_Object: type: object required: @@ -2915,5 +3040,5 @@ components: securitySchemes: oauth: type: openIdConnect - openIdConnectUrl: https://localhost:8443/auth/realms/C-PAT/.well-known/openid-configuration + openIdConnectUrl: https://localhost:8080/realms/RMFTools/.well-known/openid-configuration diff --git a/Api/utils/config.js b/Api/utils/config.js index 8105c7f6..b8e4c11c 100644 --- a/Api/utils/config.js +++ b/Api/utils/config.js @@ -13,53 +13,50 @@ const package = require("../package.json") let config = { version: package.version, commit: { - branch: process.env.COMMIT_BRANCH || 'na', - sha: process.env.COMMIT_SHA || 'na', - tag: process.env.COMMIT_TAG || 'na', - describe: process.env.COMMIT_DESCRIBE || 'na' + branch: process.env.COMMIT_BRANCH, + sha: process.env.COMMIT_SHA, + tag: process.env.COMMIT_TAG, + describe: process.env.COMMIT_DESCRIBE }, settings: { setClassification: process.env.POAM_CLASSIFICATION, lastAccessResolution: 60, - // Supported POAM_DEV_RESPONSE_VALIDATION values: - // "logOnly" (logs failing response, but still sends them) - // "none"(no validation performed) - responseValidation: process.env.POAM_DEV_RESPONSE_VALIDATION || "none" + responseValidation: process.env.POAM_DEV_RESPONSE_VALIDATION }, client: { - clientId: process.env.POAM_CLIENT_ID || "stig-manager", - authority: process.env.POAM_CLIENT_OIDC_PROVIDER || process.env.POAM_OIDC_PROVIDER || "http://localhost:8080/auth/realms/poam", - apiBase: process.env.POAM_CLIENT_API_BASE || "api", - disabled: process.env.POAM_CLIENT_DISABLED === "true", - directory: process.env.POAM_CLIENT_DIRECTORY || '../../client/dist', + clientId: process.env.POAM_CLIENT_ID, + authority: process.env.POAM_CLIENT_OIDC_PROVIDER || process.env.POAM_OIDC_PROVIDER, + apiBase: process.env.POAM_CLIENT_API_BASE, + disabled: process.env.POAM_CLIENT_DISABLED, + directory: process.env.POAM_CLIENT_DIRECTORY, extraScopes: process.env.POAM_CLIENT_EXTRA_SCOPES, scopePrefix: process.env.POAM_CLIENT_SCOPE_PREFIX, refreshToken: { disabled: process.env.POAM_CLIENT_REFRESH_DISABLED ? process.env.POAM_CLIENT_REFRESH_DISABLED === "true" : false, }, welcome: { - image: process.env.POAM_CLIENT_WELCOME_IMAGE || "", - message: process.env.POAM_CLIENT_WELCOME_MESSAGE || "", - title: process.env.POAM_CLIENT_WELCOME_TITLE || "", - link: process.env.POAM_CLIENT_WELCOME_LINK || "" + image: process.env.POAM_CLIENT_WELCOME_IMAGE, + message: process.env.POAM_CLIENT_WELCOME_MESSAGE, + title: process.env.POAM_CLIENT_WELCOME_TITLE, + link: process.env.POAM_CLIENT_WELCOME_LINK } }, docs: { - disabled: process.env.POAM_DOCS_DISABLED === "true", - docsDirectory: process.env.POAM_DOCS_DIRECTORY || '../../docs/_build/html', + disabled: process.env.POAM_DOCS_DISABLED, + docsDirectory: process.env.POAM_DOCS_DIRECTORY, }, http: { - address: process.env.POAM_API_ADDRESS || "0.0.0.0", - port: process.env.POAM_API_PORT || 54000, - maxJsonBody: process.env.POAM_API_MAX_JSON_BODY || "5242880", - maxUpload: process.env.POAM_API_MAX_UPLOAD || "1073741824" + address: process.env.POAM_API_ADDRESS, + port: process.env.POAM_API_PORT, + maxJsonBody: process.env.POAM_API_MAX_JSON_BODY, + maxUpload: process.env.POAM_API_MAX_UPLOAD }, database: { - type: process.env.POAM_DB_TYPE || "mysql", - host: process.env.POAM_DB_HOST || "localhost", - port: process.env.POAM_DB_PORT || 3306, - schema: process.env.POAM_DB_SCHEMA || "poamtracking", + type: process.env.POAM_DB_TYPE, + host: process.env.POAM_DB_HOST, + port: process.env.POAM_DB_PORT, + schema: process.env.POAM_DB_SCHEMA, username: process.env.POAM_DB_USER, password: process.env.POAM_DB_PASSWORD, maxConnections: process.env.POAM_DB_MAX_CONNECTIONS || 25, @@ -68,7 +65,7 @@ let config = { cert_file: process.env.POAM_DB_TLS_CERT_FILE, key_file: process.env.POAM_DB_TLS_KEY_FILE }, - revert: process.env.POAM_DB_REVERT === "true", + revert: process.env.POAM_DB_REVERT, toJSON: function () { let {password, ...props} = this props.password = !!password @@ -76,29 +73,29 @@ let config = { } }, init: { - importStigs: process.env.POAM_INIT_IMPORT_STIGS === "true", - importScap: process.env.POAM_INIT_IMPORT_SCAP === "true" + importStigs: process.env.POAM_INIT_IMPORT_STIGS, + importScap: process.env.POAM_INIT_IMPORT_SCAP }, swaggerUi: { - enabled: process.env.POAM_SWAGGER_ENABLED === "true", - authority: process.env.POAM_SWAGGER_OIDC_PROVIDER || process.env.POAM_SWAGGER_AUTHORITY || process.env.POAM_OIDC_PROVIDER || "http://localhost:8080/auth/realms/poam", - server: process.env.POAM_SWAGGER_SERVER || "http://localhost:54000/api", - oauth2RedirectUrl: process.env.POAM_SWAGGER_REDIRECT || "http://localhost:54000/api-docs/oauth2-redirect.html" + enabled: process.env.POAM_SWAGGER_ENABLED, + authority: process.env.POAM_SWAGGER_OIDC_PROVIDER, + server: process.env.POAM_SWAGGER_SERVER, + oauth2RedirectUrl: process.env.POAM_SWAGGER_REDIRECT }, oauth: { - authority: process.env.POAM_OIDC_PROVIDER || process.env.POAM_API_AUTHORITY || "http://127.0.0.1:8080/realms/C-PAT", + authority: process.env.POAM_OIDC_PROVIDER || process.env.POAM_API_AUTHORITY, claims: { - scope: process.env.POAM_JWT_SCOPE_CLAIM || "scope", - username: process.env.POAM_JWT_USERNAME_CLAIM || "preferred_username", - servicename: process.env.POAM_JWT_SERVICENAME_CLAIM || "clientId", - name: process.env.POAM_JWT_NAME_CLAIM || process.env.POAM_JWT_USERNAME_CLAIM || "name", + scope: process.env.POAM_JWT_SCOPE_CLAIM, + username: process.env.POAM_JWT_USERNAME_CLAIM, + servicename: process.env.POAM_JWT_SERVICENAME_CLAIM, + name: process.env.POAM_JWT_NAME_CLAIM || process.env.POAM_JWT_USERNAME_CLAIM, privileges: formatChain(process.env.POAM_JWT_PRIVILEGES_CLAIM || "realm_access.roles"), - email: process.env.POAM_JWT_EMAIL_CLAIM || "email" + email: process.env.POAM_JWT_EMAIL_CLAIM } }, log: { level: parseInt(process.env.POAM_LOG_LEVEL) || 3, - mode: process.env.POAM_LOG_MODE || 'combined' + mode: process.env.POAM_LOG_MODE } } diff --git a/Api/utils/sequelize.js b/Api/utils/sequelize.js index 744c6887..32f9a0e6 100644 --- a/Api/utils/sequelize.js +++ b/Api/utils/sequelize.js @@ -28,8 +28,13 @@ const db = {}; db.Sequelize = Sequelize; db.sequelize = sequelize; -// Importing and initializing your models +// Importing and initializing models +db.Asset = require("../Models/asset.model.js")(sequelize, Sequelize.DataTypes); +db.Collection = require("../Models/collection.model.js")(sequelize, Sequelize.DataTypes); db.Poam = require("../Models/poam.model.js")(sequelize, Sequelize.DataTypes); db.poamAsset = require("../Models/poamAsset.model.js")(sequelize, Sequelize.DataTypes); +db.Asset.belongsTo(db.Collection, { foreignKey: 'collectionId' }); +db.Collection.hasMany(db.Asset, { foreignKey: 'collectionId' }); + module.exports = db; diff --git a/Database/POAM_Tracking_Tool_Data_Model.sql b/Database/POAM_Tracking_Tool_Data_Model.sql index de74164f..05f18527 100644 --- a/Database/POAM_Tracking_Tool_Data_Model.sql +++ b/Database/POAM_Tracking_Tool_Data_Model.sql @@ -30,14 +30,19 @@ CREATE TABLE `poamtracking`.`user` ( ) CREATE TABLE `asset` ( - `assetId` int NOT NULL AUTO_INCREMENT, - `assetName` varchar(100) NOT NULL, - `fullyQualifiedDomainName` varchar(100) DEFAULT NULL, - `collectionId` int NOT NULL, - `description` varchar(75) DEFAULT NULL, - `ipAddress` varchar(20) NOT NULL, - `macAddress` varchar(50) NOT NULL, - `nonComputing` tinyint(1) NOT NULL DEFAULT '0', + `assetId` INT NOT NULL AUTO_INCREMENT, + `assetName` VARCHAR(255) NOT NULL, + `fullyQualifiedDomainName` VARCHAR(255) DEFAULT NULL, + `collectionId` INT NOT NULL, + `description` VARCHAR(75) DEFAULT NULL, + `ipAddress` VARCHAR(20) DEFAULT NULL, + `macAddress` VARCHAR(50) DEFAULT NULL, + `nonComputing` TINYINT(1) DEFAULT '0', + `metadata` JSON, + `state` ENUM('enabled', 'disabled'), + `stateDate` DATETIME, + `stateUserId` INT, + `isEnabled` TINYINT GENERATED ALWAYS AS (case when `state` = 'enabled' then 1 else NULL end), PRIMARY KEY (`assetId`), UNIQUE KEY `assetId_UNIQUE` (`assetId`) /*!80000 INVISIBLE */, UNIQUE KEY `assetName_UNIQUE` (`assetName`) /*!80000 INVISIBLE */, @@ -96,13 +101,21 @@ CREATE TABLE `poamapprovers` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; CREATE TABLE `poamtracking`.`collection` ( - `collectionId` int NOT NULL AUTO_INCREMENT, - `collectionName` varchar(50) NOT NULL, - `description` varchar(75) DEFAULT NULL, - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `grantCount` int NOT NULL DEFAULT '0', - `assetCount` int NOT NULL DEFAULT '0', - `poamCount` int NOT NULL DEFAULT '0', + `collectionId` INT NOT NULL AUTO_INCREMENT, + `collectionName` VARCHAR(50) NOT NULL, + `description` VARCHAR(255) DEFAULT NULL, + `created` DATETIME DEFAULT CURRENT_TIMESTAMP, + `grantCount` INT DEFAULT '0', + `assetCount` INT DEFAULT '0', + `poamCount` INT DEFAULT '0', + `settings` JSON, + `metadata` JSON, + `state` ENUM('enabled', 'disabled'), + `createdUserId` INT, + `stateDate` DATETIME, + `stateUserId` INT, + `isEnabled` TINYINT GENERATED ALWAYS AS (case when `state` = 'enabled' then 1 else NULL end), + `isNameUnavailable` TINYINT GENERATED ALWAYS AS (case when ((`state` = 'cloning') or (`state` = 'enabled')) then 1 else NULL end), PRIMARY KEY (`collectionId`)); CREATE TABLE `poam` ( diff --git a/Front End/poam-app/package-lock.json b/Front End/poam-app/package-lock.json index 69e8f49a..1243e121 100644 --- a/Front End/poam-app/package-lock.json +++ b/Front End/poam-app/package-lock.json @@ -24,6 +24,8 @@ "@nebular/theme": "^10.0.0", "@ng-bootstrap/ng-bootstrap": "^13.0.0", "@popperjs/core": "^2.10.2", + "@syncfusion/ej2-angular-treegrid": "^24.1.45", + "axios": "^1.6.5", "bootstrap": "^5.2.0", "chart.js": "^2.9.4", "eva-icons": "^1.1.3", @@ -774,9 +776,9 @@ } }, "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.23.6.tgz", - "integrity": "sha512-cBXU1vZni/CpGF29iTu4YRbOZt3Wat6zCoMDxRF1MayiEc4URxOj31tT65HUM0CRpMowA3HCJaAOVOUnMf96cw==", + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.23.7.tgz", + "integrity": "sha512-xCoqR/8+BoNnXOY7RVSgv6X+o7pmT5q1d+gGcRlXYkI+9B31glE4jeejhKVpA04O1AtzOt7OSQ6VYKP5FcRl9g==", "dev": true, "dependencies": { "@babel/helper-annotate-as-pure": "^7.22.5", @@ -1120,12 +1122,12 @@ } }, "node_modules/@babel/helpers": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.6.tgz", - "integrity": "sha512-wCfsbN4nBidDRhpDhvcKlzHWCTlgJYUUdSJfzXb2NuBssDSIjc3xcb+znA7l+zYsFljAcGM0aFkN40cR3lXiGA==", + "version": "7.23.8", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.8.tgz", + "integrity": "sha512-KDqYz4PiOWvDFrdHLPhKtCThtIcKVy6avWD2oG4GEvyQ+XDZwHD4YQd+H2vNMnq2rkdxsDkU82T+Vk8U/WXHRQ==", "dependencies": { "@babel/template": "^7.22.15", - "@babel/traverse": "^7.23.6", + "@babel/traverse": "^7.23.7", "@babel/types": "^7.23.6" }, "engines": { @@ -1720,16 +1722,15 @@ } }, "node_modules/@babel/plugin-transform-classes": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.23.5.tgz", - "integrity": "sha512-jvOTR4nicqYC9yzOHIhXG5emiFEOpappSJAl73SDSEDcybD+Puuze8Tnpb9p9qEyYup24tq891gkaygIFvWDqg==", + "version": "7.23.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.23.8.tgz", + "integrity": "sha512-yAYslGsY1bX6Knmg46RjiCiNSwJKv2IUC8qOdYKqMMr0491SXFhcHqOdRDeCRohOOIzwN/90C6mQ9qAKgrP7dg==", "dev": true, "dependencies": { "@babel/helper-annotate-as-pure": "^7.22.5", - "@babel/helper-compilation-targets": "^7.22.15", + "@babel/helper-compilation-targets": "^7.23.6", "@babel/helper-environment-visitor": "^7.22.20", "@babel/helper-function-name": "^7.23.0", - "@babel/helper-optimise-call-expression": "^7.22.5", "@babel/helper-plugin-utils": "^7.22.5", "@babel/helper-replace-supers": "^7.22.20", "@babel/helper-split-export-declaration": "^7.22.6", @@ -2383,9 +2384,9 @@ } }, "node_modules/@babel/traverse": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.6.tgz", - "integrity": "sha512-czastdK1e8YByZqezMPFiZ8ahwVMh/ESl9vPgvgdB9AmFMGP5jfpFax74AQgl5zj4XHzqeYAg2l8PuUeRS1MgQ==", + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.7.tgz", + "integrity": "sha512-tY3mM8rH9jM0YHFGyfC0/xf+SB5eKUu7HPj7/k3fpi9dAlsMc5YbQvDi0Sh2QTPXqMhyaAtzAr807TIyfQrmyg==", "dependencies": { "@babel/code-frame": "^7.23.5", "@babel/generator": "^7.23.6", @@ -2845,9 +2846,9 @@ "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.20", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", - "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", + "version": "0.3.21", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.21.tgz", + "integrity": "sha512-SRfKmRe1KvYnxjEMtxEr+J4HIeMX5YBg/qhRHpxEIGjhX1rshcHlnFUE9K0GazhVKWM7B+nARSkV8LuvJdJ5/g==", "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" @@ -3153,6 +3154,237 @@ "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz", "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==" }, + "node_modules/@syncfusion/ej2-angular-base": { + "version": "24.1.44", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-angular-base/-/ej2-angular-base-24.1.44.tgz", + "integrity": "sha512-fGXP0E7q2FdmCrqBNt+nL+7U7feA/Sud6d6X8RPoZkWDaqHkDJw58CotwW6UKSLsPEtn5aMz1rdSqap3fSv1vg==", + "hasInstallScript": true, + "dependencies": { + "@syncfusion/ej2-base": "~24.1.42", + "@syncfusion/ej2-icons": "~24.1.41", + "core-js": "^3.4.8", + "reflect-metadata": "^0.1.9", + "rxjs": "^6.5.4", + "rxjs-compat": "^6.5.4", + "zone.js": "^0.10.2" + } + }, + "node_modules/@syncfusion/ej2-angular-base/node_modules/rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "dependencies": { + "tslib": "^1.9.0" + }, + "engines": { + "npm": ">=2.0.0" + } + }, + "node_modules/@syncfusion/ej2-angular-base/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@syncfusion/ej2-angular-base/node_modules/zone.js": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.10.3.tgz", + "integrity": "sha512-LXVLVEq0NNOqK/fLJo3d0kfzd4sxwn2/h67/02pjCjfKDxgx1i9QqpvtHD8CrBnSSwMw5+dy11O7FRX5mkO7Cg==" + }, + "node_modules/@syncfusion/ej2-angular-treegrid": { + "version": "24.1.45", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-angular-treegrid/-/ej2-angular-treegrid-24.1.45.tgz", + "integrity": "sha512-4z7uD4P4ll4E39SgsX+PLqFhCAjonlr+ReYmffpfODXByUYWx0niNIBHHTgu71UFYFCGFSrwTK9R7SCCjBy99w==", + "dependencies": { + "@syncfusion/ej2-angular-base": "~24.1.44", + "@syncfusion/ej2-base": "~24.1.42", + "@syncfusion/ej2-treegrid": "24.1.45", + "tslib": "^2.3.0" + } + }, + "node_modules/@syncfusion/ej2-base": { + "version": "24.1.42", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-base/-/ej2-base-24.1.42.tgz", + "integrity": "sha512-3Zolyu6xA2pasid3Ttaf0qqQcEU/cQMJwuhaGa5vBnt1Xmo4oPkipUAsWLCtlfkmF/iUN9Hts3+8a4fBr4x3dA==", + "dependencies": { + "@syncfusion/ej2-icons": "~24.1.41" + }, + "bin": { + "syncfusion-license": "bin/syncfusion-license.js" + } + }, + "node_modules/@syncfusion/ej2-buttons": { + "version": "24.1.45", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-buttons/-/ej2-buttons-24.1.45.tgz", + "integrity": "sha512-04XMBvEydISzodv+3P7hZvX5lvcIAtYHjjkQ9zdJkK5bJU5g4iUt8WacMCWD+u8c+Ct0u58CV/dqVDit8CScnA==", + "dependencies": { + "@syncfusion/ej2-base": "~24.1.42" + } + }, + "node_modules/@syncfusion/ej2-calendars": { + "version": "24.1.44", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-calendars/-/ej2-calendars-24.1.44.tgz", + "integrity": "sha512-uwnbXbHH7ZsgjNxb7ROI28IH9duTfH+TRd9GX/dJ/+TyGaCoBvoEKBC2lOPYk1wtaNoTbn8KIJrkgyMr7ewNvQ==", + "dependencies": { + "@syncfusion/ej2-base": "~24.1.42", + "@syncfusion/ej2-buttons": "~24.1.41", + "@syncfusion/ej2-inputs": "~24.1.41", + "@syncfusion/ej2-lists": "~24.1.41", + "@syncfusion/ej2-popups": "~24.1.44" + } + }, + "node_modules/@syncfusion/ej2-compression": { + "version": "24.1.41", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-compression/-/ej2-compression-24.1.41.tgz", + "integrity": "sha512-OO3Am1WXMi+6V25QG3iySmikWA2gXWgKh4B9p1L8nksUptrvfdNFJqzNEEdZWoF9ftOMWHcagwklbFATjxEgRw==", + "dependencies": { + "@syncfusion/ej2-file-utils": "~24.1.41" + } + }, + "node_modules/@syncfusion/ej2-data": { + "version": "24.1.41", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-data/-/ej2-data-24.1.41.tgz", + "integrity": "sha512-xKSaV7CaF8K37nIf9SuG6387mqXoNt+k4uqiAI1Xsp9Z+UkpEd8wm1skeW2qJao5AyxVhUhV6MtX9grO8udCjg==", + "dependencies": { + "@syncfusion/ej2-base": "~24.1.41" + } + }, + "node_modules/@syncfusion/ej2-dropdowns": { + "version": "24.1.45", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-dropdowns/-/ej2-dropdowns-24.1.45.tgz", + "integrity": "sha512-7SfwIP8P7YrxFRKdBqb7HUi9cAY/ZhbyN0yR4MM6pkpCqcflqEWEwmNuf+uJuo8g2LXg43lFEC21XMAqhXSTfQ==", + "dependencies": { + "@syncfusion/ej2-base": "~24.1.42", + "@syncfusion/ej2-data": "~24.1.41", + "@syncfusion/ej2-inputs": "~24.1.45", + "@syncfusion/ej2-lists": "~24.1.41", + "@syncfusion/ej2-navigations": "~24.1.41", + "@syncfusion/ej2-notifications": "~24.1.41", + "@syncfusion/ej2-popups": "~24.1.44" + } + }, + "node_modules/@syncfusion/ej2-excel-export": { + "version": "24.1.41", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-excel-export/-/ej2-excel-export-24.1.41.tgz", + "integrity": "sha512-ieLWcOeHc4jIhfcrUA79m0C60g44bbM1O+BhequQB/GK9o7WjhD7TmRUYZSK/4jU1pm9tu+YI8+P18vjDxWIgw==", + "dependencies": { + "@syncfusion/ej2-base": "~24.1.41", + "@syncfusion/ej2-compression": "~24.1.41" + } + }, + "node_modules/@syncfusion/ej2-file-utils": { + "version": "24.1.41", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-file-utils/-/ej2-file-utils-24.1.41.tgz", + "integrity": "sha512-lMCSB9kZrn2qe7UvFq8N2xERCu8sCg+5LRESjlsB4+k+02MLhponHmMzAPbvMr3DJ5ctb7A1dihAdQT0Mwd3Jg==" + }, + "node_modules/@syncfusion/ej2-grids": { + "version": "24.1.45", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-grids/-/ej2-grids-24.1.45.tgz", + "integrity": "sha512-uC62J1oYg83Ans151DOzLfwTb6sFO+at63AQ6cMNMEQrE2QHgMrkXFxp7O1k403tiPIM1PS0Ayz/9So3msKSSw==", + "dependencies": { + "@syncfusion/ej2-base": "~24.1.42", + "@syncfusion/ej2-buttons": "~24.1.45", + "@syncfusion/ej2-calendars": "~24.1.44", + "@syncfusion/ej2-compression": "~24.1.41", + "@syncfusion/ej2-data": "~24.1.41", + "@syncfusion/ej2-dropdowns": "~24.1.45", + "@syncfusion/ej2-excel-export": "~24.1.41", + "@syncfusion/ej2-file-utils": "~24.1.41", + "@syncfusion/ej2-inputs": "~24.1.45", + "@syncfusion/ej2-lists": "~24.1.41", + "@syncfusion/ej2-navigations": "~24.1.41", + "@syncfusion/ej2-notifications": "~24.1.41", + "@syncfusion/ej2-pdf-export": "~24.1.41", + "@syncfusion/ej2-popups": "~24.1.44", + "@syncfusion/ej2-splitbuttons": "~24.1.45" + } + }, + "node_modules/@syncfusion/ej2-icons": { + "version": "24.1.41", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-icons/-/ej2-icons-24.1.41.tgz", + "integrity": "sha512-r44Xr0QC1iGP6Ed5UVNyfIa3lmcDn680nzNoUbykUv02JaJv6nF0OQZeZNjjY3m8YrFhYCHdms0h9A9sU7c9/Q==" + }, + "node_modules/@syncfusion/ej2-inputs": { + "version": "24.1.45", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-inputs/-/ej2-inputs-24.1.45.tgz", + "integrity": "sha512-hRjGLBztCrZKcuGCRn8f42nU77QYcaet4fiv3l2wctBa50GpvKjWpyM+7tIyEpE1fO1+895F6L9T8kZ/mSdwLw==", + "dependencies": { + "@syncfusion/ej2-base": "~24.1.42", + "@syncfusion/ej2-buttons": "~24.1.45", + "@syncfusion/ej2-popups": "~24.1.44", + "@syncfusion/ej2-splitbuttons": "~24.1.45" + } + }, + "node_modules/@syncfusion/ej2-lists": { + "version": "24.1.41", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-lists/-/ej2-lists-24.1.41.tgz", + "integrity": "sha512-TZrHBq02s2vxVwqjLUxx+iTGP8X93eJCkCwlhjajnjw7jU5Yireb//FVORwTzWuwlrVc2tEkDiGW3WYhnowVMg==", + "dependencies": { + "@syncfusion/ej2-base": "~24.1.41", + "@syncfusion/ej2-buttons": "~24.1.41", + "@syncfusion/ej2-data": "~24.1.41", + "@syncfusion/ej2-popups": "~24.1.41" + } + }, + "node_modules/@syncfusion/ej2-navigations": { + "version": "24.1.41", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-navigations/-/ej2-navigations-24.1.41.tgz", + "integrity": "sha512-l551sMOEpXeTSkaWNNEhmkSw5vGYIX8lURuywyUnF7L1QMbfZwhiy2fLYopcRqFOOXFsLchGXzaHBrcfcMtF2g==", + "dependencies": { + "@syncfusion/ej2-base": "~24.1.41", + "@syncfusion/ej2-buttons": "~24.1.41", + "@syncfusion/ej2-data": "~24.1.41", + "@syncfusion/ej2-inputs": "~24.1.41", + "@syncfusion/ej2-lists": "~24.1.41", + "@syncfusion/ej2-popups": "~24.1.41" + } + }, + "node_modules/@syncfusion/ej2-notifications": { + "version": "24.1.41", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-notifications/-/ej2-notifications-24.1.41.tgz", + "integrity": "sha512-equJ8+DrZj2yaGyAxs7GiGWtH14ns74RFj0q2ma/SCGQUNyUARgDiMdF5NlN4btnE3UGoAtKk5ikW8boole8Bw==", + "dependencies": { + "@syncfusion/ej2-base": "~24.1.41", + "@syncfusion/ej2-buttons": "~24.1.41", + "@syncfusion/ej2-popups": "~24.1.41" + } + }, + "node_modules/@syncfusion/ej2-pdf-export": { + "version": "24.1.41", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-pdf-export/-/ej2-pdf-export-24.1.41.tgz", + "integrity": "sha512-AsPl0mHerlNPVEy+qm9CDxneDIAOIMVPxlVTcxhXeOwEugdkPAF9vTzx5jX3hoMLqnpnpxXq/FjyXcz4+fapbw==", + "dependencies": { + "@syncfusion/ej2-compression": "~24.1.41" + } + }, + "node_modules/@syncfusion/ej2-popups": { + "version": "24.1.44", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-popups/-/ej2-popups-24.1.44.tgz", + "integrity": "sha512-yzmtSDRTd0PdTDeAmnEoKV7jbhOX0jVvOnOHJs71BciI2+qWklCLvI2my5kyOuIaxAZabLQk+j5ogRkUXrOygw==", + "dependencies": { + "@syncfusion/ej2-base": "~24.1.42", + "@syncfusion/ej2-buttons": "~24.1.41" + } + }, + "node_modules/@syncfusion/ej2-splitbuttons": { + "version": "24.1.45", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-splitbuttons/-/ej2-splitbuttons-24.1.45.tgz", + "integrity": "sha512-12JJU1eq+stncoFyWtwZmv4gxuUxlD4AVavlzX0KyZFqSFUTQfk8n+l1w9FLp+QVH8cuUh9avTfD7tUhLJyrAw==", + "dependencies": { + "@syncfusion/ej2-base": "~24.1.42", + "@syncfusion/ej2-popups": "~24.1.44" + } + }, + "node_modules/@syncfusion/ej2-treegrid": { + "version": "24.1.45", + "resolved": "https://registry.npmjs.org/@syncfusion/ej2-treegrid/-/ej2-treegrid-24.1.45.tgz", + "integrity": "sha512-sMLqDYy4SCrdYSJbWHIfuo4GMPRaiT/ngxkPXD45E/7Wgh5LW/KsFDvSCcrglYc2clgB1sAAj7afQE+EOshVAQ==", + "dependencies": { + "@syncfusion/ej2-base": "~24.1.42", + "@syncfusion/ej2-data": "~24.1.41", + "@syncfusion/ej2-grids": "~24.1.45", + "@syncfusion/ej2-popups": "~24.1.44" + } + }, "node_modules/@tootallnate/once": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", @@ -3222,9 +3454,9 @@ } }, "node_modules/@types/eslint": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.0.tgz", - "integrity": "sha512-FlsN0p4FhuYRjIxpbdXovvHQhtlG05O1GG/RNWvdAxTboR438IOTwmrY/vLA+Xfgg06BTkP045M3vpFwTMv1dg==", + "version": "8.56.2", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.2.tgz", + "integrity": "sha512-uQDwm1wFHmbBbCZCqAlq6Do9LYwByNZHWzXppSnay9SuwJ+VRbjkbLABer54kcPnMSlG6Fdiy2yaFXm/z9Z5gw==", "dev": true, "dependencies": { "@types/estree": "*", @@ -3313,17 +3545,17 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "version": "20.11.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.0.tgz", + "integrity": "sha512-o9bjXmDNcF7GbM4CNQpmi+TutCgap/K3w1JyKgxAjqx41zp9qlIAVFi0IhCNsJcXolEqLWhbFbEeL0PvYm4pcQ==", "dependencies": { "undici-types": "~5.26.4" } }, "node_modules/@types/node-forge": { - "version": "1.3.10", - "resolved": "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.10.tgz", - "integrity": "sha512-y6PJDYN4xYBxwd22l+OVH35N+1fCYWiuC3aiP2SlXVE6Lo7SS+rSx9r89hLxrP4pn6n1lBGhHJ12pj3F3Mpttw==", + "version": "1.3.11", + "resolved": "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.11.tgz", + "integrity": "sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==", "dev": true, "dependencies": { "@types/node": "*" @@ -3826,6 +4058,11 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, "node_modules/autoprefixer": { "version": "10.4.16", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.16.tgz", @@ -3863,6 +4100,16 @@ "postcss": "^8.1.0" } }, + "node_modules/axios": { + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.5.tgz", + "integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==", + "dependencies": { + "follow-redirects": "^1.15.4", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/babel-loader": { "version": "8.2.5", "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.2.5.tgz", @@ -4063,23 +4310,15 @@ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, "node_modules/bonjour-service": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/bonjour-service/-/bonjour-service-1.1.1.tgz", - "integrity": "sha512-Z/5lQRMOG9k7W+FkeGTNjh7htqn/2LMnfOvBZ8pynNZCM9MwkQkI3zeI4oz09uWdcgmgHugVvBqxGg4VQJ5PCg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/bonjour-service/-/bonjour-service-1.2.1.tgz", + "integrity": "sha512-oSzCS2zV14bh2kji6vNe7vrpJYCHGvcZnlffFQ1MEoX/WOeQ/teD8SYWKR942OI3INjq8OMNJlbPK5LLLUxFDw==", "dev": true, "dependencies": { - "array-flatten": "^2.1.2", - "dns-equal": "^1.0.0", "fast-deep-equal": "^3.1.3", "multicast-dns": "^7.2.5" } }, - "node_modules/bonjour-service/node_modules/array-flatten": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz", - "integrity": "sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==", - "dev": true - }, "node_modules/boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -4276,9 +4515,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001572", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001572.tgz", - "integrity": "sha512-1Pbh5FLmn5y4+QhNyJE9j3/7dK44dGB83/ZMjv/qJk86TvDbjk0LosiZo0i0WB0Vx607qMX9jYrn1VLHCkN4rw==", + "version": "1.0.30001576", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001576.tgz", + "integrity": "sha512-ff5BdakGe2P3SQsMsiqmt1Lc8221NR1VzHj5jXN5vBny9A6fpze94HiVV/n7XRosOlsShJcvMv5mdnpjOGCEgg==", "funding": [ { "type": "opencollective", @@ -4491,6 +4730,17 @@ "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", "dev": true }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -4757,6 +5007,16 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/core-js": { + "version": "3.35.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.35.0.tgz", + "integrity": "sha512-ntakECeqg81KqMueeGJ79Q5ZgQNR+6eaE8sxGCx62zMbAIj65q+uYvatToew3m6eAGdU4gNZwpZ34NMe4GYswg==", + "hasInstallScript": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, "node_modules/core-js-compat": { "version": "3.35.0", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.35.0.tgz", @@ -5127,6 +5387,14 @@ "node": ">=8" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -5182,12 +5450,6 @@ "node": ">=8" } }, - "node_modules/dns-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz", - "integrity": "sha512-z+paD6YUQsk+AbGCEM4PrOXSss5gd66QfcVBFTKR/HpFL9jCqikS94HYwKww6fQyO7IxrIIyUu+g0Ka9tUS2Cg==", - "dev": true - }, "node_modules/dns-packet": { "version": "5.6.1", "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.6.1.tgz", @@ -5281,9 +5543,9 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "node_modules/electron-to-chromium": { - "version": "1.4.616", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.616.tgz", - "integrity": "sha512-1n7zWYh8eS0L9Uy+GskE0lkBUNK83cXTVJI0pU3mGprFsbfSdAc15VTFbo+A+Bq4pwstmL30AVcEU3Fo463lNg==" + "version": "1.4.629", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.629.tgz", + "integrity": "sha512-5UUkr3k3CZ/k+9Sw7vaaIMyOzMC0XbPyprKI3n0tbKDqkzTDOjK4izm7DxlkueRMim6ZZQ1ja9F7hoFVplHihA==" }, "node_modules/emoji-regex": { "version": "8.0.0", @@ -6201,10 +6463,9 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", - "dev": true, + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", "funding": [ { "type": "individual", @@ -6220,6 +6481,19 @@ } } }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -8650,9 +8924,9 @@ } }, "node_modules/node-gyp-build": { - "version": "4.7.1", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.7.1.tgz", - "integrity": "sha512-wTSrZ+8lsRRa3I3H8Xr65dLWSgCvY2l4AOnaeKdPA9TB/WYMPaTcrzf3rXvFoVvjKNVnu0CcWSx54qq9GKRUYg==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.0.tgz", + "integrity": "sha512-u6fs2AEUljNho3EYTJNBfImO5QTo/J/1Etd+NVdCj7qWKUSN/bSLkZwhDv7I+w/MSC6qJ4cknepkAYykDdK8og==", "dev": true, "optional": true, "bin": { @@ -10188,6 +10462,11 @@ "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", @@ -10388,9 +10667,9 @@ } }, "node_modules/regex-parser": { - "version": "2.2.11", - "resolved": "https://registry.npmjs.org/regex-parser/-/regex-parser-2.2.11.tgz", - "integrity": "sha512-jbD/FT0+9MBU2XAZluI7w2OBs1RBi6p9M83nkoZayQXXU9e8Robt69FcZc7wU4eJD/YFTjn1JdCk3rbMJajz8Q==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/regex-parser/-/regex-parser-2.3.0.tgz", + "integrity": "sha512-TVILVSz2jY5D47F4mA4MppkBrafEaiUWJO/TcZHEIuI13AqoZMkK1WMA4Om1YkYbTx+9Ki1/tSUXbceyr9saRg==", "dev": true }, "node_modules/regexpu-core": { @@ -10654,6 +10933,11 @@ "tslib": "^2.1.0" } }, + "node_modules/rxjs-compat": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.6.7.tgz", + "integrity": "sha512-szN4fK+TqBPOFBcBcsR0g2cmTTUF/vaFEOZNuSdfU8/pGFnNmmn2u8SystYXG1QMrjOPBc6XTKHMVfENDf6hHw==" + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -10891,9 +11175,9 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "node_modules/serialize-javascript": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.1.tgz", - "integrity": "sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", "dev": true, "dependencies": { "randombytes": "^2.1.0" @@ -11091,9 +11375,9 @@ } }, "node_modules/socket.io": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.7.2.tgz", - "integrity": "sha512-bvKVS29/I5fl2FGLNHuXlQaUH/BlzX1IN6S+NKLNZpBsPZIDH+90eQmCs2Railn4YUiww4SzUedJ6+uzwFnKLw==", + "version": "4.7.4", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.7.4.tgz", + "integrity": "sha512-DcotgfP1Zg9iP/dH9zvAQcWrE0TtbMVwXmlV4T4mqsvY+gw+LqUGPfx2AoVyRk0FLME+GQhufDMyacFmw7ksqw==", "dependencies": { "accepts": "~1.3.4", "base64id": "~2.0.0", @@ -11116,9 +11400,9 @@ } }, "node_modules/socket.io-client": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.7.2.tgz", - "integrity": "sha512-vtA0uD4ibrYD793SOIAwlo8cj6haOeMHrGvwPxJsxH7CeIksqJ+3Zc06RvWTIFgiSqx4A3sOnTXpfAEE2Zyz6w==", + "version": "4.7.4", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.7.4.tgz", + "integrity": "sha512-wh+OkeF0rAVCrABWQBaEjLfb7DVPotMbu0cgWgyR0v6eA4EoVnAwcIeIbcdTE3GT/H3kbdLl7OoH2+asoDRIIg==", "dependencies": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.3.2", diff --git a/Front End/poam-app/package.json b/Front End/poam-app/package.json index b22000b0..90412488 100644 --- a/Front End/poam-app/package.json +++ b/Front End/poam-app/package.json @@ -26,6 +26,8 @@ "@nebular/theme": "^10.0.0", "@ng-bootstrap/ng-bootstrap": "^13.0.0", "@popperjs/core": "^2.10.2", + "@syncfusion/ej2-angular-treegrid": "^24.1.45", + "axios": "^1.6.5", "bootstrap": "^5.2.0", "chart.js": "^2.9.4", "eva-icons": "^1.1.3", diff --git a/Front End/poam-app/src/app/Shared/shared.service.ts b/Front End/poam-app/src/app/Shared/shared.service.ts new file mode 100644 index 00000000..d022b072 --- /dev/null +++ b/Front End/poam-app/src/app/Shared/shared.service.ts @@ -0,0 +1,60 @@ +import { Injectable } from '@angular/core'; +import axios from 'axios'; +import { from, Observable } from 'rxjs'; +import { environment } from '../../environments/environment'; + +@Injectable({ providedIn: 'root' }) +export class SharedService { + + constructor() { } + + private getHeaders(token: string) { + return { + 'accept': 'application/json', + 'Authorization': `Bearer ${token}` + }; + } + + getCollectionsFromSTIGMAN(token: string): Observable { + const headers = this.getHeaders(token); + return from(axios.get(environment.getCollectionsFromSTIGMANEndpoint, { headers }) + .then(response => response.data) + .catch(error => { + console.error('There was an error!', error); + throw error; + })); + } + + selectedCollectionFromSTIGMAN(collectionId: string, token: string): Observable { + const headers = this.getHeaders(token); + const endpoint = environment.getCollectionsFromSTIGMANEndpoint + collectionId; + return from(axios.get(endpoint, { headers }) + .then(response => response.data) + .catch(error => { + console.error('There was an error!', error); + throw error; + })); + } + + getAssetsFromSTIGMAN(collectionId: string, token: string): Observable { + const headers = this.getHeaders(token); + const endpoint = environment.getAvailableAssetsFromSTIGMANEndpoint + collectionId; + return from(axios.get(endpoint, { headers }) + .then(response => response.data) + .catch(error => { + console.error('There was an error!', error); + throw error; + })); + } + + selectedAssetsFromSTIGMAN(assetId: string, token: string): Observable { + const headers = this.getHeaders(token); + const endpoint = environment.getAssetsFromSTIGMANEndpoint + assetId; + return from(axios.get(endpoint, { headers }) + .then(response => response.data) + .catch(error => { + console.error('There was an error!', error); + throw error; + })); + } +} diff --git a/Front End/poam-app/src/app/app.module.ts b/Front End/poam-app/src/app/app.module.ts index 0f21370f..f598a2f9 100644 --- a/Front End/poam-app/src/app/app.module.ts +++ b/Front End/poam-app/src/app/app.module.ts @@ -7,7 +7,7 @@ ! CONDITIONS OF THE LICENSE. !######################################################################## */ - +import { TreeGridModule } from '@syncfusion/ej2-angular-treegrid'; import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_BASE_HREF } from "@angular/common"; import { BrowserModule } from '@angular/platform-browser'; @@ -40,17 +40,12 @@ function initializeKeycloak(keycloak: KeycloakService) { return () => keycloak.init({ config: { - //url: environment.authizeEndpoint, - url: 'http://localhost:8080/', - //url: 'http://localhost:8080/realms/C-PAT/protocol/openid-connect/auth' - realm: 'C-PAT', + url: environment.keycloakUrl, + realm: 'RMFTools', clientId: 'c-pat' }, initOptions: { - //onLoad: 'check-sso', - //silentCheckSsoRedirectUri: window.location.origin + '/assets/verificar-sso-html', - // redirectUri: 'http://localhost:4200/poam-processing', - redirectUri: 'http://localhost:4200/consent', + redirectUri: environment.CPATRedirectUri, checkLoginIframe: false } }) @@ -78,7 +73,8 @@ function initializeKeycloak(keycloak: KeycloakService) { exports: [ // PoamDetailsComponent, ], - imports: [ + imports: [ + TreeGridModule, AppRoutingModule, SharedModule, BrowserModule, diff --git a/Front End/poam-app/src/app/auth/reset-password/reset-password.service.ts b/Front End/poam-app/src/app/auth/reset-password/reset-password.service.ts index d2a047d5..7c7c81cb 100644 --- a/Front End/poam-app/src/app/auth/reset-password/reset-password.service.ts +++ b/Front End/poam-app/src/app/auth/reset-password/reset-password.service.ts @@ -20,7 +20,7 @@ import { catchError } from 'rxjs/operators'; }) export class ResetPasswordService { //private uri = environment.apiEndpoint; - private uri = `http://localhost:8080`; + private uri = environment.keycloakUrl; constructor(private http: HttpClient) { } diff --git a/Front End/poam-app/src/app/pages/asset-processing/asset-processing.component.html b/Front End/poam-app/src/app/pages/asset-processing/asset-processing.component.html index c3c5041e..24405e98 100644 --- a/Front End/poam-app/src/app/pages/asset-processing/asset-processing.component.html +++ b/Front End/poam-app/src/app/pages/asset-processing/asset-processing.component.html @@ -1,23 +1,10 @@ - - -
-
-
+
+
+
+ - +

Assets

- @@ -25,12 +12,9 @@

Assets

@@ -39,7 +23,6 @@

Assets

{{customColumn}} - - {{row.data[customColumn]}} - {{row.data[column] || '-'}}
-
@@ -47,36 +30,67 @@

Assets

+ + Modify or Add Assets - -
- -
- +
+ {{ asset.assetName }} - {{ asset.description }} - {{ asset.ipAddress }}
-
- +
+
+ + + +
+
-
+
+
+ + + Import Assets + +
+ + + {{ collection.name }} + + +
- +
+ + + {{ asset.name }} + +
+
+ +
+ +

+ Collections processing requires may role of admin. +

+

+
+ Delete Row @@ -87,10 +101,3 @@

Assets

- - -

- Collections processing requires may role of admin. -

-

-
diff --git a/Front End/poam-app/src/app/pages/asset-processing/asset-processing.component.scss b/Front End/poam-app/src/app/pages/asset-processing/asset-processing.component.scss index 3131c015..3c096fcd 100644 --- a/Front End/poam-app/src/app/pages/asset-processing/asset-processing.component.scss +++ b/Front End/poam-app/src/app/pages/asset-processing/asset-processing.component.scss @@ -1,72 +1,64 @@ -/* -!####################################################################### -! C-PATTM SOFTWARE -! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file -! crane_C_PAT.1_license.txt, which is part of this software package. BY -! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND -! CONDITIONS OF THE LICENSE. -!######################################################################## -*/ +/* General Styles */ +.add-asset-button { + margin-top: 20px; +} +.scrollable-assets { + max-height: 60vh; + overflow-y: auto; +} -button[nbTreeGridRowToggle] { - background: transparent; - border: none; - padding: 0; +.search-input { + margin-bottom: 1rem; +} + +.nb-column-name { + width: 100%; +} + +/* Import Section Styles */ +.import-section { + display: flex; + align-items: center; + justify-content: flex-start; + + .import-item { + margin-right: 10%; + + &:last-child { + margin-right: 0; + } } - - .search-label { - display: block; +} + +/* Media Queries */ +@media screen and (min-width: 400px) { + .nb-column-name, .nb-column-size { + width: 50%; } - .search-input { - margin-bottom: 1rem; +} + +@media screen and (min-width: 500px) { + .nb-column-name, .nb-column-size, .nb-column-kind { + width: 33.333%; } - +} + +@media screen and (min-width: 600px) { .nb-column-name { - width: 100%; - } - - @media screen and (min-width: 400px) { - .nb-column-name, - .nb-column-size { - width: 50%; - } + width: 31%; } - - @media screen and (min-width: 500px) { - .nb-column-name, - .nb-column-size, - .nb-column-kind { - width: 33.333%; - } - } - - @media screen and (min-width: 600px) { - .nb-column-name { - width: 31%; - } - .nb-column-size, - .nb-column-kind, - .nb-column-items { - width: 23%; - } + + .nb-column-size, .nb-column-kind, .nb-column-items { + width: 23%; } - -::ng-deep { +} +::ng-deep { body { - min-height: 20rem; - } - - - .nb-tree-grid-header-cell, - - .nb-tree-grid-header-cell button { - + .nb-tree-grid-header-cell, .nb-tree-grid-header-cell button { text-transform: capitalize; - } - } diff --git a/Front End/poam-app/src/app/pages/asset-processing/asset-processing.component.ts b/Front End/poam-app/src/app/pages/asset-processing/asset-processing.component.ts index a3f7f4ae..9fc8913b 100644 --- a/Front End/poam-app/src/app/pages/asset-processing/asset-processing.component.ts +++ b/Front End/poam-app/src/app/pages/asset-processing/asset-processing.component.ts @@ -8,10 +8,12 @@ !######################################################################## */ -import { Component, OnInit } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Component, HostListener, Input, OnInit } from '@angular/core'; +import { SharedService } from '../../Shared/shared.service'; import { AssetService } from './assets.service'; import { forkJoin, Observable } from 'rxjs'; -import { NbDialogService, NbTreeGridDataSource, NbTreeGridDataSourceBuilder } from '@nebular/theme'; +import { NbDialogService, NbInputModule, NbSortDirection, NbSortRequest, NbTreeGridDataSource, NbTreeGridDataSourceBuilder } from '@nebular/theme'; import { Router } from '@angular/router'; import { AuthService } from '../../auth'; import { NbAuthJWTToken, NbAuthToken } from '@nebular/auth'; @@ -19,7 +21,8 @@ import { SubSink } from "subsink"; import { ConfirmationDialogComponent, ConfirmationDialogOptions } from '../../Shared/components/confirmation-dialog/confirmation-dialog.component' import { KeycloakService } from 'keycloak-angular'; import { KeycloakProfile } from 'keycloak-js'; -import { UsersService } from '../user-processing/users.service' +import { UsersService } from '../user-processing/users.service'; +import { environment } from '../../../environments/environment'; interface TreeNode { data: T; @@ -48,6 +51,8 @@ export class AssetProcessingComponent implements OnInit { defaultColumns = ['Asset Name', 'Description', 'Collection', 'IP Address', 'Domain', 'MAC Address', 'Labels']; allColumns = [this.customColumn, ...this.defaultColumns]; dataSource!: NbTreeGridDataSource; + sortColumn: string | undefined; + sortDirection: NbSortDirection = NbSortDirection.NONE; public isLoggedIn = false; public userProfile: KeycloakProfile | null = null; @@ -55,6 +60,10 @@ export class AssetProcessingComponent implements OnInit { users: any; user: any; + availableAssets: any[] = []; + selectedAssets: string[] = []; + collections: any[] = []; // Array to hold collections + selectedCollection: string = ''; // Selected collection ID assets: any; asset: any = {}; data: any = []; @@ -78,7 +87,9 @@ export class AssetProcessingComponent implements OnInit { constructor( private assetService: AssetService, + private sharedService: SharedService, private dialogService: NbDialogService, + private http: HttpClient, private router: Router, private authService: AuthService, private readonly keycloak: KeycloakService, @@ -92,26 +103,72 @@ export class AssetProcessingComponent implements OnInit { } async ngOnInit() { - // this.subs.sink = this.authService.onTokenChange() - // .subscribe((token: NbAuthJWTToken) => { - // //if (token.isValid() && this.router.url === '/pages/collection-processing') { - // if (token.isValid()) { - // this.isLoading = true; - // this.payload = token.getPayload(); - - // this.selectedRole = 'admin'; - // this.data = []; - // this.getAssetData(); - - // } - // }) this.isLoggedIn = await this.keycloak.isLoggedIn(); if (this.isLoggedIn) { this.userProfile = await this.keycloak.loadUserProfile(); - //console.log("userProfile.email: ", this.userProfile.email, ", userProfile.username: ", this.userProfile.username) + this.fetchCollections(); this.setPayload(); + this.getAssetData(); } + } + fetchCollections() { + this.keycloak.getToken().then(token => { + this.sharedService.getCollectionsFromSTIGMAN(token).subscribe(data => { + this.collections = data; + }); + }); + } + + fetchAssetsFromAPI() { + this.keycloak.getToken().then(token => { + this.sharedService.getAssetsFromSTIGMAN(this.selectedCollection, token).subscribe(data => { + this.availableAssets = data; + }); + }); + } + + onCollectionSelect(collectionId: string) { + this.selectedCollection = collectionId; + this.fetchAssetsFromAPI(); + } + + fetchAssetDetails() { + this.keycloak.getToken().then(token => { + const assetDetailsObservables = this.selectedAssets.map(assetId => + this.sharedService.selectedAssetsFromSTIGMAN(assetId, token) + ); + forkJoin(assetDetailsObservables).subscribe(results => { + this.importAssets(results); + }); + }); + } + + onImportAssetsButtonClick() { + if (this.selectedAssets.length > 0) { + this.fetchAssetDetails(); + } else { + console.error('No assets selected'); + } + } + + + importAssets(assetDetails: any[]) { + const payload = { + assets: assetDetails + }; + this.sendImportRequest(payload); + } + + private sendImportRequest(data: any) { + this.keycloak.getToken().then(token => { + const headers = { Authorization: `Bearer ${token}` }; + this.http.post(environment.stigmanAssetImportEndpoint, data, { headers }) + .subscribe({ + next: (response) => console.log('Import successful', response), + error: (error) => console.error('Error during import', error) + }); + }); } setPayload() { @@ -134,7 +191,6 @@ export class AssetProcessingComponent implements OnInit { this.subs.sink = forkJoin( this.userService.getUserPermissions(this.user.userId) ).subscribe(([permissions]: any) => { - // console.log("permissions: ", permissions) permissions.permissions.permissions.forEach((element: any) => { // console.log("element: ",element) @@ -147,29 +203,16 @@ export class AssetProcessingComponent implements OnInit { // console.log("assignedCollections: ", assigendCollections) this.payload.collections.push(assigendCollections); }); - - // console.log("payload: ", this.payload) - this.getAssetData(); }) - - }) } getAssetData() { this.isLoading = true; this.assets = []; - // this.assetService.getAssets().subscribe((rData: any) => { - // this.data = rData.assets; - // this.assets = this.data; - // console.log("this.assets: ",this.data) - // this.getAssetsGrid(""); - // this.isLoading = false; - // }); - // console.log("payload: ", this.payload) + if (this.payload == undefined) return; - //console.log("HIGH within user.getData() user: ", this.user) let userName = (this.payload.userName) ? this.payload.userName : "NONE"; this.subs.sink = forkJoin( @@ -178,15 +221,10 @@ export class AssetProcessingComponent implements OnInit { this.assetService.getCollections(userName), ) .subscribe(([assetData, labels, collections]: any) => { - - this.data = assetData.assets; this.assets = this.data; this.labelList = labels.labels; this.collectionList = collections.collections; - //console.log("labelList: ", this.labelList) - // console.log("collectionList: ", this.collectionList) - this.getAssetsGrid(""); this.isLoading = false; }); @@ -230,16 +268,21 @@ export class AssetProcessingComponent implements OnInit { 'Domain': assetData[i].fullyQualifiedDomainName, 'MAC Address': assetData[i].macAddress }, children: myChild }); - - // console.log("treeViewData: ", mydata) this.dataSource = this.dataSourceBuilder.create(mydata); - }); - } - //if (filter) { collectionData = this.data.filter((collection: { collectionId: string; }) => collection.collectionId === filter); } + } + updateSort(sortRequest: NbSortRequest): void { + this.sortColumn = sortRequest.column; + this.sortDirection = sortRequest.direction; + } + getSortDirection(column: string): NbSortDirection { + if (this.sortColumn === column) { + return this.sortDirection; + } + return NbSortDirection.NONE; } setAsset(assetId: any) { diff --git a/Front End/poam-app/src/app/pages/asset-processing/asset-processing.module.ts b/Front End/poam-app/src/app/pages/asset-processing/asset-processing.module.ts index d3848efd..d60d0b3c 100644 --- a/Front End/poam-app/src/app/pages/asset-processing/asset-processing.module.ts +++ b/Front End/poam-app/src/app/pages/asset-processing/asset-processing.module.ts @@ -16,7 +16,7 @@ import { AssetProcessingRoutingModule } from './asset-processing.routing'; import { SharedModule } from '../../Shared/shared.module'; import { AssetComponent } from './asset/asset.component'; import { ConfirmationDialogComponent } from 'src/app/Shared/components/confirmation-dialog/confirmation-dialog.component'; -import { NbButtonModule, NbCardModule,NbLayoutModule, NbTreeGridModule, NbSpinnerModule, NbSelectModule, NbIconModule } from '@nebular/theme'; +import { NbButtonModule, NbInputModule, NbCardModule,NbLayoutModule, NbTreeGridModule, NbSpinnerModule, NbSelectModule, NbIconModule } from '@nebular/theme'; import { Ng2SmartTableModule } from 'ng2-smart-table'; @NgModule({ @@ -30,6 +30,7 @@ import { Ng2SmartTableModule } from 'ng2-smart-table'; FormsModule, NbButtonModule, NbCardModule, + NbInputModule, NbIconModule, NbLayoutModule, NbSelectModule, diff --git a/Front End/poam-app/src/app/pages/asset-processing/assets.service.ts b/Front End/poam-app/src/app/pages/asset-processing/assets.service.ts index 7cf9d802..8915cc12 100644 --- a/Front End/poam-app/src/app/pages/asset-processing/assets.service.ts +++ b/Front End/poam-app/src/app/pages/asset-processing/assets.service.ts @@ -10,7 +10,7 @@ import { Injectable } from '@angular/core'; import { HttpClient, HttpParams, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; -import { Observable, throwError } from 'rxjs'; +import { throwError } from 'rxjs'; import { catchError } from 'rxjs/operators'; import { environment } from '../../../environments/environment'; import { Assets } from './asset.model'; @@ -44,8 +44,8 @@ export class AssetService { getAssets() { // console.log("Assets Service Call attempted: getAssets()..."); return this.http - .get(`${this.uri}/assets`) - .pipe(catchError(this.handleError)); + .get(`${this.uri}/assets`) + .pipe(catchError(this.handleError)); } getLabels() { diff --git a/Front End/poam-app/src/app/pages/collection-processing/collection-processing.component.html b/Front End/poam-app/src/app/pages/collection-processing/collection-processing.component.html index 47673b9c..3e85d9b3 100644 --- a/Front End/poam-app/src/app/pages/collection-processing/collection-processing.component.html +++ b/Front End/poam-app/src/app/pages/collection-processing/collection-processing.component.html @@ -13,7 +13,7 @@
- +

Current Collection Structure

@@ -61,19 +61,19 @@

Current Collection Structure

- +
+ payload="payload" [poams]="poams" (collectionchange)="resetSTIGMANData();">
+ payload="payload" [poams]="poams" (collectionchange)="resetSTIGMANData();">
@@ -84,6 +84,28 @@

Current Collection Structure

+
+
+ + Import Collection + + +
+
+ + + {{ collection.name }} + + +
+
+ +
+
+
+
+
+
diff --git a/Front End/poam-app/src/app/pages/collection-processing/collection-processing.component.scss b/Front End/poam-app/src/app/pages/collection-processing/collection-processing.component.scss index 3131c015..cc5b5aff 100644 --- a/Front End/poam-app/src/app/pages/collection-processing/collection-processing.component.scss +++ b/Front End/poam-app/src/app/pages/collection-processing/collection-processing.component.scss @@ -13,6 +13,10 @@ button[nbTreeGridRowToggle] { border: none; padding: 0; } +.scrollable-collections { + max-height: 60vh; + overflow-y: auto; +} .search-label { display: block; diff --git a/Front End/poam-app/src/app/pages/collection-processing/collection-processing.component.ts b/Front End/poam-app/src/app/pages/collection-processing/collection-processing.component.ts index a8088770..02451495 100644 --- a/Front End/poam-app/src/app/pages/collection-processing/collection-processing.component.ts +++ b/Front End/poam-app/src/app/pages/collection-processing/collection-processing.component.ts @@ -9,6 +9,8 @@ */ import { Component, OnInit } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { SharedService } from '../../Shared/shared.service'; import { CollectionsService } from './collections.service'; import { forkJoin, Observable } from 'rxjs'; import { NbDialogService, NbTreeGridDataSource, NbTreeGridDataSourceBuilder } from '@nebular/theme'; @@ -19,6 +21,7 @@ import { ConfirmationDialogComponent, ConfirmationDialogOptions } from '../../Sh import { KeycloakService } from 'keycloak-angular'; import { KeycloakProfile } from 'keycloak-js'; import { UsersService } from '../user-processing/users.service' +import { environment } from '../../../environments/environment'; interface TreeNode { data: T; @@ -53,6 +56,10 @@ export class CollectionProcessingComponent implements OnInit { users: any; user: any; + availableAssets: any[] = []; + stigmanCollections: any; + stigmanCollection: any = {}; + selectedStigmanCollection: string = ""; collections: any; collection: any = {}; @@ -76,6 +83,8 @@ export class CollectionProcessingComponent implements OnInit { private subs = new SubSink() constructor( + private http: HttpClient, + private sharedService: SharedService, private collectionService: CollectionsService, private dialogService: NbDialogService, private readonly keycloak: KeycloakService, @@ -89,6 +98,7 @@ export class CollectionProcessingComponent implements OnInit { } async ngOnInit() { + this.fetchCollections(); this.isLoggedIn = await this.keycloak.isLoggedIn(); if (this.isLoggedIn) { this.userProfile = await this.keycloak.loadUserProfile(); @@ -97,6 +107,57 @@ export class CollectionProcessingComponent implements OnInit { } } + fetchCollections() { + this.keycloak.getToken().then(token => { + this.sharedService.getCollectionsFromSTIGMAN(token).subscribe(data => { + this.stigmanCollections = data; + }); + }); + } + + onStigmanCollectionSelect(collectionId: string) { + this.selectedStigmanCollection = collectionId; + } + + importCollection() { + if (this.selectedStigmanCollection) { + this.keycloak.getToken().then(token => { + forkJoin({ + collectionData: this.sharedService.selectedCollectionFromSTIGMAN(this.selectedStigmanCollection, token), + assetsData: this.sharedService.getAssetsFromSTIGMAN(this.selectedStigmanCollection, token) + }).subscribe({ + next: (results) => { + const payload = { + collection: results.collectionData, + assets: results.assetsData + }; + this.sendImportRequest(payload); + }, + error: (error) => { + console.error('Error fetching collection or assets data:', error); + } + }); + }); + } else { + console.error('No collection selected'); + } + } + + private sendImportRequest(data: any) { + this.keycloak.getToken().then(token => { + const headers = { Authorization: `Bearer ${token}` }; + this.http.post(environment.stigmanCollectionImportEndpoint, data, { headers }) + .subscribe({ + next: (response) => console.log('Import successful', response), + error: (error) => console.error('Error during import', error) + }); + }); + } + + resetSTIGMANData() { + this.stigmanCollection = []; + } + setPayload() { this.users = [] this.user = null; diff --git a/Front End/poam-app/src/app/pages/collection-processing/collection/collection.component.html b/Front End/poam-app/src/app/pages/collection-processing/collection/collection.component.html index 3da1ecdf..1ecfeb57 100644 --- a/Front End/poam-app/src/app/pages/collection-processing/collection/collection.component.html +++ b/Front End/poam-app/src/app/pages/collection-processing/collection/collection.component.html @@ -16,7 +16,7 @@ - +
@@ -59,8 +59,8 @@
- - + +
diff --git a/Front End/poam-app/src/app/pages/label-processing/label-processing.component.html b/Front End/poam-app/src/app/pages/label-processing/label-processing.component.html index 635f9df1..394d8626 100644 --- a/Front End/poam-app/src/app/pages/label-processing/label-processing.component.html +++ b/Front End/poam-app/src/app/pages/label-processing/label-processing.component.html @@ -62,7 +62,7 @@

Labels

- +
diff --git a/Front End/poam-app/src/app/pages/label-processing/label-processing.component.spec.ts b/Front End/poam-app/src/app/pages/label-processing/label-processing.component.spec.ts index 75b90eb4..80c0a914 100644 --- a/Front End/poam-app/src/app/pages/label-processing/label-processing.component.spec.ts +++ b/Front End/poam-app/src/app/pages/label-processing/label-processing.component.spec.ts @@ -10,7 +10,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { CollectionProcessingComponent } from './collection-processing.component'; +import { CollectionProcessingComponent } from '../collection-processing/collection-processing.component'; describe('BilletTaskProcessComponent', () => { let component: CollectionProcessingComponent; diff --git a/Front End/poam-app/src/app/pages/label-processing/label/label.component.spec.ts b/Front End/poam-app/src/app/pages/label-processing/label/label.component.spec.ts index 518cff8e..f9a0dfc6 100644 --- a/Front End/poam-app/src/app/pages/label-processing/label/label.component.spec.ts +++ b/Front End/poam-app/src/app/pages/label-processing/label/label.component.spec.ts @@ -10,7 +10,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { CollectionComponent } from './collection.component'; +import { CollectionComponent } from '../../collection-processing/collection/collection.component'; describe('CollectionComponent', () => { let component: CollectionComponent; diff --git a/Front End/poam-app/src/app/pages/login/login.service.ts b/Front End/poam-app/src/app/pages/login/login.service.ts index abbacfc3..dafa8704 100644 --- a/Front End/poam-app/src/app/pages/login/login.service.ts +++ b/Front End/poam-app/src/app/pages/login/login.service.ts @@ -52,7 +52,7 @@ export class LoginService { getToken(authorization: any) { console.log("LoginService Call attempted: getToken(authorization)...authorization: ", authorization); //this.httpOptions.headers= this.httpOptions.headers.append('Access-Control-Allow-Origin', '*') - return this.http.post(`http://localhost:8080/realms/C-PAT/protocol/openid-connect/token`, authorization, this.httpOptions); + return this.http.post(environment.tokenReturnUrl, authorization, this.httpOptions); //return 'Nothing'; } diff --git a/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.html b/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.html index 25442f1a..975f862f 100644 --- a/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.html +++ b/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.html @@ -113,11 +113,11 @@
- + - - + +
@@ -128,8 +128,8 @@

- - + + @@ -139,69 +139,65 @@

- - + +

- - + +

- - + +

- - + +

- - + +

- - + +

- - + +
- - - - - - + + + + diff --git a/Front End/poam-app/src/app/pages/poam-processing/poams.component.html b/Front End/poam-app/src/app/pages/poam-processing/poams.component.html index e3f9b982..98c59f9a 100644 --- a/Front End/poam-app/src/app/pages/poam-processing/poams.component.html +++ b/Front End/poam-app/src/app/pages/poam-processing/poams.component.html @@ -14,7 +14,7 @@ (selectedChange)="onSelectedChange($event)"> -
+
Selected Collection:
@@ -22,13 +22,9 @@

-
- + +

-
- - - All - Draft - Approved - Submitted - Rejected - Closed - Expired - -
+
- + + diff --git a/Front End/poam-app/src/app/pages/user-processing/user-processing.component.html b/Front End/poam-app/src/app/pages/user-processing/user-processing.component.html index d87cbc2d..043d3f4d 100644 --- a/Front End/poam-app/src/app/pages/user-processing/user-processing.component.html +++ b/Front End/poam-app/src/app/pages/user-processing/user-processing.component.html @@ -15,7 +15,7 @@ nbSpinnerSize="medium" nbSpinnerMessage="Loading data, please wait..."> - +

Users

diff --git a/Front End/poam-app/src/app/pages/user-processing/user-processing.component.scss b/Front End/poam-app/src/app/pages/user-processing/user-processing.component.scss index 3131c015..db023bcc 100644 --- a/Front End/poam-app/src/app/pages/user-processing/user-processing.component.scss +++ b/Front End/poam-app/src/app/pages/user-processing/user-processing.component.scss @@ -13,6 +13,10 @@ button[nbTreeGridRowToggle] { border: none; padding: 0; } +.scrollable-users { + max-height: 60vh; + overflow-y: auto; +} .search-label { display: block; diff --git a/Front End/poam-app/src/environments/environment.local.ts b/Front End/poam-app/src/environments/environment.local.ts index 0fc25883..789c52e5 100644 --- a/Front End/poam-app/src/environments/environment.local.ts +++ b/Front End/poam-app/src/environments/environment.local.ts @@ -11,19 +11,25 @@ //import { version } from '/package.json'; export const environment = { - production: false, + production: false, environment: 'local', apiEndpoint: 'http://localhost:8086', - authizeEndpoint: 'http://localhost:8080/realms/C-PAT/protocol/openid-connect/auth', - tokeEndpoint: 'http://localhost:8080/realms/C-PAT/protocol/openid-connect/token', - frontEndEndpoint: 'http://localhost:4200', + fileUploadEndpoint: 'http://localhost:8086/api/poamimport', + stigmanCollectionImportEndpoint: 'http://localhost:8086/api/stigmancollectionimport', + stigmanAssetImportEndpoint: 'http://localhost:8086/api/stigmanassetimport', + getCollectionsFromSTIGMANEndpoint: 'http://localhost:54000/api/collections/', + getAvailableAssetsFromSTIGMANEndpoint: 'http://localhost:54000/api/assets?collectionId=', + getAssetsFromSTIGMANEndpoint: 'http://localhost:54000/api/assets/', + authizeEndpoint: 'http://localhost:8080/realms/RMFTools/protocol/openid-connect/auth', + tokeEndpoint: 'http://localhost:8080/realms/RMFTools/protocol/openid-connect/token', redirectUri: 'http://localhost:4200/callback', - // wsEndpoint: 'http://localhost:3000/notifications', - // apiEndpoint: process && `http://${process.env.API_URL}:3000/api` || 'http://localhost:3000/api', - // wsEndpoint: process && `http://${process.env.API_URL}:3000/notifications` || 'http://localhost:3000/notifications', - // publicVapid: 'BEsUpX1fLAmUM6rtiYgdY9zJrr3oJo8eJzSi6nkA1qxvTR2xeMeImyXsrx-QcoFRediJ_-dnWrF7v9QXp_Ux8UU', + frontEndEndpoint: 'http://localhost:4200', + keycloakUrl: 'http://localhost:8080', + CPATRedirectUri: 'http://localhost:4200/consent', + tokenReturnUrl: "http://localhost:8080/realms/RMFTools/protocol/openid-connect/token", version: '1.0.0', - // + + // Set classification to on of: // classification classificationCode ClassificatonColorCode // 'UNCLASSIFIED' 'U ' '#5cb85c' @@ -34,4 +40,5 @@ export const environment = { classification: 'UNCLASSIFIED', classificationCode: 'U', classificationColorCode: '#5cb85c' + }; diff --git a/Front End/poam-app/src/environments/environment.prod.ts b/Front End/poam-app/src/environments/environment.prod.ts index 72b41f8f..780eff4a 100644 --- a/Front End/poam-app/src/environments/environment.prod.ts +++ b/Front End/poam-app/src/environments/environment.prod.ts @@ -9,27 +9,34 @@ */ export const environment = { - production: true, - environment: 'local', - apiEndpoint: 'http://localhost:8086', - authizeEndpoint: 'http://localhost:8080/realms/C-PAT/protocol/openid-connect/auth', - tokeEndpoint: 'http://localhost:8080/realms/C-PAT/protocol/openid-connect/token', - frontEndEndpoint: 'http://localhost:4200', - redirectUri: 'http://localhost:4200/callback', - // wsEndpoint: 'http://localhost:3000/notifications', - // apiEndpoint: process && `http://${process.env.API_URL}:3000/api` || 'http://localhost:3000/api', - // wsEndpoint: process && `http://${process.env.API_URL}:3000/notifications` || 'http://localhost:3000/notifications', - // publicVapid: 'BEsUpX1fLAmUM6rtiYgdY9zJrr3oJo8eJzSi6nkA1qxvTR2xeMeImyXsrx-QcoFRediJ_-dnWrF7v9QXp_Ux8UU', - version: '1.0.0', - // - // Set classification to on of: - // classification classificationCode ClassificatonColorCode - // 'UNCLASSIFIED' 'U ' '#5cb85c' - // 'CONFIDENTIAL' 'C' '#286090' - // 'SECRET' 'S' '#d9534f' - // 'TOP SECRET' 'T' '#f0ad4e' - // - classification: 'UNCLASSIFIED', - classificationCode: 'U', - classificationColorCode: '#5cb85c' + production: false, + environment: 'local', + apiEndpoint: 'http://localhost:8086', + fileUploadEndpoint: 'http://localhost:8086/api/poamimport', + stigmanCollectionImportEndpoint: 'http://localhost:8086/api/stigmancollectionimport', + stigmanAssetImportEndpoint: 'http://localhost:8086/api/stigmanassetimport', + getCollectionsFromSTIGMANEndpoint: 'http://localhost:54000/api/collections/', + getAvailableAssetsFromSTIGMANEndpoint: 'http://localhost:54000/api/assets?collectionId=', + getAssetsFromSTIGMANEndpoint: 'http://localhost:54000/api/assets/', + authizeEndpoint: 'http://localhost:8080/realms/RMFTools/protocol/openid-connect/auth', + tokeEndpoint: 'http://localhost:8080/realms/RMFTools/protocol/openid-connect/token', + redirectUri: 'http://localhost:4200/callback', + frontEndEndpoint: 'http://localhost:4200', + keycloakUrl: 'http://localhost:8080', + CPATRedirectUri: 'http://localhost:4200/consent', + tokenReturnUrl: "http://localhost:8080/realms/RMFTools/protocol/openid-connect/token", + version: '1.0.0', + + + // Set classification to on of: + // classification classificationCode ClassificatonColorCode + // 'UNCLASSIFIED' 'U ' '#5cb85c' + // 'CONFIDENTIAL' 'C' '#286090' + // 'SECRET' 'S' '#d9534f' + // 'TOP SECRET' 'T' '#f0ad4e' + // + classification: 'UNCLASSIFIED', + classificationCode: 'U', + classificationColorCode: '#5cb85c' + }; diff --git a/Front End/poam-app/src/environments/environment.ts b/Front End/poam-app/src/environments/environment.ts index f41232ae..2e3703a1 100644 --- a/Front End/poam-app/src/environments/environment.ts +++ b/Front End/poam-app/src/environments/environment.ts @@ -18,17 +18,22 @@ export const environment = { production: false, environment: 'local', apiEndpoint: 'http://localhost:8086', - fileUploadEndpoint: 'http://localhost:8086/api/poamimport', - authizeEndpoint: 'http://localhost:8080/realms/C-PAT/protocol/openid-connect/auth', - tokeEndpoint: 'http://localhost:8080/realms/C-PAT/protocol/openid-connect/token', + fileUploadEndpoint: 'http://localhost:8086/api/poamimport', + stigmanCollectionImportEndpoint: 'http://localhost:8086/api/stigmancollectionimport', + stigmanAssetImportEndpoint: 'http://localhost:8086/api/stigmanassetimport', + getCollectionsFromSTIGMANEndpoint: 'http://localhost:54000/api/collections/', + getAvailableAssetsFromSTIGMANEndpoint: 'http://localhost:54000/api/assets?collectionId=', + getAssetsFromSTIGMANEndpoint: 'http://localhost:54000/api/assets/', + authizeEndpoint: 'http://localhost:8080/realms/RMFTools/protocol/openid-connect/auth', + tokeEndpoint: 'http://localhost:8080/realms/RMFTools/protocol/openid-connect/token', redirectUri: 'http://localhost:4200/callback', - frontEndEndpoint: 'http://localhost:4200', - // wsEndpoint: 'http://localhost:3000/notifications', - // apiEndpoint: process && `http://${process.env.API_URL}:3000/api` || 'http://localhost:3000/api', - // wsEndpoint: process && `http://${process.env.API_URL}:3000/notifications` || 'http://localhost:3000/notifications', - // publicVapid: 'BEsUpX1fLAmUM6rtiYgdY9zJrr3oJo8eJzSi6nkA1qxvTR2xeMeImyXsrx-QcoFRediJ_-dnWrF7v9QXp_Ux8UU', + frontEndEndpoint: 'http://localhost:4200', + keycloakUrl: 'http://localhost:8080', + CPATRedirectUri: 'http://localhost:4200/consent', + tokenReturnUrl: "http://localhost:8080/realms/RMFTools/protocol/openid-connect/token", version: '1.0.0', - // + + // Set classification to on of: // classification classificationCode ClassificatonColorCode // 'UNCLASSIFIED' 'U ' '#5cb85c' diff --git a/Front End/poam-app/src/index.html b/Front End/poam-app/src/index.html index a75eccd0..11cde0b2 100644 --- a/Front End/poam-app/src/index.html +++ b/Front End/poam-app/src/index.html @@ -12,7 +12,7 @@ - PoamApp + C-PAT