Added OAuth sample code: https://github.com/jeroenheijmans/sample-angular-oauth2-oidc-with-auth-guards
This commit is contained in:
@@ -1,18 +1,51 @@
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { OAuthModule, OAuthStorage } from 'angular-oauth2-oidc';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AppComponent } from './app.component';
|
||||
import { APP_ROUTES } from './app.routes';
|
||||
import { BASE_URL } from './app.tokens';
|
||||
import { FlightHistoryComponent } from './flight-history/flight-history.component';
|
||||
import { HomeComponent } from './home/home.component';
|
||||
import { SharedModule } from './shared/shared.module';
|
||||
import { RouterModule, ExtraOptions } from '@angular/router';
|
||||
import { useHash } from '../flags';
|
||||
|
||||
const ROUTING_OPTIONS: ExtraOptions = {
|
||||
// preloadingStrategy: CustomPreloadingStrategy,
|
||||
useHash,
|
||||
initialNavigation: 'enabled'
|
||||
};
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
AppRoutingModule
|
||||
RouterModule.forRoot(APP_ROUTES, ROUTING_OPTIONS),
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
HttpClientModule,
|
||||
SharedModule.forRoot(),
|
||||
OAuthModule.forRoot({
|
||||
resourceServer: {
|
||||
allowedUrls: ['http://www.angular.at/api'],
|
||||
sendAccessToken: true
|
||||
}
|
||||
})
|
||||
],
|
||||
declarations: [
|
||||
AppComponent,
|
||||
HomeComponent,
|
||||
FlightHistoryComponent
|
||||
],
|
||||
providers: [
|
||||
// (useHash) ? { provide: LocationStrategy, useClass: HashLocationStrategy } : [],
|
||||
// {provide: AuthConfig, useValue: authConfig },
|
||||
// { provide: OAuthStorage, useValue: localStorage },
|
||||
// { provide: ValidationHandler, useClass: JwksValidationHandler },
|
||||
{ provide: BASE_URL, useValue: 'http://www.angular.at' }
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
||||
export class AppModule {}
|
||||
|
||||
Reference in New Issue
Block a user