Skip to content

Commit

Permalink
Add nFlow adal configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
eputtone committed Nov 16, 2018
1 parent 16d32bb commit d97bb1b
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
4 changes: 3 additions & 1 deletion nflow-explorer/src/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
var m = angular.module('nflowExplorer', [
'nflowExplorer.about',
'nflowExplorer.config',
'nflowExplorer.config.adal',
'nflowExplorer.components',
'nflowExplorer.frontPage',
'nflowExplorer.layout',
Expand All @@ -20,7 +21,8 @@
'ngSanitize',
'ngTouch',
'ui.bootstrap',
'chart.js'
'chart.js',
'AdalAngular'
]);

m.run(function (EndpointService, ExecutorService) {
Expand Down
9 changes: 9 additions & 0 deletions nflow-explorer/src/app/config/adal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(function () {
'use strict';
var m = angular.module('nflowExplorer.config.adal', ['nflowExplorer.config', 'AdalAngular']);
m.config(function(config, $httpProvider, adalAuthenticationServiceProvider) {
if (config.adal && config.adal.requireADLogin) {
adalAuthenticationServiceProvider.init(config.adal, $httpProvider);
}
});
})();
11 changes: 11 additions & 0 deletions nflow-explorer/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ var Config = function() {
},
];

this.adal = {
// undocumented adal-option that controls authentication on globally
requireADLogin: false,
instance: 'https://login.microsoftonline.com/',
tenant: 'Enter_your_tenant_name_here_e.g._contoso.onmicrosoft.com',
clientId: 'Enter_your_client_ID_here_e.g._e9a5a8b6-8af7-4719-9821-0deef255f68e',
popUp: false,
// see: https://github.com/AzureAD/azure-activedirectory-library-for-js/issues/261
anonymousEndpoints: ['html']
};

this.radiator = {
// poll period in seconds
pollPeriod: 15,
Expand Down
8 changes: 8 additions & 0 deletions nflow-explorer/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@
<!-- endbower -->
<!-- endbuild -->

<!--
Adal-angular is not managed using Bower purely because JS uglification fails because the
library declares strict mode but is not compliant with it, which makes the build to fail.
https://github.com/AzureAD/azure-activedirectory-library-for-js/pull/820/files
-->
<script src="external/adal-angular/adal.js"></script>
<script src="external/adal-angular/adal-angular.js"></script>
<script src="external/angular-ui-bootstrap/ui-bootstrap-custom-tpls-0.10.0.min.js"></script>

<script src="config.js"></script>
Expand All @@ -75,6 +82,7 @@
<script src="app/config/index.js"></script>
<script src="app/config/console.js"></script>
<script src="app/config/routes.js"></script>
<script src="app/config/adal.js"></script>

<script src="app/components/index.js"></script>
<script src="app/components/constants.js"></script>
Expand Down
5 changes: 3 additions & 2 deletions nflow-explorer/test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ module.exports = function(config) {
'bower_components/momentjs/moment.js',
'bower_components/lodash/lodash.js',
'bower_components/bootstrap-sass/assets/javascripts/bootstrap.js',
'bower_components/d3/d3.js',

'src/external/dagre-d3/js/dagre-d3.min.js',
'src/external/adal-angular/adal.js',
'src/external/adal-angular/adal-angular.js',
'src/external/angular-ui-bootstrap/ui-bootstrap-custom-tpls-0.10.0.min.js',
'bower_components/d3/d3.js',
'src/config.js',
'src/app/**/*.js',
'test/mock/**/*.js',
Expand Down

0 comments on commit d97bb1b

Please sign in to comment.