Compare commits
No commits in common. "6389331c30eba5799fe6724f2663a9e1da8c24bb" and "313e0c94f73482432f4857819a6a547bb4d20a56" have entirely different histories.
6389331c30
...
313e0c94f7
@ -1,17 +1,10 @@
|
|||||||
// angular modules
|
// angular modules
|
||||||
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector, Optional, SkipSelf } from '@angular/core';
|
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector, Optional, SkipSelf } from '@angular/core';
|
||||||
import { CommonModule, DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
|
import { HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||||
import { FormsModule } from '@angular/forms';
|
|
||||||
|
|
||||||
// external modules
|
// external modules
|
||||||
import { OAuthModule,AuthConfig, OAuthService, OAuthStorage } from 'angular-oauth2-oidc';
|
import { OAuthModule, OAuthService } from 'angular-oauth2-oidc';
|
||||||
|
|
||||||
|
|
||||||
// routing module
|
|
||||||
import { AppCommonRoutingModule } from './common-routing.module';
|
|
||||||
|
|
||||||
import { MODULE_NAME } from './module-name';
|
|
||||||
|
|
||||||
//components
|
//components
|
||||||
import { ItemTypeService } from './services/itemtype.service';
|
import { ItemTypeService } from './services/itemtype.service';
|
||||||
@ -27,40 +20,21 @@ import { appConfigFactory } from "./shared/app.config.factory";
|
|||||||
import { AuthGuard } from './services/auth-guard.service';
|
import { AuthGuard } from './services/auth-guard.service';
|
||||||
import { NavBarGuard } from './services/nav-bar-guard.service';
|
import { NavBarGuard } from './services/nav-bar-guard.service';
|
||||||
import { FullScreenGuard } from './services/full-screen-guard.service';
|
import { FullScreenGuard } from './services/full-screen-guard.service';
|
||||||
import { SafePipe } from './shared/safe.pipe';
|
|
||||||
import { AppComponent} from './components/app/app.component';
|
|
||||||
import { AuthCallbackComponent } from './components/auth-callback/auth-callback.component';
|
|
||||||
import { AuthCallbackGuard } from './components/auth-callback/auth-callback.guard';
|
import { AuthCallbackGuard } from './components/auth-callback/auth-callback.guard';
|
||||||
import { SessionClearedComponent } from './components/session-cleared/session-cleared.component';
|
|
||||||
import { ResumableFileUploadService } from './components/resumable-file-upload/resumable-file-upload.service';
|
import { ResumableFileUploadService } from './components/resumable-file-upload/resumable-file-upload.service';
|
||||||
import { ResumableFileUploadComponent } from './components/resumable-file-upload/resumable-file-upload.component';
|
|
||||||
import { NotFoundComponent } from './components/not-found/not-found.component';
|
|
||||||
import { NotImplementedComponent } from './components/not-implemented/not-implemented.component';
|
|
||||||
import { SidePanelComponent } from './components/side-panel/side-panel.component';
|
|
||||||
import { TimespanComponent } from './components/timespan/timespan.component';
|
|
||||||
import { TagInputComponent } from './components/tag-input/tag-input.component';
|
|
||||||
import {IEventMessage } from './models/event.message';
|
|
||||||
import { IItem, Item } from './models/item';
|
|
||||||
import {IItemType} from './models/item.type';
|
|
||||||
import {IItemTypes} from './models/item.types';
|
|
||||||
import {IItemTask,ItemTask} from './models/itemTask';
|
|
||||||
import {IListItem} from './models/list.item';
|
|
||||||
import {ITypeaheadItem} from './models/typeahead.item';
|
|
||||||
import {IUser} from './models/user';
|
|
||||||
import * as commonActions from './actions/app-common.actions';
|
|
||||||
import * as commonReducers from './reducers/app-common.reducer';
|
|
||||||
import * as commonEffects from './effects/app-common.effects';
|
|
||||||
import { NgbDateNativeAdapter } from './services/date-adapter.service'
|
import { NgbDateNativeAdapter } from './services/date-adapter.service'
|
||||||
import { from } from 'rxjs';
|
|
||||||
import { AuthConfigFactory } from './shared/authconfigFactory';
|
import { AuthConfigFactory } from './shared/authconfigFactory';
|
||||||
|
import { CodeListItemService } from './services/codelistitem.service';
|
||||||
|
|
||||||
export {FolderService,
|
export {
|
||||||
|
FolderService,
|
||||||
ItemTypeService,
|
ItemTypeService,
|
||||||
TimespanService,
|
TimespanService,
|
||||||
ItemService,
|
ItemService,
|
||||||
EventService,
|
EventService,
|
||||||
TypeaheadService,
|
TypeaheadService,
|
||||||
UserService,
|
UserService,
|
||||||
|
CodeListItemService,
|
||||||
AppConfig,
|
AppConfig,
|
||||||
AccessTokenInterceptor,
|
AccessTokenInterceptor,
|
||||||
AuthGuard,
|
AuthGuard,
|
||||||
@ -91,7 +65,7 @@ export class AppCommonServiceModule {
|
|||||||
{
|
{
|
||||||
provide: APP_INITIALIZER,
|
provide: APP_INITIALIZER,
|
||||||
useFactory: appConfigFactory,
|
useFactory: appConfigFactory,
|
||||||
deps: [Injector, AppConfig, OAuthService,AuthConfigFactory,OAuthStorage],
|
deps: [Injector, AppConfig, OAuthService, AuthConfigFactory],
|
||||||
multi: true
|
multi: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,6 @@ import { ICodeListItem } from './models/code.list.item';
|
|||||||
import * as commonActions from './actions/app-common.actions';
|
import * as commonActions from './actions/app-common.actions';
|
||||||
import * as commonReducers from './reducers/app-common.reducer';
|
import * as commonReducers from './reducers/app-common.reducer';
|
||||||
import * as commonEffects from './effects/app-common.effects';
|
import * as commonEffects from './effects/app-common.effects';
|
||||||
import { SecureOAuthStorage} from './shared/secureOAuthStorage';
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
SafePipe,
|
SafePipe,
|
||||||
@ -70,8 +69,7 @@ export {
|
|||||||
commonReducers,
|
commonReducers,
|
||||||
IAuthconfigFactory,
|
IAuthconfigFactory,
|
||||||
AuthConfigFactory,
|
AuthConfigFactory,
|
||||||
MenuBackgroundComponent,
|
MenuBackgroundComponent
|
||||||
SecureOAuthStorage
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
import { Injector } from '@angular/core';
|
import { Injector } from '@angular/core';
|
||||||
import { Location} from '@angular/common';
|
import { Location} from '@angular/common';
|
||||||
import { Router,UrlSerializer } from '@angular/router';
|
import { Router,UrlSerializer } from '@angular/router';
|
||||||
import { AuthConfig, OAuthService, JwksValidationHandler, OAuthErrorEvent, OAuthStorage } from 'angular-oauth2-oidc';
|
import { AuthConfig, OAuthService, JwksValidationHandler, OAuthErrorEvent } from 'angular-oauth2-oidc';
|
||||||
import { AppConfig } from "./app.config";
|
import { AppConfig } from "./app.config";
|
||||||
import { IAuthconfigFactory } from './authconfigFactory';
|
import { IAuthconfigFactory } from './authconfigFactory';
|
||||||
|
|
||||||
|
|
||||||
|
export function appConfigFactory(injector:Injector, appConfig: AppConfig, oauthService: OAuthService, authconfigFactory:IAuthconfigFactory): () => Promise<any> {
|
||||||
export function appConfigFactory(injector:Injector, appConfig: AppConfig, oauthService: OAuthService, authconfigFactory:IAuthconfigFactory,authStorage:OAuthStorage): () => Promise<any> {
|
|
||||||
return (): Promise<any> => {
|
return (): Promise<any> => {
|
||||||
return appConfig.load().then(() => {
|
return appConfig.load().then(() => {
|
||||||
oauthService.events.subscribe((event) => {
|
oauthService.events.subscribe((event) => {
|
||||||
@ -23,7 +22,7 @@ export function appConfigFactory(injector:Injector, appConfig: AppConfig, oauthS
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
oauthService.configure(authconfigFactory.getAuthConfig(appConfig));
|
oauthService.configure(authconfigFactory.getAuthConfig(appConfig));
|
||||||
oauthService.setStorage(authStorage);
|
oauthService.setStorage(localStorage);
|
||||||
oauthService.tokenValidationHandler = new JwksValidationHandler();
|
oauthService.tokenValidationHandler = new JwksValidationHandler();
|
||||||
oauthService.tokenValidationHandler.validateAtHash = function () {
|
oauthService.tokenValidationHandler.validateAtHash = function () {
|
||||||
return new Promise<boolean>((res) => { res(true); })
|
return new Promise<boolean>((res) => { res(true); })
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
import {OAuthStorage} from 'angular-oauth2-oidc';
|
|
||||||
import {Inject, Injectable} from '@angular/core';
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class SecureOAuthStorage extends OAuthStorage {
|
|
||||||
private storage = {};
|
|
||||||
|
|
||||||
secureKey(key:string): boolean {
|
|
||||||
if(key == "nonce") return false;
|
|
||||||
if(key == "PKCI_verifier") return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
getItem(key: string): string {
|
|
||||||
if(this.secureKey(key)) {
|
|
||||||
return this.storage[key];
|
|
||||||
} else {
|
|
||||||
return window.sessionStorage.getItem(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
removeItem(key: string): void {
|
|
||||||
if(this.secureKey(key)) {
|
|
||||||
delete this.storage[key];
|
|
||||||
} else {
|
|
||||||
window.sessionStorage.removeItem(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setItem(key: string, data: string): void {
|
|
||||||
if(this.secureKey(key)) {
|
|
||||||
this.storage[key]=data;
|
|
||||||
} else {
|
|
||||||
window.sessionStorage.setItem(key,data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -18,8 +18,8 @@ import { StoreRouterConnectingModule} from '@ngrx/router-store';
|
|||||||
import {AppRoutingModule} from './app-routing.module';
|
import {AppRoutingModule} from './app-routing.module';
|
||||||
import { LogoComponent } from './logo/logo.component';
|
import { LogoComponent } from './logo/logo.component';
|
||||||
import { MenuComponent } from './menu/menu.component';
|
import { MenuComponent } from './menu/menu.component';
|
||||||
import { SecureOAuthStorage} from '@farmmaps/common';
|
import { LocalAuthconfigFactory} from './localAuthconfigFactory';
|
||||||
import { OAuthStorage } from 'angular-oauth2-oidc';
|
import { AuthConfig } from 'angular-oauth2-oidc';
|
||||||
|
|
||||||
export const BOOTSTRAP_EFFECTS = new InjectionToken('Bootstrap Effects');
|
export const BOOTSTRAP_EFFECTS = new InjectionToken('Bootstrap Effects');
|
||||||
|
|
||||||
@ -62,11 +62,7 @@ export function provideBootstrapEffects(effects: Type<any>[]) {
|
|||||||
EffectsModule.forRoot([])
|
EffectsModule.forRoot([])
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
AuthConfigFactory,
|
AuthConfigFactory
|
||||||
{
|
|
||||||
provide:OAuthStorage,
|
|
||||||
useClass:SecureOAuthStorage
|
|
||||||
}
|
|
||||||
// {
|
// {
|
||||||
// provide:AuthConfigFactory,
|
// provide:AuthConfigFactory,
|
||||||
// useClass:LocalAuthconfigFactory
|
// useClass:LocalAuthconfigFactory
|
||||||
|
Loading…
Reference in New Issue
Block a user