diff --git a/src/Web/WebSPA/eShopOnContainers.WebSPA/Client/modules/app.component.html b/src/Web/WebSPA/eShopOnContainers.WebSPA/Client/modules/app.component.html
index eeae6d0cd..e5fbb26c6 100644
--- a/src/Web/WebSPA/eShopOnContainers.WebSPA/Client/modules/app.component.html
+++ b/src/Web/WebSPA/eShopOnContainers.WebSPA/Client/modules/app.component.html
@@ -7,8 +7,8 @@
+
-
diff --git a/src/Web/WebSPA/eShopOnContainers.WebSPA/Client/modules/shared/components/identity/identity.html b/src/Web/WebSPA/eShopOnContainers.WebSPA/Client/modules/shared/components/identity/identity.html
index f1cfa47b9..cc2aafb45 100644
--- a/src/Web/WebSPA/eShopOnContainers.WebSPA/Client/modules/shared/components/identity/identity.html
+++ b/src/Web/WebSPA/eShopOnContainers.WebSPA/Client/modules/shared/components/identity/identity.html
@@ -1 +1,2 @@
-
+
+userName: {{userName}}
diff --git a/src/Web/WebSPA/eShopOnContainers.WebSPA/Client/modules/shared/components/identity/identity.ts b/src/Web/WebSPA/eShopOnContainers.WebSPA/Client/modules/shared/components/identity/identity.ts
index 1e5fee902..9b8d8352b 100644
--- a/src/Web/WebSPA/eShopOnContainers.WebSPA/Client/modules/shared/components/identity/identity.ts
+++ b/src/Web/WebSPA/eShopOnContainers.WebSPA/Client/modules/shared/components/identity/identity.ts
@@ -1,4 +1,5 @@
import { Component, OnInit, OnChanges, Output, Input, EventEmitter } from '@angular/core';
+import { Subscription } from 'rxjs/Subscription';
import { IIdentity } from '../../models/identity.model';
import { SecurityService } from '../../services/security.service';
@@ -9,22 +10,26 @@ import { SecurityService } from '../../services/security.service';
styleUrls: ['./identity.scss']
})
export class Identity implements OnInit {
- constructor(private service: SecurityService) {
- }
+ private authenticated: boolean = false;
+ private subscription: Subscription;
+ private userName: string = "";
- @Output()
- changed: EventEmitter = new EventEmitter();
+ constructor(private service: SecurityService) {
- @Input()
- model: IIdentity;
+ }
ngOnInit() {
- console.log("ngOnInit _securityService.AuthorizedCallback");
+ this.subscription = this.service.authenticationChallenge$.subscribe(res =>
+ {
+ //console.log(res);
+ //console.log(this.service.UserData);
+ //console.log(this.service);
+ this.authenticated = res;
+ this.userName = this.service.UserData.email;
+ });
if (window.location.hash) {
this.service.AuthorizedCallback();
- console.log('isAutorized?');
- console.log(this.service.IsAuthorized);
}
}
diff --git a/src/Web/WebSPA/eShopOnContainers.WebSPA/Client/modules/shared/services/security.service.ts b/src/Web/WebSPA/eShopOnContainers.WebSPA/Client/modules/shared/services/security.service.ts
index 8f4776cb6..32756c0cd 100644
--- a/src/Web/WebSPA/eShopOnContainers.WebSPA/Client/modules/shared/services/security.service.ts
+++ b/src/Web/WebSPA/eShopOnContainers.WebSPA/Client/modules/shared/services/security.service.ts
@@ -16,22 +16,17 @@ export class SecurityService {
authenticationChallenge$ = this.authenticationSource.asObservable();
constructor(private _http: Http, private _router: Router) {
-
- //this.actionUrl = _configuration.Server + 'api/DataEventRecords/';
-
this.headers = new Headers();
this.headers.append('Content-Type', 'application/json');
this.headers.append('Accept', 'application/json');
this.storage = sessionStorage; //localStorage;
if (this.retrieve("IsAuthorized") !== "") {
- //this.HasAdminRole = this.retrieve("HasAdminRole");
this.IsAuthorized = this.retrieve("IsAuthorized");
}
}
public IsAuthorized: boolean;
- //public HasAdminRole: boolean;
public GetToken(): any {
return this.retrieve("authorizationData");
@@ -42,8 +37,6 @@ export class SecurityService {
this.store("authorizationDataIdToken", "");
this.IsAuthorized = false;
- //this.HasAdminRole = false;
- this.store("HasAdminRole", false);
this.store("IsAuthorized", false);
}
@@ -57,11 +50,13 @@ export class SecurityService {
this.store("authorizationDataIdToken", id_token);
this.IsAuthorized = true;
this.store("IsAuthorized", true);
- //emit observable
- this.authenticationSource.next(true);
this.getUserData()
- .subscribe(data => this.UserData = data,
+ .subscribe(data => {
+ this.UserData = data;
+ //emit observable
+ this.authenticationSource.next(true);
+ },
error => this.HandleError(error),
() => {
console.log(this.UserData);
@@ -71,8 +66,6 @@ export class SecurityService {
public Authorize() {
this.ResetAuthorizationData();
- console.log("BEGIN Authorize, no auth data");
-
var authorizationUrl = 'http://localhost:5105/connect/authorize';
var client_id = 'js';
var redirect_uri = 'http://localhost:5104/';
@@ -83,7 +76,6 @@ export class SecurityService {
this.store("authStateControl", state);
this.store("authNonce", nonce);
- console.log("AuthorizedController created. adding myautostate: " + this.retrieve("authStateControl"));
var url =
authorizationUrl + "?" +
@@ -98,7 +90,6 @@ export class SecurityService {
}
public AuthorizedCallback() {
- console.log("BEGIN AuthorizedCallback, no auth data");
this.ResetAuthorizationData();
var hash = window.location.hash.substr(1);
@@ -110,7 +101,6 @@ export class SecurityService {
}, {});
console.log(result);
- console.log("AuthorizedCallback created, begin token validation");
var token = "";
var id_token = "";
diff --git a/src/Web/WebSPA/eShopOnContainers.WebSPA/project.json b/src/Web/WebSPA/eShopOnContainers.WebSPA/project.json
index dda51e55a..356ae60c3 100644
--- a/src/Web/WebSPA/eShopOnContainers.WebSPA/project.json
+++ b/src/Web/WebSPA/eShopOnContainers.WebSPA/project.json
@@ -39,8 +39,8 @@
},
"tools": {
"Microsoft.DotNet.Watcher.Tools": {
- "version": "1.0.0-*",
- "imports": "portable-net451+win8"
+ "version": "1.0.0-preview2-final",
+ "imports": "portable-net451+win8+dnxcore50"
},
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",