This repository was archived by the owner on Feb 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +44
-19
lines changed Expand file tree Collapse file tree 5 files changed +44
-19
lines changed Original file line number Diff line number Diff line change 11< h3 >
2- Angular 2 Seed
2+ Angular/Adal.js Seed
33</ h3 >
4- < nav >
5- < a [routerLink] ="['/'] ">
4+
5+ < nav id ="unsecured-nav " *ngIf ="!adalService.userInfo ">
6+ < a [routerLink] ="['/'] ">
67 Login
7- </ a >
8+ </ a >
89 |
9- < a [routerLink] ="['/home'] ">
10- Home
11- </ a >
12- |
13- < a [routerLink] ="['/about'] ">
10+ < a [routerLink] ="['/about'] ">
1411 About
15- </ a >
12+ </ a >
1613 |
17- < a [routerLink] ="['/github', 'angular '] ">
18- Github Repos
14+ < a [routerLink] ="['/contact '] ">
15+ Contact Us
1916 </ a >
17+ </ nav >
18+
19+ < nav id ="secured-nav " *ngIf ="adalService.userInfo ">
20+ < a [routerLink] ="['/home'] ">
21+ Home
22+ </ a >
2023 |
21- < a [routerLink] ="['/contact '] ">
22- Contact Us
24+ < a [routerLink] ="['/values '] ">
25+ Values API
2326 </ a >
2427</ nav >
2528
2629< main >
27- < router-outlet > </ router-outlet >
30+ < router-outlet > </ router-outlet >
2831</ main >
2932
30-
33+ < br />
3134< footer >
3235 © 2016
33- </ footer >
36+ </ footer >
Original file line number Diff line number Diff line change 1+ import { AdalService } from './services/adal.service' ;
12import { Component } from '@angular/core' ;
23
34@Component ( {
45 selector : 'app' ,
56 templateUrl : './app.component.html' ,
67} )
78export class AppComponent {
9+ constructor ( private adalService : AdalService ) {
10+
11+ }
812}
Original file line number Diff line number Diff line change 11< h3 > Home Component</ h3 >
2- < p > Welcome to Angular Seed</ p >
2+ < h2 > Welcome {{adalService.userInfo.userName}}!</ h2 >
3+
4+ < div *ngIf ="isLoggedIn ">
5+ < button (click) ="logout() "> Logout</ button >
6+ </ div >
7+ < br >
Original file line number Diff line number Diff line change @@ -13,4 +13,12 @@ export class HomeComponent {
1313 console . log ( 'JWT Token' ) ;
1414 console . log ( this . adalService . accessToken ) ;
1515 }
16+
17+ logout ( ) {
18+ this . adalService . logout ( ) ;
19+ }
20+
21+ public get isLoggedIn ( ) {
22+ return this . adalService . isAuthenticated ;
23+ }
1624}
Original file line number Diff line number Diff line change 1- < h2 > Values from ValueController</ h2 >
21
2+ < h3 >
3+ < p > In order to test this component, you must run the API located < a href ="https://github.com/vsaroopchand/angular2-seed-server "> here</ a > .</ p >
4+ < p > This demonstrates how to pass the JWT token to a WebAPI and revalidating it there.</ p >
5+ </ h3 >
6+
7+ < h2 > Values from ValueController</ h2 >
38< ul >
49 < li *ngFor ="let value of values$ | async "> {{value}}</ li >
510</ ul >
You can’t perform that action at this time.
0 commit comments