diff options
author | demx8as6 <martin.skorupski@highstreet-technologies.com> | 2018-07-10 18:07:44 +0200 |
---|---|---|
committer | Timoney, Dan (dt5972) <dt5972@att.com> | 2018-07-11 16:30:28 -0400 |
commit | 27fb2d06608fbb070ae2c15a5580a4f5b2423d15 (patch) | |
tree | ccd717991b4e556b67f1fd2cacb345b4d174b41f /sdnr/wireless-transport/code-Carbon-SR1/ux/security | |
parent | 60315525ab5e7c12a9f47c409092e8dba6ad656d (diff) |
Add seed code for sdnr app based on ONF Centennial
At this point in time all the Carbon code from ONF Centennial is added to ONAP.
Later it needs to be refactored and modified for ODL Oxygen.
Change-Id: Iff85dd940c05c3827f1c4e6f9542ecd060c58a46
Issue-ID: SDNC-374
Signed-off-by: demx8as6 <martin.skorupski@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wireless-transport/code-Carbon-SR1/ux/security')
15 files changed, 813 insertions, 0 deletions
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/security/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/pom.xml new file mode 100644 index 00000000..8973079b --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/pom.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <artifactId>mwtn</artifactId> + <version>0.5.1-SNAPSHOT</version> + <relativePath>../</relativePath> + </parent> + + <groupId>org.onap.sdnc.dluxapps</groupId> + <artifactId>security</artifactId> + <!-- <name> formatting is used by autorelease to parse and notify projects on + build failure. Please do not modify this unless you have a good reason. --> + <name>${prefix} ${project.artifactId}</name> + <version>0.5.1</version> + <packaging>pom</packaging> + + <prerequisites> + <maven>3.0</maven> + </prerequisites> + + <modules> + <module>security-module</module> + <module>security-bundle</module> + </modules> +</project> diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-bundle/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-bundle/pom.xml new file mode 100644 index 00000000..34358bbe --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-bundle/pom.xml @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.sdnc.dluxapps</groupId> + <artifactId>security</artifactId> + <version>0.5.1</version> + </parent> + + <groupId>org.onap.sdnc.dluxapps</groupId> + <artifactId>security-bundle</artifactId> + <packaging>bundle</packaging> + <!-- <name> formatting is used by autorelease to parse and notify projects on + build failure. Please do not modify this unless you have a good reason. --> + <name>${prefix} ${project.artifactId}</name> + + <dependencies> + <dependency> + <groupId>org.opendaylight.dlux</groupId> + <artifactId>loader</artifactId> + <version>0.5.1-Carbon</version> + </dependency> + <dependency> + <groupId>org.onap.sdnc.dluxapps</groupId> + <artifactId>security-module</artifactId> + <version>0.5.1</version> + <scope>provided</scope> + </dependency> + </dependencies> + <build> + <resources> + <resource> + <directory>target/generated-resources</directory> + </resource> + <resource> + <directory>src/main/resources</directory> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <!--loader Resources--> + <execution> + <id>unpack-loader-resources</id> + <goals> + <goal>unpack-dependencies</goal> + </goals> + <phase>generate-resources</phase> + <configuration> + <outputDirectory>${project.build.directory}/generated-resources</outputDirectory> + <groupId>org.onap.sdnc.dluxapps</groupId> + <includeArtifactIds>security-module</includeArtifactIds> + <!-- <includes>security/src\/**</includes> --> + <excludes>META-INF\/**</excludes> + <excludeTransitive>true</excludeTransitive> + <ignorePermissions>false</ignorePermissions> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Import-Package>org.osgi.service.http, + org.osgi.framework;version="1.0.0", + org.opendaylight.dlux.loader + </Import-Package> + <Export-Package></Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml new file mode 100644 index 00000000..65ef78a3 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -0,0 +1,19 @@ +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> + <reference id="httpService" availability="mandatory" activation="eager" interface="org.osgi.service.http.HttpService"/> + <reference id="loader" availability="mandatory" activation="eager" interface="org.opendaylight.dlux.loader.DluxModuleLoader"/> + + <bean id="bundle" init-method="initialize" destroy-method="clean" class="org.opendaylight.dlux.loader.DluxModule"> + <property name="httpService" ref="httpService"/> + <property name="loader" ref="loader"/> + <property name="moduleName" value="security"/> + <property name="url" value="/src/app/security"/> + <property name="directory" value="/security/src"/> + <property name="requireJs" value="app/security/security.module"/> + <property name="angularJs" value="app.security"/> + <property name="cssDependencies"> + <list> + <value>src/app/security/security.custom.css</value> + </list> + </property> + </bean> +</blueprint> diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/pom.xml new file mode 100644 index 00000000..95ae27b2 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/pom.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>security</artifactId> + <groupId>org.onap.sdnc.dluxapps</groupId> + <version>0.5.1</version> + <relativePath>../</relativePath> + </parent> + <groupId>org.onap.sdnc.dluxapps</groupId> + <artifactId>security-module</artifactId> + <name>${prefix} ${project.artifactId}</name> + <version>0.5.1</version> + <packaging>jar</packaging> + + </project> diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/build.config.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/build.config.js new file mode 100644 index 00000000..c8396a3f --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/build.config.js @@ -0,0 +1,42 @@ +/** + * This file/module contains all configuration for the build process. + */ +module.exports = { + build_dir: 'build', + app_dir: 'app', + + app_files: { + js: [ + 'src/*/**/*.js', + '!node/**/*.*', + '!node_modules/**/*.*', + '!src/vendor/**/*.*' + ], + root_js: [ + 'src/*.js' + ], + less: [ + 'src/assets/less/*.less' + ], + img: [ + 'src/assets/img/*.*' + ], + + templates: [ + 'src/*/**/*.tpl.html', + 'src/*.tpl.html' + ] + }, + + assets_files: { + less: [], + css: [], + data: [] + }, + + vendor_files: { + js: [], + css: [], + fonts: [] + } +}; diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/gulpfile.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/gulpfile.js new file mode 100644 index 00000000..c3a15c45 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/gulpfile.js @@ -0,0 +1,142 @@ +var gulp = require('gulp'), + del = require('del'), + gutil = require('gulp-util'), + concat = require('gulp-concat'), + runSequence = require('run-sequence'), + install = require("gulp-install"), + connect = require('gulp-connect'), + open = require('gulp-open'), + argv = require('yargs').argv, + less = require('gulp-less'), + debug = require('gulp-debug'), + replace = require('gulp-replace-task'); + +var config = require( './build.config.js'); + + +/** + * Task for cleaning build directory + */ +gulp.task('clean', function() { + // You can use multiple globbing patterns as you would with `gulp.src` + return del(config.build_dir); +}); + +/** + * Copy assets + */ +gulp.task('copyAssetsCss', function () { + return gulp.src(config.assets_files.css) + .pipe( + gulp.dest( + (config.build_dir) + '/assets/css' + ) + ); +}); + +gulp.task('copyAssetsData', function () { + return gulp.src(config.assets_files.data) + .pipe(gulp.dest((config.build_dir) + '/assets/data')); +}); + +/** + * Copy app files + */ +gulp.task('copyTemplates', function () { + gutil.log(gutil.colors.cyan('INFO :: copying APP Template files')); + // Copy html + return gulp.src(config.app_files.templates) + .pipe(gulp.dest(config.build_dir)); +}); + +gulp.task('copyAppJs', function () { + gutil.log(gutil.colors.cyan('INFO :: copying APP Controller JS files')); + return gulp.src(config.app_files.js) + .pipe(gulp.dest(config.build_dir)); +}); + +gulp.task('copyRootJs', function () { + gutil.log(gutil.colors.cyan('INFO :: copying APP Root JS files')); + return gulp.src(config.app_files.root_js) + .pipe(gulp.dest(config.build_dir)); +}); + +/** + * Compile css from less files + */ +gulp.task('less', function () { + gutil.log(gutil.colors.cyan('INFO :: compiling LESS file')); + return gulp.src(config.app_files.less) + .pipe(less()) + .pipe(gulp.dest((config.build_dir) + '/assets/css')); +}); + +/** + * Copy app assets images + */ +gulp.task('copyAppImgs', function () { + gutil.log(gutil.colors.cyan('INFO :: copying image files')); + return gulp.src(config.app_files.img) + .pipe(gulp.dest((config.build_dir) + '/assets/img')); + +}); + +/** + * Copy vendor files + */ +gulp.task('copyVendorCss', function () { + gutil.log(gutil.colors.cyan('INFO :: copying VENDOR css')); + return gulp.src(config.vendor_files.css, { cwd : 'node_modules/**' }) + .pipe(gulp.dest((config.build_dir) + '/vendor')); +}); + +gulp.task('copyVendorFonts', function () { + gutil.log(gutil.colors.cyan('INFO :: copying VENDOR fonts')); + return gulp.src(config.vendor_files.fonts, { cwd : 'node_modules/**' }) + .pipe(gulp.dest((config.build_dir) + '/vendor')); +}); + +gulp.task('copyVendorJs', function () { + gutil.log(gutil.colors.cyan('INFO :: copying VENDOR js files')); + return gulp.src(config.vendor_files.js, { cwd : 'node_modules/**' }) + .pipe(gulp.dest((config.build_dir) + '/vendor')); +}); + +/** + * Copy task aggregated + */ +gulp.task('copy', function() { + runSequence('less', [ + 'copyAssetsCss', + 'copyAssetsData', + 'copyTemplates', + 'copyAppJs', + 'copyRootJs', + 'copyVendorCss', + 'copyVendorFonts', + 'copyAppImgs' + ], 'copyVendorJs'); +}); + +/** + * Build task + */ +gulp.task('build', function(){ + runSequence('clean', 'copy'); +}); + + +/** + * Live preview main task for development + * argument --live should be used to force build task to build only live preview + */ +gulp.task('default', function (){ + + if (!argv.live) { + gutil.log(gutil.colors.red('ERROR :: --live argument must be used for live preview!')); + } + + gutil.log(gutil.colors.cyan('INFO :: opening new browser tab live:' + argv.live)); + + runSequence('build'); +}); diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/package.json b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/package.json new file mode 100644 index 00000000..2fb0b713 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/package.json @@ -0,0 +1,29 @@ +{ + "name": "odl-dluxapps-security", + "version": "0.5.1", + "main": "main.js", + "devDependencies": { + "gulp-bower": "0.0.13" + }, + "dependencies": { + "del": "^2.2.0", + "gulp": "^3.9.1", + "gulp-concat": "^2.6.0", + "gulp-connect": "^5.0.0", + "gulp-debug": "^3.0.0", + "gulp-install": "^0.6.0", + "gulp-less": "^3.1.0", + "gulp-open": "^2.0.0", + "gulp-replace-task": "^0.11.0", + "gulp-util": "^3.0.7", + "run-sequence": "^1.1.5" + }, + "repository": { + "type": "git", + "url": "https://git.opendaylight.org/gerrit/dluxapps" + }, + "license": "EPL", + "keywords": [ + "odl" + ] +} diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.controller.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.controller.js new file mode 100644 index 00000000..e7f12c22 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.controller.js @@ -0,0 +1,149 @@ +define("security.service", ["require", "exports", "angularAMD"], function (require, exports, angular) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var security = angular.module('app.security'); + var SecurityService = /** @class */ (function () { + function SecurityService($q, $http, $window, env) { + this.$q = $q; + this.$http = $http; + this.$window = $window; + this.env = env; + this.ensureCrendentials(); + } + SecurityService.prototype.ensureCrendentials = function () { + var credentialsDefer = this.$q.defer(); + this.credentials = credentialsDefer.promise; + var url = this.env.getBaseURL('MD_SAL') + "/oauth2/token"; + this.$http({ + method: "POST", + url: url, + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + data: "grant_type=password&username=" + this.$window.sessionStorage.odlUser + "&password=" + this.$window.sessionStorage.odlPass + "&scope=sdn" + }).then(function (res) { + credentialsDefer.resolve(res.data && res.data.access_token); + }, function (err) { + credentialsDefer.reject(err); + }); + }; + Object.defineProperty(SecurityService.prototype, "token", { + get: function () { + return this.credentials; + }, + enumerable: true, + configurable: true + }); + SecurityService.prototype.getAllUsers = function () { + var _this = this; + var url = this.env.getBaseURL('MD_SAL') + "/auth/v1/users"; + return this.token.then(function (token) { + return _this.$http({ + method: "GET", + url: url, + headers: { 'Authorization': "Bearer " + token } + }).then(function (result) { return result.data && result.data.users; }); + }); + }; + SecurityService.prototype.getAllRoles = function () { + var _this = this; + var url = this.env.getBaseURL('MD_SAL') + "/auth/v1/roles"; + return this.token.then(function (token) { + return _this.$http({ + method: "GET", + url: url, + headers: { 'Authorization': "Bearer " + token } + }).then(function (result) { return result.data && result.data.roles; }); + }); + }; + SecurityService.prototype.getUserById = function (userId) { + var _this = this; + var url = this.env.getBaseURL('MD_SAL') + "/auth/v1/users/" + userId; + return this.token.then(function (token) { + return _this.$http({ + method: "GET", + url: url, + headers: { 'Authorization': "Bearer " + token } + }).then(function (result) { return result.data && result.data; }); + }); + }; + SecurityService.prototype.getRolesForDomainUser = function (userId, domain) { + var _this = this; + if (domain === void 0) { domain = "sdn"; } + var url = this.env.getBaseURL('MD_SAL') + "/auth/v1/domains/" + domain + "/users/" + userId + "/roles"; + return this.token.then(function (token) { + return _this.$http({ + method: "GET", + url: url, + headers: { 'Authorization': "Bearer " + token } + }).then(function (result) { return result.data && result.data.roles; }); + }); + }; + return SecurityService; + }()); + exports.SecurityService = SecurityService; + security.service('securityService', ['$q', '$http', '$window', 'ENV', SecurityService]); +}); +define( ["require", "exports", "security.service"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var security = angular.module('app.security'); + var UserDetailsCtrl = /** @class */ (function () { + function UserDetailsCtrl($scope, $uibModalInstance, userid, roles) { + var _this = this; + this.$uibModalInstance = $uibModalInstance; + this.userid = userid; + this.roles = roles; + this.ok = function () { + _this.$uibModalInstance.close( /* Parameter*/); + }; + this.cancel = function () { + _this.$uibModalInstance.dismiss('cancel'); + }; + } + return UserDetailsCtrl; + }()); + security.controller('userDetailsCtrl', ['$scope', '$uibModalInstance', 'userid', 'roles', UserDetailsCtrl]); + var SecurityCtrl = /** @class */ (function () { + function SecurityCtrl($scope, $timeout, $q, $uibModal, $document, $mwtnCommons, securityService) { + this.$q = $q; + this.$uibModal = $uibModal; + this.$document = $document; + this.securityService = securityService; + $scope.message = "Empty"; + $scope.users = []; + $scope.roles = []; + $scope.currentUser = {}; + $scope.getCurrentUserById = function (id) { + id !== null && securityService.getRolesForDomainUser(id).then(function (roles) { + var parentElem = angular.element($document[0].querySelector('#security')); + var modalInstance = $uibModal.open({ + animation: true, + ariaLabelledBy: 'modal-title', + ariaDescribedBy: 'modal-body', + templateUrl: 'src/app/security/templates/userDetails.html', + controller: 'userDetailsCtrl', + controllerAs: 'vm', + appendTo: parentElem, + size: 'sm', + resolve: { + roles: function () { return roles; }, + userid: function () { return id; }, + } + }); + }); + }; + securityService.token.then(function (res) { + $q.all([ + securityService.getAllUsers(), + securityService.getAllRoles() + ]).then(function (_a) { + var users = _a[0], roles = _a[1]; + $scope.users = users; + $scope.roles = roles; + }); + }); + } + return SecurityCtrl; + }()); + security.controller('securityCtrl', ['$scope', '$timeout', '$q', '$uibModal', '$document', '$mwtnCommons', 'securityService', SecurityCtrl]); +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VjdXJpdHkuY29udHJvbGxlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInNyYy9hcHAvc2VjdXJpdHkvc2VjdXJpdHkuc2VydmljZS50cyIsInNyYy9hcHAvc2VjdXJpdHkvc2VjdXJpdHkuY29udHJvbGxlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7SUFFQSxJQUFNLFFBQVEsR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLGNBQWMsQ0FBQyxDQUFDO0lBdUJoRDtRQUdFLHlCQUFvQixFQUFnQixFQUFVLEtBQXNCLEVBQVUsT0FBTyxFQUFVLEdBQWdCO1lBQTNGLE9BQUUsR0FBRixFQUFFLENBQWM7WUFBVSxVQUFLLEdBQUwsS0FBSyxDQUFpQjtZQUFVLFlBQU8sR0FBUCxPQUFPLENBQUE7WUFBVSxRQUFHLEdBQUgsR0FBRyxDQUFhO1lBQzdHLElBQUksQ0FBQyxrQkFBa0IsRUFBRSxDQUFDO1FBQzVCLENBQUM7UUFFTyw0Q0FBa0IsR0FBMUI7WUFDRSxJQUFNLGdCQUFnQixHQUFHLElBQUksQ0FBQyxFQU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JpdHlDdHJsIF0pOyJdfQ==
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.controller.ts b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.controller.ts new file mode 100644 index 00000000..49315319 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.controller.ts @@ -0,0 +1,63 @@ +declare var angular: angular.IAngularStatic; + +import { SecurityService, Role } from "./security.service"; + +import "./security.service"; + +const security = angular.module('app.security'); + +class UserDetailsCtrl { + constructor($scope, private $uibModalInstance, public userid: string, public roles: Role[]) { + + } + + public ok = () => { + this.$uibModalInstance.close(/* Parameter*/); + }; + + public cancel = () => { + this.$uibModalInstance.dismiss('cancel'); + }; +} + +security.controller('userDetailsCtrl', ['$scope', '$uibModalInstance', 'userid', 'roles', UserDetailsCtrl]); + +class SecurityCtrl { + constructor($scope, $timeout, private $q: ng.IQService, private $uibModal, private $document : ng.IDocumentService, $mwtnCommons, private securityService: SecurityService) { + $scope.message = "Empty"; + $scope.users = []; + $scope.roles = []; + $scope.currentUser = {}; + + $scope.getCurrentUserById = function (id: string) { + id !== null && securityService.getRolesForDomainUser(id).then(roles => { + const parentElem = angular.element($document[0].querySelector('#security')); + const modalInstance = $uibModal.open({ + animation: true, + ariaLabelledBy: 'modal-title', + ariaDescribedBy: 'modal-body', + templateUrl: 'src/app/security/templates/userDetails.html', + controller: 'userDetailsCtrl', + controllerAs: 'vm', + appendTo: parentElem, + size: 'sm', + resolve: { + roles: () => roles, + userid: () => id, + } + }) + }) + }; + + securityService.token.then(res => { + $q.all([ + securityService.getAllUsers(), + securityService.getAllRoles()]).then(([users, roles]) => { + $scope.users = users; + $scope.roles = roles; + }) + }); + } +} + +security.controller('securityCtrl', ['$scope', '$timeout', '$q', '$uibModal','$document', '$mwtnCommons', 'securityService', SecurityCtrl ]);
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.custom.css b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.custom.css new file mode 100644 index 00000000..67bd4579 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.custom.css @@ -0,0 +1,11 @@ +#security table > thead > tr > th { + background: #ddd +} + +#security table > tbody > tr > td { + background: #ddd +} + +#security table > tbody > tr:nth-child(odd) > td { + background: #eee +}
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.module.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.module.js new file mode 100644 index 00000000..dfd7e229 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.module.js @@ -0,0 +1,33 @@ +define( ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.security = angular.module('app.security', ['app.core']); + exports.security.config(function ($stateProvider, $compileProvider, $controllerProvider, $provide, NavHelperProvider, $httpProvider, $translateProvider, $translatePartialLoaderProvider) { + //$translatePartialLoaderProvider.addPart('app/security/locale/locale'); + NavHelperProvider.addControllerUrl('app/security/security.controller'); + NavHelperProvider.addToMenu('security', { + "link": "#/security", + "active": "main.security", + "title": "Security", + "icon": "fa fa-shield", + "page": { + "title": "Security", + "description": "security" + } + }); + $stateProvider.state('main.security', { + url: 'security', + access: 2, + views: { + 'content': { + templateUrl: 'src/app/security/security.tpl.html', + controller: 'securityCtrl' + } + } + }); + }); +}); +/* non ES6 export */ +// export = security; +// export default security; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VjdXJpdHkubW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsic3JjL2FwcC9zZWN1cml0eS9zZWN1cml0eS5tb2R1bGU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dmlkZXIuc3RhdGUoJ21haW4uc2VjdXJpdHknLCB7XG4gICAgdXJsOiAnc2VjdXJpdHknLFxuICAgIGFjY2VzczogMixcbiAgICB2aWV3czoge1xuICAgICAgJ2NvbnRlbnQnOiB7XG4gICAgICAgIHRlbXBsYXRlVXJsOiAnc3JjL2FwcC9zZWN1cml0eS9zZWN1cml0eS50cGwuaHRtbCcsXG4gICAgICAgIGNvbnRyb2xsZXI6ICdzZWN1cml0eUN0cmwnXG4gICAgICB9XG4gICAgfVxuICB9KTtcbn0pO1xuXG4vKiBub24gRVM2IGV4cG9ydCAqL1xuLy8gZXhwb3J0ID0gc2VjdXJpdHk7XG4vLyBleHBvcnQgZGVmYXVsdCBzZWN1cml0eTsiXX0=
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.module.ts b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.module.ts new file mode 100644 index 00000000..e06ae9ac --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.module.ts @@ -0,0 +1,36 @@ +// import * as angular from 'angularAMD'; +declare var angular: angular.IAngularStatic; + +export const security = angular.module('app.security', ['app.core']); + +security.config(function ($stateProvider, $compileProvider, $controllerProvider, $provide, NavHelperProvider, $httpProvider, $translateProvider, $translatePartialLoaderProvider) { + + //$translatePartialLoaderProvider.addPart('app/security/locale/locale'); + + NavHelperProvider.addControllerUrl('app/security/security.controller'); + NavHelperProvider.addToMenu('security', { + "link": "#/security", + "active": "main.security", + "title": "Security", + "icon": "fa fa-shield", // Add navigation icon css class here + "page": { + "title": "Security", + "description": "security" + } + }); + + $stateProvider.state('main.security', { + url: 'security', + access: 2, + views: { + 'content': { + templateUrl: 'src/app/security/security.tpl.html', + controller: 'securityCtrl' + } + } + }); +}); + +/* non ES6 export */ +// export = security; +// export default security;
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.service.ts b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.service.ts new file mode 100644 index 00000000..c881c53f --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.service.ts @@ -0,0 +1,99 @@ +import * as angular from 'angularAMD'; + +const security = angular.module('app.security'); + +interface IEnvService { + getBaseURL(port: string): string; +} + +export type User = { + description: string; + domainid: string; + email: string; + enabled: boolean; + password: string; + salt: string; + userid: string; +} + +export type Role = { + roleid: string; + name: string; + description: string; + domainid: string; +} + +export class SecurityService { + private credentials: ng.IPromise<string>; + + constructor(private $q: ng.IQService, private $http: ng.IHttpService, private $window, private env: IEnvService) { + this.ensureCrendentials(); + } + + private ensureCrendentials() { + const credentialsDefer = this.$q.defer<string>(); + this.credentials = credentialsDefer.promise; + + const url = `${this.env.getBaseURL('MD_SAL')}/oauth2/token`; + this.$http<{ access_token: string }>({ + method: "POST", + url: url, + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + data: `grant_type=password&username=${this.$window.sessionStorage.odlUser}&password=${this.$window.sessionStorage.odlPass}&scope=sdn` + }).then(res => { + credentialsDefer.resolve(res.data && res.data.access_token); + }, err => { + credentialsDefer.reject(err); + }); + } + + public get token() { + return this.credentials; + } + + public getAllUsers(): ng.IPromise<User[]> { + const url = `${this.env.getBaseURL('MD_SAL')}/auth/v1/users`; + return this.token.then(token => { + return this.$http<{ users: User[] }>({ + method: "GET", + url: url, + headers: { 'Authorization': `Bearer ${token}` } + }).then(result => result.data && result.data.users) + }); + } + + public getAllRoles(): ng.IPromise<Role[]> { + const url = `${this.env.getBaseURL('MD_SAL')}/auth/v1/roles`; + return this.token.then(token => { + return this.$http<{ roles: Role[] }>({ + method: "GET", + url: url, + headers: { 'Authorization': `Bearer ${token}` } + }).then(result => result.data && result.data.roles) + }); + } + + public getUserById(userId: string): ng.IPromise<User> { + const url = `${this.env.getBaseURL('MD_SAL')}/auth/v1/users/${userId}`; + return this.token.then(token => { + return this.$http<User>({ + method: "GET", + url: url, + headers: { 'Authorization': `Bearer ${token}` } + }).then(result => result.data && result.data) + }); + } + + public getRolesForDomainUser(userId: string, domain: string= "sdn"): ng.IPromise<Role[]> { + const url = `${this.env.getBaseURL('MD_SAL')}/auth/v1/domains/${domain}/users/${userId}/roles`; + return this.token.then(token => { + return this.$http<{ roles: Role[] }>({ + method: "GET", + url: url, + headers: { 'Authorization': `Bearer ${token}` } + }).then(result => result.data && result.data.roles) + }); + } +} + +security.service('securityService', ['$q', '$http', '$window', 'ENV', SecurityService]);
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.tpl.html b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.tpl.html new file mode 100644 index 00000000..ea08892b --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/security.tpl.html @@ -0,0 +1,50 @@ +<div id="security"> + <h2>Users</h2> + <table class="table"> + <thead> + <tr> + <th>UserID</th> + <th>Name</th> + <th>Description</th> + <th>Enabled</th> + <th>eMail</th> + <th>Domain</th> + <th>Actions</th> + </tr> + </thead> + <tbody> + <tr ng-repeat="user in users"> + <td>{{user.userid}}</td> + <td>{{user.name}}</td> + <td>{{user.description}}</td> + <td>{{user.enabled}}</td> + <td>{{user.email}}</td> + <td>{{user.domainid}}</td> + <td> + <button class="btn btn-sm btn-success" + ng-click="getCurrentUserById(user.userid)">Info</button></td> + </tr> + </tbody> + </table> +<h2>Roles</h2> +<table class="table"> + <thead> + <tr> + <th>RoleID</th> + <th>Name</th> + <th>Description</th> + <th>Domain</th> + <!-- <th>Actions</th> --> + </tr> + </thead> + <tbody> + <tr ng-repeat="role in roles"> + <td>{{role.roleid}}</td> + <td>{{role.name}}</td> + <td>{{role.description}}</td> + <td>{{role.domainid}}</td> + <!-- <td><button class="btn btn-sm btn-success">Info</button></td> --> + </tr> + </tbody> +</table> +</div>
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/templates/userDetails.html b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/templates/userDetails.html new file mode 100644 index 00000000..5589263b --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/security/security-module/src/main/resources/security/src/templates/userDetails.html @@ -0,0 +1,14 @@ +<div class="modal-header"> + <h3 class="modal-title" id="modal-title" style="color: #333;">{{ vm.userid }}</h3> +</div> +<div class="modal-body" id="modal-body"> + <div><b>Roles</b></div> + <ul> + <li ng-repeat="role in vm.roles">{{ role.name }}</li> + </ul> + +</div> +<div class="modal-footer"> + <button class="btn btn-primary" type="button" ng-click="vm.ok()">OK</button> + <button class="btn btn-warning" type="button" ng-click="vm.cancel()">Cancel</button> +</div>
\ No newline at end of file |