Add id4AuthconfigFactory

This commit is contained in:
Willem Dantuma 2020-02-12 21:34:11 +01:00
parent 937dbe9b43
commit 252ce855c9
2 changed files with 22 additions and 0 deletions

View File

@ -21,6 +21,7 @@ import { MenuComponent } from './menu/menu.component';
import {RegisterDeviceComponent} from './registerdevice/registerdevice.component';
import { SecureOAuthStorage} from '@farmmaps/common';
import { OAuthStorage } from 'angular-oauth2-oidc';
import {Id4AuthconfigFactory} from './id4AuthconfigFactory';
export const BOOTSTRAP_EFFECTS = new InjectionToken('Bootstrap Effects');

View File

@ -0,0 +1,21 @@
import { IAuthconfigFactory, AppConfig } from '@farmmaps/common';
import { AuthConfig } from 'angular-oauth2-oidc';
export class Id4AuthconfigFactory implements IAuthconfigFactory {
constructor() {
}
getAuthConfig(appConfig: AppConfig): AuthConfig {
let authConfig: AuthConfig = new AuthConfig();
authConfig.issuer = appConfig.getConfig("issuer");
authConfig.redirectUri = window.location.origin + "/cb";
authConfig.clientId = appConfig.getConfig("clientId");
authConfig.customQueryParams = { audience: appConfig.getConfig("audience") };
authConfig.scope = "api offline_access";
authConfig.disableAtHashCheck = true;
authConfig.responseType = "code";
authConfig.requireHttps = appConfig.getConfig("requireHttps");
return authConfig;
}
}