1+
12import { Routes } from '@angular/router' ;
23
34import { AboutComponent } from './about/about.component' ;
@@ -6,15 +7,23 @@ import { RepoBrowserComponent } from './github/repo-browser/repo-browser.compone
67import { RepoListComponent } from './github/repo-list/repo-list.component' ;
78import { RepoDetailComponent } from './github/repo-detail/repo-detail.component' ;
89import { ContactComponent } from './contact/contact.component' ;
10+ import { LoginComponent } from './login/login.component' ;
11+ import { OAuthCallbackHandler } from './login-callback/oauth-callback.guard' ;
12+ import { OAuthCallbackComponent } from './login-callback/oauth-callback.component' ;
13+ import { AuthenticationGuard } from "./services/authenticated.guard" ;
914
1015export const rootRouterConfig : Routes = [
11- { path : '' , redirectTo : 'home ' , pathMatch : 'full' } ,
12- { path : 'home' , component : HomeComponent } ,
16+ { path : '' , redirectTo : 'login ' , pathMatch : 'full' } ,
17+ { path : 'home' , component : HomeComponent , canActivate : [ AuthenticationGuard ] } ,
1318 { path : 'about' , component : AboutComponent } ,
14- { path : 'github' , component : RepoBrowserComponent ,
19+ { path : 'login' , component : LoginComponent } ,
20+ { path : 'id_token' , component : OAuthCallbackComponent , canActivate : [ OAuthCallbackHandler ] } ,
21+ {
22+ path : 'github' , component : RepoBrowserComponent , canActivate : [ AuthenticationGuard ] ,
1523 children : [
1624 { path : '' , component : RepoListComponent } ,
17- { path : ':org' , component : RepoListComponent ,
25+ {
26+ path : ':org' , component : RepoListComponent ,
1827 children : [
1928 { path : '' , component : RepoDetailComponent } ,
2029 { path : ':repo' , component : RepoDetailComponent }
0 commit comments