-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change Angular auth oidc clients (#10)
- Loading branch information
1 parent
a7222cd
commit f7e2a3d
Showing
13 changed files
with
154 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
ClientApp/ClientApp/app/components/callback/callback.component.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 38 additions & 25 deletions
63
ClientApp/ClientApp/app/components/navmenu/navmenu.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,45 @@ | ||
import { Component } from '@angular/core'; | ||
import { AuthService } from '../services/auth.service' | ||
import { GlobalEventsManager } from '../services/global.events.manager' | ||
import { Component, OnInit, OnDestroy } from '@angular/core'; | ||
import { Subscription } from 'rxjs/Subscription'; | ||
|
||
import { AuthService } from '../services/auth.service'; | ||
|
||
|
||
@Component({ | ||
selector: 'nav-menu', | ||
templateUrl: './navmenu.component.html', | ||
styleUrls: ['./navmenu.component.css'] | ||
}) | ||
export class NavMenuComponent { | ||
public _loggedIn: boolean = false; | ||
|
||
constructor ( | ||
private _authService: AuthService, | ||
private _globalEventsManager: GlobalEventsManager) { | ||
_globalEventsManager.showNavBarEmitter.subscribe((mode)=>{ | ||
// mode will be null the first time it is created, so you need to igonore it when null | ||
if (mode !== null) { | ||
console.log("Global Event, sent: " + mode); | ||
this._loggedIn = mode; | ||
} | ||
}); | ||
} | ||
|
||
public login(){ | ||
this._authService.startSigninMainWindow(); | ||
} | ||
|
||
public logout(){ | ||
this._authService.startSignoutMainWindow(); | ||
} | ||
export class NavMenuComponent implements OnInit, OnDestroy { | ||
isAuthorizedSubscription: Subscription; | ||
isAuthorized: boolean; | ||
|
||
constructor(public authService: AuthService) { | ||
} | ||
|
||
ngOnInit() { | ||
this.isAuthorizedSubscription = this.authService.getIsAuthorized().subscribe( | ||
(isAuthorized: boolean) => { | ||
this.isAuthorized = isAuthorized; | ||
}); | ||
|
||
if (window.location.hash) { | ||
this.authService.authorizedCallback(); | ||
} | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.isAuthorizedSubscription.unsubscribe(); | ||
} | ||
|
||
public login() { | ||
this.authService.login(); | ||
} | ||
|
||
public refreshSession() { | ||
this.authService.refreshSession(); | ||
} | ||
|
||
public logout() { | ||
this.authService.logout(); | ||
} | ||
} |
20 changes: 0 additions & 20 deletions
20
ClientApp/ClientApp/app/components/services/auth-guard.service.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.