diff --git a/package-lock.json b/package-lock.json index 897376b..2ca7474 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1943,9 +1943,9 @@ } }, "@farmmaps/common": { - "version": "0.0.1-prerelease.91", - "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common/-/common-0.0.1-prerelease.91.tgz", - "integrity": "sha512-VNhuNqk5CG8ha7fCK7zcVEaqQNp3KUiInuiXE6AnoRcteA9kixcy//yLIjFr3EXGISIOo6MonThJhvFT+GNeyQ==", + "version": "0.0.1-prerelease.95", + "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common/-/common-0.0.1-prerelease.95.tgz", + "integrity": "sha512-PETioME5FcknpL5HNvh2mfjo4/DFnbCRWjZZfRNIt7W4tunJ2UHFkQxkS2IvVTtbHFSK/qUrKB0wBCdySRx8ng==", "requires": { "angular-oauth2-oidc": "^8.0.2", "ngx-uploadx": "^3.3.2", @@ -1953,9 +1953,9 @@ } }, "@farmmaps/common-map": { - "version": "0.0.1-prerelease.91", - "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common-map/-/common-map-0.0.1-prerelease.91.tgz", - "integrity": "sha512-W8mdCRyLXC3YXbb21K8K6rgq2NVj+EB2oDNLJ1k/UdvLxr+KWlqjRsIh358+cul5VvtLGRqnfiU5oiKHhVGP0A==", + "version": "0.0.1-prerelease.95", + "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common-map/-/common-map-0.0.1-prerelease.95.tgz", + "integrity": "sha512-VFKe+P19aJ/gBu0dvhBt/w9VdNmfrWsvYgISZo26M+PEt6hgKW6P9Yyrp8ha64eCWgGGtaDQcwGWLFOHhmP/0w==", "requires": { "ngx-openlayers": "1.0.0-next.13", "ol": "^6.0.0", diff --git a/package.json b/package.json index 3c4da70..0e8a827 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,8 @@ "@angular/platform-browser-dynamic": "~8.2.14", "@angular/router": "~8.2.14", "@aspnet/signalr": "^1.1.4", - "@farmmaps/common": ">=0.0.1-prerelease.91 <0.0.1", - "@farmmaps/common-map": ">=0.0.1-prerelease.91 <0.0.1", + "@farmmaps/common": ">=0.0.1-prerelease.95 <0.0.1", + "@farmmaps/common-map": ">=0.0.1-prerelease.95 <0.0.1", "@ng-bootstrap/ng-bootstrap": "^4.2.1", "@ngrx/effects": "^8.2.0", "@ngrx/router-store": "^8.2.0", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 79f2c81..0d60d8f 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -6,7 +6,7 @@ import { } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; -import { AppCommonModule,AppCommonServiceModule } from '@farmmaps/common'; +import { AppCommonModule,AppCommonServiceModule,AuthConfigFactory } from '@farmmaps/common'; import { AppCommonMapModule} from '@farmmaps/common-map'; import {AppRootComponent} from './app.component'; @@ -18,6 +18,8 @@ import { StoreRouterConnectingModule} from '@ngrx/router-store'; import {AppRoutingModule} from './app-routing.module'; import { LogoComponent } from './logo/logo.component'; import { MenuComponent } from './menu/menu.component'; +import { LocalAuthconfigFactory} from './localAuthconfigFactory'; +import { AuthConfig } from 'angular-oauth2-oidc'; export const BOOTSTRAP_EFFECTS = new InjectionToken('Bootstrap Effects'); @@ -59,7 +61,13 @@ export function provideBootstrapEffects(effects: Type[]) { StoreModule.forRoot({}), EffectsModule.forRoot([]) ], - providers: [], + providers: [ + AuthConfigFactory + // { + // provide:AuthConfigFactory, + // useClass:LocalAuthconfigFactory + // } + ], bootstrap: [AppRootComponent] }) export class AppModule { } diff --git a/src/app/localAuthconfigFactory.ts b/src/app/localAuthconfigFactory.ts new file mode 100644 index 0000000..d1b568f --- /dev/null +++ b/src/app/localAuthconfigFactory.ts @@ -0,0 +1,22 @@ +import {IAuthconfigFactory,AppConfig} from '@farmmaps/common'; +import {AuthConfig} from 'angular-oauth2-oidc'; + +export class LocalAuthconfigFactory implements IAuthconfigFactory { + getAuthConfig(appConfig:AppConfig): AuthConfig { + let authConfig: AuthConfig = new AuthConfig(); + authConfig.issuer = appConfig.getConfig("issuer"); + authConfig.redirectUri = window.location.origin + "/cb"; + authConfig.silentRefreshRedirectUri = window.location.origin + "/silent-refresh.html"; + authConfig.clientId = appConfig.getConfig("clientId"); + authConfig.customQueryParams = { audience: appConfig.getConfig("audience") }; + authConfig.scope = "openid profile email"; + authConfig.oidc = true; + authConfig.disableAtHashCheck = true; + authConfig.openUri = uri => { + window.alert("OK "+uri); + } + authConfig.requireHttps = appConfig.getConfig("requireHttps"); + return authConfig; + } + +} \ No newline at end of file