2020-02-12 20:34:11 +00:00
|
|
|
import { IAuthconfigFactory, AppConfig } from '@farmmaps/common';
|
2020-05-16 08:46:55 +00:00
|
|
|
import { AuthConfig } from 'angular-oauth2-oidc';
|
2020-04-01 07:06:11 +00:00
|
|
|
import { Injectable } from "@angular/core";
|
2020-02-12 20:34:11 +00:00
|
|
|
|
2020-05-16 08:46:55 +00:00
|
|
|
@Injectable()
|
2020-02-12 20:34:11 +00:00
|
|
|
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") };
|
2020-05-16 08:46:55 +00:00
|
|
|
authConfig.scope = "profile api offline_access";
|
2020-02-12 20:34:11 +00:00
|
|
|
authConfig.disableAtHashCheck = true;
|
|
|
|
authConfig.responseType = "code";
|
|
|
|
authConfig.requireHttps = appConfig.getConfig("requireHttps");
|
|
|
|
return authConfig;
|
|
|
|
}
|
|
|
|
}
|