BAEL-797 Adding login logic and principal object to add to the application state
This commit is contained in:
+12
-5
@@ -6,11 +6,18 @@
|
||||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
</ul>
|
||||
<form (ngSubmit)="onLogin(f)" class="form-inline mt-2 mt-md-0" #f="ngForm">
|
||||
<input name="username" [(ngModel)]="credentials.username" required class="form-control mr-sm-2" type="text" placeholder="Username">
|
||||
<input name="password" [(ngModel)]="credentials.password" required class="form-control mr-sm-2" type="password" placeholder="Password">
|
||||
<button class="btn btn-outline-success my-2 my-sm-0" type="submit" [disabled]="!f.valid">Login</button>
|
||||
</form>
|
||||
<div *ngIf="!principal.authenticated; then loginForm else loginMessage"></div>
|
||||
<ng-template #loginForm>
|
||||
<form (ngSubmit)="onLogin(f)" class="form-inline mt-2 mt-md-0" #f="ngForm">
|
||||
<input name="username" [(ngModel)]="credentials.username" required class="form-control mr-sm-2" type="text" placeholder="Username">
|
||||
<input name="password" [(ngModel)]="credentials.password" required class="form-control mr-sm-2" type="password" placeholder="Password">
|
||||
<button class="btn btn-outline-success my-2 my-sm-0" type="submit" [disabled]="!f.valid">Login</button>
|
||||
</form>
|
||||
</ng-template>
|
||||
<ng-template #loginMessage>
|
||||
<button type="button" class="btn btn-link">Logout</button>
|
||||
</ng-template>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
+7
-2
@@ -2,6 +2,7 @@ import {Component, OnInit} from "@angular/core";
|
||||
import {NgForm} from "@angular/forms";
|
||||
import {RequestOptions, Http, Response, Headers} from "@angular/http";
|
||||
import "rxjs/Rx";
|
||||
import {Principal} from "./principal";
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@@ -14,6 +15,8 @@ export class AppComponent implements OnInit{
|
||||
password: ''
|
||||
};
|
||||
|
||||
principal: Principal = new Principal(false, []);
|
||||
|
||||
constructor(private http: Http){}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -26,8 +29,10 @@ export class AppComponent implements OnInit{
|
||||
let options = new RequestOptions({headers: headers});
|
||||
this.http.get("/me", options)
|
||||
.map((response: Response) => response.json())
|
||||
.subscribe((data: any) => {
|
||||
console.log(data);
|
||||
.map((data: any) => new Principal(data.authenticated, data.authorities))
|
||||
.subscribe((principal: Principal) => {
|
||||
console.log(principal);
|
||||
this.principal = principal;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Created by tschi on 4/16/2017.
|
||||
*/
|
||||
export class Principal {
|
||||
public authenticated: boolean;
|
||||
public authorities: Authority[] = [];
|
||||
|
||||
constructor(authenticated: boolean, authorities: any[]) {
|
||||
this.authenticated = authenticated;
|
||||
authorities.map(auth => this.authorities.push(new Authority(auth.authority)))
|
||||
}
|
||||
|
||||
isAdmin() {
|
||||
return this.authorities.some((auth: Authority) => auth.authority.indexOf('ADMIN') > -1)
|
||||
}
|
||||
}
|
||||
|
||||
export class Authority {
|
||||
public authority: String;
|
||||
|
||||
constructor(authority: String) {
|
||||
this.authority = authority;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
@@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Ui</title>
|
||||
<base href="/">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
<app-root>Loading...</app-root>
|
||||
<script type="text/javascript" src="inline.bundle.js"></script><script type="text/javascript" src="polyfills.bundle.js"></script><script type="text/javascript" src="styles.bundle.js"></script><script type="text/javascript" src="vendor.bundle.js"></script><script type="text/javascript" src="main.bundle.js"></script></body>
|
||||
</html>
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // install a JSONP callback for chunk loading
|
||||
/******/ var parentJsonpFunction = window["webpackJsonp"];
|
||||
/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {
|
||||
/******/ // add "moreModules" to the modules object,
|
||||
/******/ // then flag all "chunkIds" as loaded and fire callback
|
||||
/******/ var moduleId, chunkId, i = 0, resolves = [], result;
|
||||
/******/ for(;i < chunkIds.length; i++) {
|
||||
/******/ chunkId = chunkIds[i];
|
||||
/******/ if(installedChunks[chunkId])
|
||||
/******/ resolves.push(installedChunks[chunkId][0]);
|
||||
/******/ installedChunks[chunkId] = 0;
|
||||
/******/ }
|
||||
/******/ for(moduleId in moreModules) {
|
||||
/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
|
||||
/******/ modules[moduleId] = moreModules[moduleId];
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);
|
||||
/******/ while(resolves.length)
|
||||
/******/ resolves.shift()();
|
||||
/******/ if(executeModules) {
|
||||
/******/ for(i=0; i < executeModules.length; i++) {
|
||||
/******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]);
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ return result;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // objects to store loaded and loading chunks
|
||||
/******/ var installedChunks = {
|
||||
/******/ 4: 0
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId])
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ // This file contains only the entry chunk.
|
||||
/******/ // The chunk loading function for additional chunks
|
||||
/******/ __webpack_require__.e = function requireEnsure(chunkId) {
|
||||
/******/ if(installedChunks[chunkId] === 0)
|
||||
/******/ return Promise.resolve();
|
||||
/******/
|
||||
/******/ // an Promise means "currently loading".
|
||||
/******/ if(installedChunks[chunkId]) {
|
||||
/******/ return installedChunks[chunkId][2];
|
||||
/******/ }
|
||||
/******/ // start chunk loading
|
||||
/******/ var head = document.getElementsByTagName('head')[0];
|
||||
/******/ var script = document.createElement('script');
|
||||
/******/ script.type = 'text/javascript';
|
||||
/******/ script.charset = 'utf-8';
|
||||
/******/ script.async = true;
|
||||
/******/ script.timeout = 120000;
|
||||
/******/
|
||||
/******/ if (__webpack_require__.nc) {
|
||||
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
||||
/******/ }
|
||||
/******/ script.src = __webpack_require__.p + "" + chunkId + ".chunk.js";
|
||||
/******/ var timeout = setTimeout(onScriptComplete, 120000);
|
||||
/******/ script.onerror = script.onload = onScriptComplete;
|
||||
/******/ function onScriptComplete() {
|
||||
/******/ // avoid mem leaks in IE.
|
||||
/******/ script.onerror = script.onload = null;
|
||||
/******/ clearTimeout(timeout);
|
||||
/******/ var chunk = installedChunks[chunkId];
|
||||
/******/ if(chunk !== 0) {
|
||||
/******/ if(chunk) chunk[1](new Error('Loading chunk ' + chunkId + ' failed.'));
|
||||
/******/ installedChunks[chunkId] = undefined;
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ var promise = new Promise(function(resolve, reject) {
|
||||
/******/ installedChunks[chunkId] = [resolve, reject];
|
||||
/******/ });
|
||||
/******/ installedChunks[chunkId][2] = promise;
|
||||
/******/
|
||||
/******/ head.appendChild(script);
|
||||
/******/ return promise;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // identity function for calling harmony imports with the correct context
|
||||
/******/ __webpack_require__.i = function(value) { return value; };
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, {
|
||||
/******/ configurable: false,
|
||||
/******/ enumerable: true,
|
||||
/******/ get: getter
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/ // on error function for async loading
|
||||
/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; };
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([]);
|
||||
//# sourceMappingURL=inline.bundle.js.map
|
||||
@@ -0,0 +1,282 @@
|
||||
webpackJsonp([1,4],{
|
||||
|
||||
/***/ 196:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
function webpackEmptyContext(req) {
|
||||
throw new Error("Cannot find module '" + req + "'.");
|
||||
}
|
||||
webpackEmptyContext.keys = function() { return []; };
|
||||
webpackEmptyContext.resolve = webpackEmptyContext;
|
||||
module.exports = webpackEmptyContext;
|
||||
webpackEmptyContext.id = 196;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 197:
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(1);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_platform_browser_dynamic__ = __webpack_require__(202);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__app_app_module__ = __webpack_require__(208);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__environments_environment__ = __webpack_require__(211);
|
||||
|
||||
|
||||
|
||||
|
||||
if (__WEBPACK_IMPORTED_MODULE_3__environments_environment__["a" /* environment */].production) {
|
||||
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["a" /* enableProdMode */])();
|
||||
}
|
||||
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__angular_platform_browser_dynamic__["a" /* platformBrowserDynamic */])().bootstrapModule(__WEBPACK_IMPORTED_MODULE_2__app_app_module__["a" /* AppModule */]);
|
||||
//# sourceMappingURL=main.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 207:
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(1);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_http__ = __webpack_require__(63);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_Rx__ = __webpack_require__(270);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_Rx___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_Rx__);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__principal__ = __webpack_require__(210);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AppComponent; });
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var AppComponent = (function () {
|
||||
function AppComponent(http) {
|
||||
this.http = http;
|
||||
this.credentials = {
|
||||
username: '',
|
||||
password: ''
|
||||
};
|
||||
this.principal = new __WEBPACK_IMPORTED_MODULE_3__principal__["a" /* Principal */](false, []);
|
||||
}
|
||||
AppComponent.prototype.ngOnInit = function () {
|
||||
};
|
||||
AppComponent.prototype.onLogin = function (form) {
|
||||
var _this = this;
|
||||
var headers = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["c" /* Headers */]({ 'Content-Type': 'application/json' });
|
||||
headers.append('Authorization', 'Basic ' + btoa(form.value.username + ':' + form.value.password));
|
||||
var options = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["b" /* RequestOptions */]({ headers: headers });
|
||||
this.http.get("/me", options)
|
||||
.map(function (response) { return response.json(); })
|
||||
.map(function (data) { return new __WEBPACK_IMPORTED_MODULE_3__principal__["a" /* Principal */](data.authenticated, data.authorities); })
|
||||
.subscribe(function (principal) {
|
||||
console.log(principal);
|
||||
_this.principal = principal;
|
||||
});
|
||||
};
|
||||
return AppComponent;
|
||||
}());
|
||||
AppComponent = __decorate([
|
||||
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Y" /* Component */])({
|
||||
selector: 'app-root',
|
||||
template: __webpack_require__(268),
|
||||
styles: [__webpack_require__(266)]
|
||||
}),
|
||||
__metadata("design:paramtypes", [typeof (_a = typeof __WEBPACK_IMPORTED_MODULE_1__angular_http__["e" /* Http */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_1__angular_http__["e" /* Http */]) === "function" && _a || Object])
|
||||
], AppComponent);
|
||||
|
||||
var _a;
|
||||
//# sourceMappingURL=app.component.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 208:
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_platform_browser__ = __webpack_require__(43);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__(1);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_forms__ = __webpack_require__(23);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_http__ = __webpack_require__(63);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__app_component__ = __webpack_require__(207);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__ng_bootstrap_ng_bootstrap__ = __webpack_require__(205);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__default_request_options__ = __webpack_require__(209);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AppModule; });
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var AppModule = (function () {
|
||||
function AppModule() {
|
||||
}
|
||||
return AppModule;
|
||||
}());
|
||||
AppModule = __decorate([
|
||||
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__angular_core__["b" /* NgModule */])({
|
||||
declarations: [
|
||||
__WEBPACK_IMPORTED_MODULE_4__app_component__["a" /* AppComponent */]
|
||||
],
|
||||
imports: [
|
||||
__WEBPACK_IMPORTED_MODULE_0__angular_platform_browser__["a" /* BrowserModule */],
|
||||
__WEBPACK_IMPORTED_MODULE_2__angular_forms__["a" /* FormsModule */],
|
||||
__WEBPACK_IMPORTED_MODULE_3__angular_http__["a" /* HttpModule */],
|
||||
__WEBPACK_IMPORTED_MODULE_5__ng_bootstrap_ng_bootstrap__["a" /* NgbModule */].forRoot()
|
||||
],
|
||||
providers: [{ provide: __WEBPACK_IMPORTED_MODULE_3__angular_http__["b" /* RequestOptions */], useClass: __WEBPACK_IMPORTED_MODULE_6__default_request_options__["a" /* DefaultRequestOptions */] }],
|
||||
bootstrap: [__WEBPACK_IMPORTED_MODULE_4__app_component__["a" /* AppComponent */]]
|
||||
})
|
||||
], AppModule);
|
||||
|
||||
//# sourceMappingURL=app.module.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 209:
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(1);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_http__ = __webpack_require__(63);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DefaultRequestOptions; });
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Created by tschi on 4/16/2017.
|
||||
*/
|
||||
var DefaultRequestOptions = (function (_super) {
|
||||
__extends(DefaultRequestOptions, _super);
|
||||
function DefaultRequestOptions() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.headers = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["c" /* Headers */]({
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
return DefaultRequestOptions;
|
||||
}(__WEBPACK_IMPORTED_MODULE_1__angular_http__["d" /* BaseRequestOptions */]));
|
||||
DefaultRequestOptions = __decorate([
|
||||
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["c" /* Injectable */])()
|
||||
], DefaultRequestOptions);
|
||||
|
||||
//# sourceMappingURL=default-request-options.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 210:
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Principal; });
|
||||
/* unused harmony export Authority */
|
||||
/**
|
||||
* Created by tschi on 4/16/2017.
|
||||
*/
|
||||
var Principal = (function () {
|
||||
function Principal(authenticated, authorities) {
|
||||
var _this = this;
|
||||
this.authorities = [];
|
||||
this.authenticated = authenticated;
|
||||
authorities.map(function (auth) { return _this.authorities.push(new Authority(auth.authority)); });
|
||||
}
|
||||
Principal.prototype.isAdmin = function () {
|
||||
return this.authorities.some(function (auth) { return auth.authority.indexOf('ADMIN') > -1; });
|
||||
};
|
||||
return Principal;
|
||||
}());
|
||||
|
||||
var Authority = (function () {
|
||||
function Authority(authority) {
|
||||
this.authority = authority;
|
||||
}
|
||||
return Authority;
|
||||
}());
|
||||
|
||||
//# sourceMappingURL=principal.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 211:
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return environment; });
|
||||
// The file contents for the current environment will overwrite these during build.
|
||||
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
|
||||
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
|
||||
// The list of which env maps to which file can be found in `.angular-cli.json`.
|
||||
// The file contents for the current environment will overwrite these during build.
|
||||
var environment = {
|
||||
production: false
|
||||
};
|
||||
//# sourceMappingURL=environment.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 266:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
exports = module.exports = __webpack_require__(50)();
|
||||
// imports
|
||||
|
||||
|
||||
// module
|
||||
exports.push([module.i, "", ""]);
|
||||
|
||||
// exports
|
||||
|
||||
|
||||
/*** EXPORTS FROM exports-loader ***/
|
||||
module.exports = module.exports.toString();
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 268:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = "<nav class=\"navbar navbar-toggleable-md navbar-inverse fixed-top bg-inverse\">\n <button class=\"navbar-toggler navbar-toggler-right\" type=\"button\" data-toggle=\"collapse\" data-target=\"#navbarCollapse\" aria-controls=\"navbarCollapse\" aria-expanded=\"false\" aria-label=\"Toggle navigation\">\n <span class=\"navbar-toggler-icon\"></span>\n </button>\n <a class=\"navbar-brand\" href=\"#\">Book Rater</a>\n <div class=\"collapse navbar-collapse\" id=\"navbarCollapse\">\n <ul class=\"navbar-nav mr-auto\">\n </ul>\n <div *ngIf=\"!principal.authenticated; then loginForm else loginMessage\"></div>\n <ng-template #loginForm>\n <form (ngSubmit)=\"onLogin(f)\" class=\"form-inline mt-2 mt-md-0\" #f=\"ngForm\">\n <input name=\"username\" [(ngModel)]=\"credentials.username\" required class=\"form-control mr-sm-2\" type=\"text\" placeholder=\"Username\">\n <input name=\"password\" [(ngModel)]=\"credentials.password\" required class=\"form-control mr-sm-2\" type=\"password\" placeholder=\"Password\">\n <button class=\"btn btn-outline-success my-2 my-sm-0\" type=\"submit\" [disabled]=\"!f.valid\">Login</button>\n </form>\n </ng-template>\n <ng-template #loginMessage>\n <button type=\"button\" class=\"btn btn-link\">Logout</button>\n </ng-template>\n\n </div>\n</nav>\n\n<div class=\"container\">\n <div class=\"jumbotron\">\n <h1>Book Rater App</h1>\n <p class=\"lead\">Keep track of all the latest books and their ratings.</p>\n </div>\n\n</div>\n"
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 538:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = __webpack_require__(197);
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
},[538]);
|
||||
//# sourceMappingURL=main.bundle.js.map
|
||||
+4636
File diff suppressed because it is too large
Load Diff
+407
File diff suppressed because one or more lines are too long
+82098
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user