diff --git a/apps/steward-app/src/main/js/bower.json b/apps/steward-app/src/main/js/bower.json index 5e1051acd..052fe5c7e 100644 --- a/apps/steward-app/src/main/js/bower.json +++ b/apps/steward-app/src/main/js/bower.json @@ -1,65 +1,58 @@ { "name": "shrine-data-steward-2.0", "description": "HMS Data Steward", "main": "start.js", "authors": [ "Ben Carmen" ], "license": "MIT", "keywords": [ "hms", "steward", "app" ], "moduleType": [], "homepage": "https://open.med.harvard.edu/project/shrine/", "ignore": [ "**/.*", "node_modules", "bower_components", "src/vendor", "test", "tests" ], "dependencies": { "bootstrap": "v3.3.7", "metisMenu": "v2.5.2", "angular-loading-bar": "v0.9.0", "font-awesome": "v4.6.3", "jquery": "v2.2.4", "angular": "v1.5.7", "json3": "v3.3.2", "angular-ui-router": "v0.3.1", "angular-route": "v1.5.7", "angular-cookies": "v1.5.7", "oclazyload": "ocLazyLoad#v1.0.9", "lodash": "v4.13.1", "angular-bootstrap": "v1.3.3", "Chart.js": "v2.1.6", "x2js": "x2js#v1.2.0", "angular-animate": "v1.5.8" }, "devDependencies": { "angular-mocks": "v1.5.7", "font-awesome": "v4.6.3" }, "overrides": { - "bootstrap": { - "main": [ - "dist/js/bootstrap.min.js", - "dist/css/bootstrap.css", - "less/bootstrap.less" - ] - }, "font-awesome": { "main": [ "css/font-awesome.css", "less/font-awesome.less", "scss/font-awesome.scss" ] } }, "resolutions": { "angular": "1.5.8" } } diff --git a/apps/steward-app/src/main/js/bower_components/Chart.js/docs/00-Getting-Started.md b/apps/steward-app/src/main/js/bower_components/Chart.js/docs/00-Getting-Started.md deleted file mode 100644 index 2a11f9bff..000000000 --- a/apps/steward-app/src/main/js/bower_components/Chart.js/docs/00-Getting-Started.md +++ /dev/null @@ -1,120 +0,0 @@ ---- -title: Getting started -anchor: getting-started ---- - -### Download Chart.js - -To download a zip, go to [Chart.js on Github](https://github.com/chartjs/Chart.js) and choose the version that is right for your application. -* [Standard build](https://raw.githubusercontent.com/chartjs/Chart.js/master/dist/Chart.js) (~31kB gzipped) -* [Bundled with Moment.js](https://raw.githubusercontent.com/chartjs/Chart.js/master/dist/Chart.bundle.js) (~45kB gzipped) -* [CDN Versions](https://cdnjs.com/libraries/Chart.js) - -To install via npm / bower: - -```bash -npm install chart.js --save -``` -```bash -bower install Chart.js --save -``` - -### Selecting the Correct Build - -Chart.js provides two different builds that are available for your use. The `Chart.js` and `Chart.min.js` files include Chart.js and the accompanying color parsing library. If this version is used and you require the use of the time axis, [Moment.js](http://momentjs.com/) will need to be included before Chart.js. - -The `Chart.bundle.js` and `Chart.bundle.min.js` builds include Moment.js in a single file. This version should be used if you require time axes and want a single file to include, select this version. Do not use this build if your application already includes Moment.js. If you do, Moment.js will be included twice, increasing the page load time and potentially introducing version issues. - -### Installation - -To import Chart.js using an old-school script tag: - -```html - - -``` - -To import Chart.js using an awesome module loader: - -```javascript - -// Using CommonJS -var Chart = require('src/chart.js') -var myChart = new Chart({...}) - -// ES6 -import Chart from 'src/chart.js' -let myChart = new Chart({...}) - -// Using requirejs -require(['path/to/Chartjs'], function(Chart){ - var myChart = new Chart({...}) -}) - -``` - -### Creating a Chart - -To create a chart, we need to instantiate the `Chart` class. To do this, we need to pass in the node, jQuery instance, or 2d context of the canvas of where we want to draw the chart. Here's an example. - -```html - -``` - -```javascript -// Any of the following formats may be used -var ctx = document.getElementById("myChart"); -var ctx = document.getElementById("myChart").getContext("2d"); -var ctx = $("#myChart"); -``` - -Once you have the element or context, you're ready to instantiate a pre-defined chart-type or create your own! - -The following example instantiates a bar chart showing the number of votes for different colors and the y-axis starting at 0. - -```html - - -``` - -It's that easy to get started using Chart.js! From here you can explore the many options that can help you customise your charts with scales, tooltips, labels, colors, custom actions, and much more. diff --git a/apps/steward-app/src/main/js/bower_components/Chart.js/test/element.arc.tests.js b/apps/steward-app/src/main/js/bower_components/Chart.js/test/element.arc.tests.js deleted file mode 100644 index 4ba854575..000000000 --- a/apps/steward-app/src/main/js/bower_components/Chart.js/test/element.arc.tests.js +++ /dev/null @@ -1,176 +0,0 @@ -// Test the rectangle element - -describe('Arc element tests', function() { - it ('Should be constructed', function() { - var arc = new Chart.elements.Arc({ - _datasetIndex: 2, - _index: 1 - }); - - expect(arc).not.toBe(undefined); - expect(arc._datasetIndex).toBe(2); - expect(arc._index).toBe(1); - }); - - it ('should determine if in range', function() { - var arc = new Chart.elements.Arc({ - _datasetIndex: 2, - _index: 1 - }); - - // Make sure we can run these before the view is added - expect(arc.inRange(2, 2)).toBe(false); - expect(arc.inLabelRange(2)).toBe(false); - - // Mock out the view as if the controller put it there - arc._view = { - startAngle: 0, - endAngle: Math.PI / 2, - x: 0, - y: 0, - innerRadius: 5, - outerRadius: 10, - }; - - expect(arc.inRange(2, 2)).toBe(false); - expect(arc.inRange(7, 0)).toBe(true); - expect(arc.inRange(0, 11)).toBe(false); - expect(arc.inRange(Math.sqrt(32), Math.sqrt(32))).toBe(true); - expect(arc.inRange(-1.0 * Math.sqrt(7), Math.sqrt(7))).toBe(false); - }); - - it ('should get the tooltip position', function() { - var arc = new Chart.elements.Arc({ - _datasetIndex: 2, - _index: 1 - }); - - // Mock out the view as if the controller put it there - arc._view = { - startAngle: 0, - endAngle: Math.PI / 2, - x: 0, - y: 0, - innerRadius: 0, - outerRadius: Math.sqrt(2), - }; - - var pos = arc.tooltipPosition(); - expect(pos.x).toBeCloseTo(0.5); - expect(pos.y).toBeCloseTo(0.5); - }); - - it ('should draw correctly with no border', function() { - var mockContext = window.createMockContext(); - var arc = new Chart.elements.Arc({ - _datasetIndex: 2, - _index: 1, - _chart: { - ctx: mockContext, - } - }); - - // Mock out the view as if the controller put it there - arc._view = { - startAngle: 0, - endAngle: Math.PI / 2, - x: 10, - y: 5, - innerRadius: 1, - outerRadius: 3, - - backgroundColor: 'rgb(0, 0, 255)', - borderColor: 'rgb(255, 0, 0)', - }; - - arc.draw(); - - expect(mockContext.getCalls()).toEqual([{ - name: 'beginPath', - args: [] - }, { - name: 'arc', - args: [10, 5, 3, 0, Math.PI / 2] - }, { - name: 'arc', - args: [10, 5, 1, Math.PI / 2, 0, true] - }, { - name: 'closePath', - args: [] - }, { - name: 'setStrokeStyle', - args: ['rgb(255, 0, 0)'] - }, { - name: 'setLineWidth', - args: [undefined] - }, { - name: 'setFillStyle', - args: ['rgb(0, 0, 255)'] - }, { - name: 'fill', - args: [] - }, { - name: 'setLineJoin', - args: ['bevel'] - }]); - }); - - it ('should draw correctly with a border', function() { - var mockContext = window.createMockContext(); - var arc = new Chart.elements.Arc({ - _datasetIndex: 2, - _index: 1, - _chart: { - ctx: mockContext, - } - }); - - // Mock out the view as if the controller put it there - arc._view = { - startAngle: 0, - endAngle: Math.PI / 2, - x: 10, - y: 5, - innerRadius: 1, - outerRadius: 3, - - backgroundColor: 'rgb(0, 0, 255)', - borderColor: 'rgb(255, 0, 0)', - borderWidth: 5 - }; - - arc.draw(); - - expect(mockContext.getCalls()).toEqual([{ - name: 'beginPath', - args: [] - }, { - name: 'arc', - args: [10, 5, 3, 0, Math.PI / 2] - }, { - name: 'arc', - args: [10, 5, 1, Math.PI / 2, 0, true] - }, { - name: 'closePath', - args: [] - }, { - name: 'setStrokeStyle', - args: ['rgb(255, 0, 0)'] - }, { - name: 'setLineWidth', - args: [5] - }, { - name: 'setFillStyle', - args: ['rgb(0, 0, 255)'] - }, { - name: 'fill', - args: [] - }, { - name: 'setLineJoin', - args: ['bevel'] - }, { - name: 'stroke', - args: [] - }]); - }); -}); \ No newline at end of file diff --git a/apps/steward-app/src/main/js/bower_components/bootstrap/CHANGELOG.md b/apps/steward-app/src/main/js/bower_components/bootstrap/CHANGELOG.md deleted file mode 100644 index b25f83841..000000000 --- a/apps/steward-app/src/main/js/bower_components/bootstrap/CHANGELOG.md +++ /dev/null @@ -1,5 +0,0 @@ -Bootstrap uses [GitHub's Releases feature](https://github.com/blog/1547-release-your-software) for its changelogs. - -See [the Releases section of our GitHub project](https://github.com/twbs/bootstrap/releases) for changelogs for each release version of Bootstrap. - -Release announcement posts on [the official Bootstrap blog](http://blog.getbootstrap.com) contain summaries of the most noteworthy changes made in each release. diff --git a/apps/steward-app/src/main/js/bower_components/bootstrap/less/mixins/text-overflow.less b/apps/steward-app/src/main/js/bower_components/bootstrap/less/mixins/text-overflow.less deleted file mode 100644 index c11ad2fb7..000000000 --- a/apps/steward-app/src/main/js/bower_components/bootstrap/less/mixins/text-overflow.less +++ /dev/null @@ -1,8 +0,0 @@ -// Text overflow -// Requires inline-block or block for proper styling - -.text-overflow() { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} diff --git a/apps/steward-app/src/main/js/bower_components/jquery/src/css/adjustCSS.js b/apps/steward-app/src/main/js/bower_components/jquery/src/css/adjustCSS.js deleted file mode 100644 index 48fcfec05..000000000 --- a/apps/steward-app/src/main/js/bower_components/jquery/src/css/adjustCSS.js +++ /dev/null @@ -1,65 +0,0 @@ -define( [ - "../core", - "../var/rcssNum" -], function( jQuery, rcssNum ) { - -function adjustCSS( elem, prop, valueParts, tween ) { - var adjusted, - scale = 1, - maxIterations = 20, - currentValue = tween ? - function() { return tween.cur(); } : - function() { return jQuery.css( elem, prop, "" ); }, - initial = currentValue(), - unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), - - // Starting value computation is required for potential unit mismatches - initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && - rcssNum.exec( jQuery.css( elem, prop ) ); - - if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { - - // Trust units reported by jQuery.css - unit = unit || initialInUnit[ 3 ]; - - // Make sure we update the tween properties later on - valueParts = valueParts || []; - - // Iteratively approximate from a nonzero starting point - initialInUnit = +initial || 1; - - do { - - // If previous iteration zeroed out, double until we get *something*. - // Use string for doubling so we don't accidentally see scale as unchanged below - scale = scale || ".5"; - - // Adjust and apply - initialInUnit = initialInUnit / scale; - jQuery.style( elem, prop, initialInUnit + unit ); - - // Update scale, tolerating zero or NaN from tween.cur() - // Break the loop if scale is unchanged or perfect, or if we've just had enough. - } while ( - scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations - ); - } - - if ( valueParts ) { - initialInUnit = +initialInUnit || +initial || 0; - - // Apply relative offset (+=/-=) if specified - adjusted = valueParts[ 1 ] ? - initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : - +valueParts[ 2 ]; - if ( tween ) { - tween.unit = unit; - tween.start = initialInUnit; - tween.end = adjusted; - } - } - return adjusted; -} - -return adjustCSS; -} ); diff --git a/apps/steward-app/src/main/js/bower_components/lodash/lib/fp/template/modules/_util.jst b/apps/steward-app/src/main/js/bower_components/lodash/lib/fp/template/modules/_util.jst deleted file mode 100644 index d450396fc..000000000 --- a/apps/steward-app/src/main/js/bower_components/lodash/lib/fp/template/modules/_util.jst +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - 'ary': require('../ary'), - 'assign': require('../_baseAssign'), - 'clone': require('../clone'), - 'curry': require('../curry'), - 'forEach': require('../_arrayEach'), - 'isArray': require('../isArray'), - 'isFunction': require('../isFunction'), - 'iteratee': require('../iteratee'), - 'keys': require('../_baseKeys'), - 'rearg': require('../rearg'), - 'spread': require('../spread'), - 'toPath': require('../toPath') -}; diff --git a/apps/steward-app/src/main/js/bower_components/lodash/vendor/firebug-lite/skin/xp/tree_close.gif b/apps/steward-app/src/main/js/bower_components/lodash/vendor/firebug-lite/skin/xp/tree_close.gif deleted file mode 100644 index e26728ab3..000000000 Binary files a/apps/steward-app/src/main/js/bower_components/lodash/vendor/firebug-lite/skin/xp/tree_close.gif and /dev/null differ diff --git a/tools/generate-keystores/README.md b/tools/generate-keystores/README.md new file mode 100644 index 000000000..cd5c228d3 --- /dev/null +++ b/tools/generate-keystores/README.md @@ -0,0 +1,10 @@ +# Generate keystores for QA network. + +Run generate-qa-certs.sh with a keystore password to generate keystores for a SHRINE network. It will generate a keystore for every node defined in `QA_HOSTS`. Every keystore will contain the following entries: +- A public certificate for the network CA +- A private, query-signing certificate that is signed by the network CA +- A public certificate that serves the node's HTTPS +- For the hub keystore, a public certificate entry for every downstream node +- For a downstream keystore, the hub's https public certificate + +Additionally, the script can be run with the --https-root flag. If it is, then instead of the hub having a public certificate for every downstream node, and every downstream node having the hub's https public cert, every node will have the public entry of the root HTTPS certificate. diff --git a/tools/generate-keystores/cleanup.sh b/tools/generate-keystores/cleanup.sh new file mode 100755 index 000000000..f5720bd6b --- /dev/null +++ b/tools/generate-keystores/cleanup.sh @@ -0,0 +1,7 @@ +#/usr/bin/bash +find . -type f -name "*.crt" -delete +find . -type f -name "*.csr" -delete +find . -type f -name "*.key" -delete +find . -type f -name "*.jks" -delete +find . -type f -name "*.p12" -delete +find . -type f -name "*.srl" -delete diff --git a/tools/generate-keystores/generate-qa-certs.sh b/tools/generate-keystores/generate-qa-certs.sh new file mode 100755 index 000000000..e9b7c9295 --- /dev/null +++ b/tools/generate-keystores/generate-qa-certs.sh @@ -0,0 +1,86 @@ +#!/bin/bash + +# The host that contains the hub +HUB_HOST=shrine-qa1 +# The hosts we want to generate keystores for +QA_HOSTS=($HUB_HOST shrine-qa2 shrine-qa3 telesto) +# The root CA for the https certs +SHRINE_HTTPS_ROOT=shrine-https-root # The root for the https certs +# The root ca for SHRINE's query signing certificates +SHRINE_HUB=shrine-hub +# The password for the keystore. Taken in on the command line +PASS=$1 +USE_HTTPS_ROOT=0 +HTTPS_FLAG="--https-root" +USAGE="$0 [--https-root] keystore-password" + +# Check if password is empty, or if flag is used without a following password +if [ "$PASS" == "" ] +then + exec echo $USAGE +fi + +if [ "$PASS" == $HTTPS_FLAG ] && [ "$2" != "" ] +then + PASS="$2" + USE_HTTPS_ROOT=1 +elif [ "$PASS" == $HTTPS_FLAG ] +then # Flag without password + exec echo $USAGE +fi + +# Check that password is longer than 6 characters +if [ ${#PASS} -lt 6 ]; then + exec echo "Password must be 6 characters or longer" +fi + +mkdir -p $SHRINE_HUB +mkdir -p $SHRINE_HTTPS_ROOT + +# Generate the https root CA +openssl req -x509 -new -newkey rsa:2048 -keyout $SHRINE_HTTPS_ROOT/$SHRINE_HTTPS_ROOT.key -sha256 -nodes -days 1024 -out $SHRINE_HTTPS_ROOT/$SHRINE_HTTPS_ROOT.crt -subj "/C=US/ST=Massachusetts/L=Boston/O=Harvard Medical School/OU=Catalyst SHRINE QA Network/CN=$SHRINE_HTTPS_ROOT" + +# Generate the hub CA +openssl req -x509 -new -newkey rsa:2048 -keyout $SHRINE_HUB/$SHRINE_HUB.key -sha256 -nodes -days 1024 -out $SHRINE_HUB/$SHRINE_HUB.crt -subj "/C=US/ST=Massachusetts/L=Boston/O=Harvard Medical School/OU=Catalyst SHRINE QA Network/CN=$SHRINE_HUB" + +for HOST in ${QA_HOSTS[*]}; do + mkdir -p $HOST + # Generate the query signing certificate CSR + openssl req -new -newkey rsa:2048 -keyout $HOST/$HOST.catalyst.key -sha256 -nodes -days 1024 -out $HOST/$HOST.catalyst.csr -config openssl.cnf -subj "/C=US/ST=Massachusetts/L=Boston/O=Harvard Medical School/OU=Catalyst SHRINE QA Hub/CN=$HOST.catalyst" + # Generate the https serving certificate CSR + openssl req -new -newkey rsa:2048 -keyout $HOST/$HOST-https.catalyst.key -sha256 -nodes -days 1024 -out $HOST/$HOST-https.catalyst.csr -config openssl.cnf -subj "/C=US/ST=Massachusetts/L=Boston/O=Harvard Medical School/OU=Catalyst SHRINE QA Hub/CN=$HOST-https.catalyst" + + # Sign the signing certs with the hub CA and the https certs with the https root CA + openssl x509 -req -in $HOST/$HOST.catalyst.csr -CA $SHRINE_HUB/$SHRINE_HUB.crt -CAkey $SHRINE_HUB/$SHRINE_HUB.key -CAcreateserial -out $HOST/$HOST.catalyst.crt -days 1024 -sha256 + openssl x509 -req -in $HOST/$HOST-https.catalyst.csr -CA $SHRINE_HTTPS_ROOT/$SHRINE_HTTPS_ROOT.crt -CAkey $SHRINE_HTTPS_ROOT/$SHRINE_HTTPS_ROOT.key -CAcreateserial -out $HOST/$HOST-https.catalyst.crt -days 1024 -sha256 + + # Generate pkcs12 keystore + openssl pkcs12 -export -in $HOST/$HOST.catalyst.crt -inkey $HOST/$HOST.catalyst.key -out $HOST/$HOST.catalyst.p12 -name $HOST.catalyst -CAfile $SHRINE_HUB/$SHRINE_HUB.crt -caname $SHRINE_HUB -chain -password pass:$PASS + + # Convert pcks12 keystores to jks keystores + keytool -importkeystore -srckeystore $HOST/$HOST.catalyst.p12 -srcstoretype pkcs12 -srcalias $HOST.catalyst -srcstorepass $PASS -destkeystore $HOST/$HOST.catalyst.jks -deststorepass $PASS -deststoretype jks -destalias $HOST.catalyst + + # Import certificates into keystore + keytool -importcert -alias $SHRINE_HUB -noprompt -file $SHRINE_HUB/$SHRINE_HUB.crt -keystore $HOST/$HOST.catalyst.jks -storepass $PASS + keytool -importcert -alias $HOST-https.catalyst -noprompt -file $HOST/$HOST-https.catalyst.crt -keystore $HOST/$HOST.catalyst.jks -storepass $PASS +done + +if [ $USE_HTTPS_ROOT -eq 0 ]; then + # Import the hub's https cert into all downstream nodes, and all downstream node's https certs into the hub's keystore + for HOST in ${QA_HOSTS[*]:1}; do + keytool -importcert -alias $SHRINE_HUB-https -noprompt -file $HUB_HOST/$HUB_HOST-https.catalyst.crt -keystore $HOST/$HOST.catalyst.jks -storepass $PASS + keytool -importcert -alias $HOST-https -noprompt -file $HOST/$HOST-https.catalyst.crt -keystore $HUB_HOST/$HUB_HOST.catalyst.jks -storepass $PASS + done +else + # Import the root https cert into the hub and downstream keystores + for HOST in ${QA_HOSTS[*]}; do + keytool -importcert -alias $SHRINE_HTTPS_ROOT -noprompt -file $SHRINE_HTTPS_ROOT/$SHRINE_HTTPS_ROOT.crt -keystore $HOST/$HOST.catalyst.jks -storepass $PASS + done +fi + + +for HOST in ${QA_HOSTS[*]}; do + keytool -list -noprompt -keystore $HOST/$HOST.catalyst.jks -storepass $PASS +done + + diff --git a/tools/generate-keystores/openssl.cnf b/tools/generate-keystores/openssl.cnf new file mode 100644 index 000000000..1d015b907 --- /dev/null +++ b/tools/generate-keystores/openssl.cnf @@ -0,0 +1,9 @@ +[req] +distinguished_name = req_distinguished_name +req_extensions = v3_req + +[req_distinguished_name] + + +[ v3_req ] +basicConstraints = CA:FALSE