diff --git a/src/app/shared/components/partyManagement/edit-individuals/edit-individuals.component.ts b/src/app/shared/components/partyManagement/edit-individuals/edit-individuals.component.ts index ca79f4703fbdac52ad673c71313ea70e7df79388..337b3f993455a4539307c0fa25ce38ef7e26c9a9 100644 --- a/src/app/shared/components/partyManagement/edit-individuals/edit-individuals.component.ts +++ b/src/app/shared/components/partyManagement/edit-individuals/edit-individuals.component.ts @@ -214,7 +214,6 @@ export class EditIndividualsComponent implements OnInit { } ) } - // this.updateGeographicSite(); } refreshIndividual(updatedIndividual: Individual) { @@ -223,7 +222,6 @@ export class EditIndividualsComponent implements OnInit { if(this.testbedProvider) { this.retrieveGeographicSite() } - console.log("TODO-Retrieve Geographic Site info as well")//TODO } retrieveGeographicSite(){ diff --git a/src/app/shared/components/redirect/redirect.component.ts b/src/app/shared/components/redirect/redirect.component.ts index fcd895044411d489a2e20109f09e661d6cf4490c..aabf2086ed147c00750108530f0f8935b6d6ca38 100644 --- a/src/app/shared/components/redirect/redirect.component.ts +++ b/src/app/shared/components/redirect/redirect.component.ts @@ -17,46 +17,24 @@ export class RedirectComponent implements OnInit { ) { } ngOnInit() { - // this.authService.fetchIndividualInfo(); - let isTestbedProvider = false; - if(this.authService != null && this.authService.portalUserJWT !=null) { - for(var val of this.authService.portalUserJWT.realm_access.roles){ - if (val ==='TESTBED_PROVIDER') { - isTestbedProvider=true - } - }} - //TODO insert redirection logic + const activePortal = localStorage.getItem('active_portal') if (activePortal === 'services') { - if (isTestbedProvider){ - this.router.navigate(['services', 'individual_update']) - } - else { - // this.router.navigate(['services', 'services_marketplace']) this.router.navigate(['services', 'individual_update']) - } } else if (activePortal === 'resources') { this.router.navigate(['resources', 'resource_catalogs']) } else if (activePortal === 'testing') { - if (isTestbedProvider){ this.router.navigate(['testing', 'individual_update']) - } else { - this.router.navigate(['testing', 'service_test_specs']) - } } else if (activePortal === 'products') { - if (isTestbedProvider){ this.router.navigate(['products', 'individual_update']) - } else { - this.router.navigate(['products', 'marketplace']) - } } else { diff --git a/src/app/shared/services/auth.service.ts b/src/app/shared/services/auth.service.ts index d2227e4fe99ef92476695adfd3c921f6536807fd..b233d46ed3a5eb3ffa44e9a6cfa4b976836356f7 100644 --- a/src/app/shared/services/auth.service.ts +++ b/src/app/shared/services/auth.service.ts @@ -37,12 +37,12 @@ export class AuthService { public portalUser: Individual public portalUserJWT: userFromJWT - constructor( + constructor( private oauthService: OAuthService, private router: Router, private bootstrapService: BootstrapService, private individualService: IndividualService - ) + ) { window.addEventListener('storage', (event) => { // The `key` is `null` if the event was caused by `.clear()` @@ -77,7 +77,7 @@ export class AuthService { public runInitialLoginSequence() { this.authConfigFile = this.bootstrapService.getConfig().OAUTH_CONFIG - + this.oauthService.configure(this.authConfigFile); this.oauthService.setStorage(localStorage); @@ -88,15 +88,15 @@ export class AuthService { this.oauthService.tryLoginCodeFlow() .catch(error => console.error(error)) .then( - () => { + () => { // console.warn('AccessTokenExpiration : ', new Date(this.oauthService.getAccessTokenExpiration()).toUTCString()); if (this.oauthService.hasValidAccessToken()) { // console.warn('this.oauthService.hasValidAccessToken() === true') this.isAuthenticatedSubject$.next(this.oauthService.hasValidAccessToken()); return Promise.resolve(); - } - + } + //If Silent LOGIN isn't implemented else { // console.warn('this.oauthService.hasValidAccessToken() === false') @@ -108,12 +108,12 @@ export class AuthService { this.isDoneLoadingSubject$.next(true) } ) - .catch( error => { + .catch( error => { this.isDoneLoadingSubject$.next(true) }) } - + public fetchUserInfo() { this.portalUserJWT = decode(this.getAccessToken()) this.individualService.retrieveIndividual({id:'myuser'}).subscribe( @@ -126,23 +126,11 @@ export class AuthService { ) } - public fetchIndividualInfo() { - // this.portalUserJWT = decode(this.getAccessToken()) - this.individualService.retrieveIndividual({id:'myuser'}).subscribe( - data => { this.portalUser = data }, - error => { - console.error(error) - // this.toast.error('An error occurred fetching user information') - // this.logout() - } - ) - } - public login() { this.oauthService.initCodeFlow() } - public logout() { + public logout() { // this.http.delete(authConfig.tokenEndpoint).subscribe( // data => console.log(data) // ) @@ -150,7 +138,7 @@ export class AuthService { localStorage.clear() // this.http.delete(this.authConfigFile.tokenEndpoint).subscribe( - // data => { + // data => { // console.warn(data) // this.oauthService.logOut() // this.router.navigate([this.router.routerState.snapshot.url]) @@ -158,7 +146,7 @@ export class AuthService { // error => { // console.error(error) // this.oauthService.logOut() - // this.router.navigate([this.router.routerState.snapshot.url]) + // this.router.navigate([this.router.routerState.snapshot.url]) // } // ) }