More migration fixes

This commit is contained in:
Willem Dantuma 2020-04-01 16:11:44 +02:00
parent 511f1f4731
commit 80ddf816b0
10 changed files with 43 additions and 59 deletions

View File

@ -4,10 +4,10 @@
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"elm-pep": { "@openlayers/pepjs": {
"version": "1.0.6", "version": "0.5.3",
"resolved": "https://registry.npmjs.org/elm-pep/-/elm-pep-1.0.6.tgz", "resolved": "https://registry.npmjs.org/@openlayers/pepjs/-/pepjs-0.5.3.tgz",
"integrity": "sha512-1DJ6ReFk8+GtgoqRiEhBo28K69Rxe9Bfc7h16+1VMQT2KlCuPBYj5W33OYa2AZpqkuqCBLhcNzO10zxJVakapA==" "integrity": "sha512-Bgvi5c14BS0FJWyYWWFstNEnXsB30nK8Jt8hkAAdqr7E0gDdBBWVDglF3Ub19wTxvgJ/CVHyTY6VuCtnyRzglg=="
}, },
"ieee754": { "ieee754": {
"version": "1.1.13", "version": "1.1.13",
@ -23,11 +23,11 @@
} }
}, },
"ol": { "ol": {
"version": "6.2.1", "version": "6.1.1",
"resolved": "https://registry.npmjs.org/ol/-/ol-6.2.1.tgz", "resolved": "https://registry.npmjs.org/ol/-/ol-6.1.1.tgz",
"integrity": "sha512-CT2szew/COd7Zf9Bls+pdzewBYZNgyfxFivJ3L4Jv9Th7JdWjcQAT+pqMPH25L9SbVT+T17RCMq2H2m9uBCl1A==", "integrity": "sha512-0dL3i3eJqgOpqIjDKEY3grkeQnjAYfV5L/JCxhOu4SxiaizRwFrFgeas6LILRoxKa03jhQFbut2r2bbgcLGQeA==",
"requires": { "requires": {
"elm-pep": "^1.0.4", "@openlayers/pepjs": "^0.5.3",
"pbf": "3.2.1", "pbf": "3.2.1",
"pixelworks": "1.1.0", "pixelworks": "1.1.0",
"rbush": "^3.0.1" "rbush": "^3.0.1"

View File

@ -6,7 +6,7 @@
}, },
"dependencies": { "dependencies": {
"ngx-openlayers": "1.0.0-next.13", "ngx-openlayers": "1.0.0-next.13",
"ol": "6.2.1" "ol": "6.1.1"
}, },
"peerDependencies": { "peerDependencies": {
"@angular/core": "^9.1.0", "@angular/core": "^9.1.0",

View File

@ -22,7 +22,8 @@
"strictMetadataEmit": true, "strictMetadataEmit": true,
"fullTemplateTypeCheck": true, "fullTemplateTypeCheck": true,
"strictInjectionParameters": true, "strictInjectionParameters": true,
"enableResourceInlining": true "enableResourceInlining": true,
"enableIvy": false
}, },
"exclude": [ "exclude": [
"src/test.ts", "src/test.ts",

View File

@ -1,6 +0,0 @@
{
"extends": "./tsconfig.lib.json",
"angularCompilerOptions": {
"enableIvy": false
}
}

View File

@ -38,24 +38,19 @@ export class AuthGuard implements CanActivate, CanLoad, CanActivateChild {
checkLogin(url: string): boolean { checkLogin(url: string): boolean {
if (!this.oauthService.hasValidAccessToken()) { if (!this.oauthService.hasValidAccessToken()) {
this.oauthService.responseType if(this.oauthService.getRefreshToken() != null ) {
if(this.oauthService.responseType == "code") this.oauthService.refreshToken().then(() => {
if(this.oauthService.getRefreshToken() != null ) { this.store.dispatch(new appCommonActions.InitUser());
this.oauthService.refreshToken().then(() => { return true;
this.store.dispatch(new appCommonActions.InitUser()); }).catch(() => {
return true;
}).catch(() => {
this.oauthService.initCodeFlow(url);
return false;
}
)
} else {
this.oauthService.initCodeFlow(url); this.oauthService.initCodeFlow(url);
return false; return false;
} }
else )
this.oauthService.initImplicitFlow(url); } else {
this.oauthService.initCodeFlow(url);
return false; return false;
}
} else { } else {
this.store.dispatch(new appCommonActions.InitUser()); this.store.dispatch(new appCommonActions.InitUser());
return true; return true;

View File

@ -1,7 +1,7 @@
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, OAuthErrorEvent, OAuthStorage } from 'angular-oauth2-oidc';
import { AppConfig } from "./app.config"; import { AppConfig } from "./app.config";
import {ItemTypeService} from '../services/itemtype.service'; import {ItemTypeService} from '../services/itemtype.service';
import { IAuthconfigFactory } from './authconfigFactory'; import { IAuthconfigFactory } from './authconfigFactory';
@ -26,21 +26,12 @@ export function appConfigFactory(injector:Injector, appConfig: AppConfig, oauthS
}); });
oauthService.configure(authconfigFactory.getAuthConfig(appConfig)); oauthService.configure(authconfigFactory.getAuthConfig(appConfig));
oauthService.setStorage(authStorage); oauthService.setStorage(authStorage);
oauthService.tokenValidationHandler = new JwksValidationHandler();
oauthService.tokenValidationHandler.validateAtHash = function () {
return new Promise<boolean>((res) => { res(true); })
};
oauthService.setupAutomaticSilentRefresh(); oauthService.setupAutomaticSilentRefresh();
let location = injector.get(Location); let location = injector.get(Location);
let router = injector.get(Router); let router = injector.get(Router);
let urlPath = location.path();
oauthService.loadDiscoveryDocument().then(() => { oauthService.loadDiscoveryDocument().then(() => {
oauthService.tryLogin({ oauthService.tryLoginCodeFlow().then(() => {
onTokenReceived: (info) => { router.navigateByUrl(decodeURIComponent(oauthService.state));
urlPath = info.state;
}
}).then(() => {
router.navigateByUrl(urlPath);
}); });
}) })
}).then(() => { }).then(() => {

View File

@ -29,7 +29,8 @@
"strictMetadataEmit": true, "strictMetadataEmit": true,
"fullTemplateTypeCheck": true, "fullTemplateTypeCheck": true,
"strictInjectionParameters": true, "strictInjectionParameters": true,
"enableResourceInlining": true "enableResourceInlining": true,
"enableIvy": false
}, },
"exclude": [ "exclude": [
"src/test.ts", "src/test.ts",

View File

@ -1,6 +0,0 @@
{
"extends": "./tsconfig.lib.json",
"angularCompilerOptions": {
"enableIvy": false
}
}

View File

@ -61,7 +61,12 @@ export function provideBootstrapEffects(effects: Type<any>[]) {
AppCommonServiceModule.forRoot(), AppCommonServiceModule.forRoot(),
AppCommonMapModule.forRoot(), AppCommonMapModule.forRoot(),
BrowserModule, BrowserModule,
StoreModule.forRoot({}), StoreModule.forRoot({},{runtimeChecks: { // TODO fix this should all be true
strictStateImmutability: false,
strictActionImmutability: false,
strictStateSerializability: false,
strictActionSerializability: false
}}),
EffectsModule.forRoot([]) EffectsModule.forRoot([])
], ],
providers: [ providers: [

View File

@ -10,5 +10,8 @@
], ],
"include": [ "include": [
"src/**/*.d.ts" "src/**/*.d.ts"
] ],
"angularCompilerOptions": {
"enableIvy": false
}
} }