Make authstorage configurable
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import { Injector } from '@angular/core';
|
||||
import { Location} from '@angular/common';
|
||||
import { Router,UrlSerializer } from '@angular/router';
|
||||
import { AuthConfig, OAuthService, JwksValidationHandler, OAuthErrorEvent } from 'angular-oauth2-oidc';
|
||||
import { AuthConfig, OAuthService, JwksValidationHandler, OAuthErrorEvent, OAuthStorage } from 'angular-oauth2-oidc';
|
||||
import { AppConfig } from "./app.config";
|
||||
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 appConfig.load().then(() => {
|
||||
oauthService.events.subscribe((event) => {
|
||||
@@ -22,7 +23,7 @@ export function appConfigFactory(injector:Injector, appConfig: AppConfig, oauthS
|
||||
}
|
||||
});
|
||||
oauthService.configure(authconfigFactory.getAuthConfig(appConfig));
|
||||
oauthService.setStorage(localStorage);
|
||||
oauthService.setStorage(authStorage);
|
||||
oauthService.tokenValidationHandler = new JwksValidationHandler();
|
||||
oauthService.tokenValidationHandler.validateAtHash = function () {
|
||||
return new Promise<boolean>((res) => { res(true); })
|
||||
|
Reference in New Issue
Block a user