@c8y/ngx-components 1018.0.247 → 1018.0.249
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auth-configuration/sso-configuration/templates/aad-configuration-mapper.d.ts +14 -14
- package/esm2020/auth-configuration/sso-configuration/templates/aad-configuration-mapper.mjs +20 -26
- package/fesm2015/c8y-ngx-components-auth-configuration.mjs +19 -25
- package/fesm2015/c8y-ngx-components-auth-configuration.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components-auth-configuration.mjs +19 -25
- package/fesm2020/c8y-ngx-components-auth-configuration.mjs.map +1 -1
- package/locales/locales.pot +3 -0
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ import * as i4 from 'ngx-bootstrap/popover';
|
|
|
12
12
|
import { PopoverModule } from 'ngx-bootstrap/popover';
|
|
13
13
|
import { map, catchError, tap, switchMap, shareReplay, publishReplay, refCount, take, mapTo, mergeAll, toArray } from 'rxjs/operators';
|
|
14
14
|
import { forkJoin, from, of, BehaviorSubject, defer, throwError, Subject, EMPTY, merge } from 'rxjs';
|
|
15
|
-
import { isString, omit, defaults, omitBy, isEmpty, cloneDeep, isFinite, pickBy, identity, map as map$1, pick, findKey, has, get, reduce, pull, defaultsDeep, at, head, reject, isUndefined
|
|
15
|
+
import { isString, omit, defaults, omitBy, isEmpty, cloneDeep, isFinite, pickBy, identity, map as map$1, pick, findKey, has, get, reduce, pull, defaultsDeep, at, head, reject, isUndefined } from 'lodash-es';
|
|
16
16
|
import * as i2$1 from '@ngx-translate/core';
|
|
17
17
|
import { TooltipModule } from 'ngx-bootstrap/tooltip';
|
|
18
18
|
import { __decorate, __metadata } from 'tslib';
|
|
@@ -1856,12 +1856,7 @@ class AadConfigurationMapper {
|
|
|
1856
1856
|
this.defaults = {
|
|
1857
1857
|
visibleOnLoginPage: true
|
|
1858
1858
|
};
|
|
1859
|
-
this.
|
|
1860
|
-
providerName: 'Azure AD',
|
|
1861
|
-
type: 'oauth2',
|
|
1862
|
-
grantType: 'AUTHORIZATION_CODE'
|
|
1863
|
-
};
|
|
1864
|
-
this.urlPattern = /^(.+)\/((.+?)\/oauth2\/authorize)$/;
|
|
1859
|
+
this.urlPattern = /^(.+)\/((.+?)\/oauth2\/(authorize|token))$/;
|
|
1865
1860
|
}
|
|
1866
1861
|
mapFrom(templateModel) {
|
|
1867
1862
|
const baseUrl = `${templateModel.aadAddress}/${templateModel.tenant}/oauth2`;
|
|
@@ -1949,17 +1944,14 @@ class AadConfigurationMapper {
|
|
|
1949
1944
|
mapTo(ssoConfiguration) {
|
|
1950
1945
|
const applicationsId = at(ssoConfiguration, ['audience', 'clientId']);
|
|
1951
1946
|
this.setupDefaults(ssoConfiguration);
|
|
1952
|
-
this.setupConstants(ssoConfiguration);
|
|
1953
|
-
this.setupAadAddressAndTenant(ssoConfiguration);
|
|
1954
|
-
this.setupClientSecret(ssoConfiguration);
|
|
1955
1947
|
this.setupUserIdConfig(ssoConfiguration);
|
|
1956
1948
|
this.setupSignatureVerificationConfig(ssoConfiguration);
|
|
1957
1949
|
const aadConfiguration = {
|
|
1958
|
-
aadAddress: this.
|
|
1959
|
-
tenant: this.
|
|
1950
|
+
aadAddress: this.getAadAddress(ssoConfiguration),
|
|
1951
|
+
tenant: this.getTenant(ssoConfiguration),
|
|
1960
1952
|
applicationId: this.getFirstDefined(applicationsId),
|
|
1961
1953
|
redirectToPlatform: ssoConfiguration.redirectToPlatform,
|
|
1962
|
-
clientSecret: ssoConfiguration
|
|
1954
|
+
clientSecret: this.getClientSecret(ssoConfiguration),
|
|
1963
1955
|
issuer: ssoConfiguration.issuer,
|
|
1964
1956
|
buttonName: ssoConfiguration.buttonName,
|
|
1965
1957
|
visibleOnLoginPage: ssoConfiguration.visibleOnLoginPage,
|
|
@@ -1979,19 +1971,22 @@ class AadConfigurationMapper {
|
|
|
1979
1971
|
setupDefaults(ssoConfiguration) {
|
|
1980
1972
|
defaults(ssoConfiguration, this.defaults);
|
|
1981
1973
|
}
|
|
1982
|
-
|
|
1983
|
-
|
|
1974
|
+
getAadAddress(ssoConfiguration) {
|
|
1975
|
+
const urls = this.getUrlsFromRequests(ssoConfiguration);
|
|
1976
|
+
const aadAddresses = map$1(urls, url => this.getAadAddressFromUrl(url));
|
|
1977
|
+
return this.getFirstDefined(aadAddresses);
|
|
1984
1978
|
}
|
|
1985
|
-
|
|
1986
|
-
const urls =
|
|
1979
|
+
getTenant(ssoConfiguration) {
|
|
1980
|
+
const urls = this.getUrlsFromRequests(ssoConfiguration);
|
|
1981
|
+
const tenants = map$1(urls, url => this.getTenantFromUrl(url));
|
|
1982
|
+
return this.getFirstDefined(tenants);
|
|
1983
|
+
}
|
|
1984
|
+
getUrlsFromRequests(ssoConfiguration) {
|
|
1985
|
+
return at(ssoConfiguration, [
|
|
1987
1986
|
'authorizationRequest.url',
|
|
1988
1987
|
'tokenRequest.url',
|
|
1989
1988
|
'refreshRequest.url'
|
|
1990
1989
|
]);
|
|
1991
|
-
const aadAddresses = map$1(urls, url => this.getAadAddressFromUrl(url));
|
|
1992
|
-
set(ssoConfiguration, 'aadAddress', this.getFirstDefined(aadAddresses));
|
|
1993
|
-
const tenants = map$1(urls, url => this.getTenantFromUrl(url));
|
|
1994
|
-
set(ssoConfiguration, 'tenant', this.getFirstDefined(tenants));
|
|
1995
1990
|
}
|
|
1996
1991
|
getAadAddressFromUrl(url) {
|
|
1997
1992
|
const [, aadAddress] = (url || '').match(this.urlPattern) || [];
|
|
@@ -2001,18 +1996,17 @@ class AadConfigurationMapper {
|
|
|
2001
1996
|
const [, , , tenant] = (url || '').match(this.urlPattern) || [];
|
|
2002
1997
|
return tenant;
|
|
2003
1998
|
}
|
|
2004
|
-
|
|
1999
|
+
getClientSecret(ssoConfiguration) {
|
|
2005
2000
|
const bodies = at(ssoConfiguration, ['tokenRequest.body', 'refreshRequest.body']);
|
|
2006
2001
|
const clientSecrets = map$1(bodies, body => this.getClientSecretFromBody(body));
|
|
2007
|
-
|
|
2002
|
+
return this.getFirstDefined(clientSecrets);
|
|
2008
2003
|
}
|
|
2009
2004
|
getClientSecretFromBody(body) {
|
|
2010
2005
|
const [, clientSecret] = (body || '').match(/client_secret=([^&]+)/) || [];
|
|
2011
|
-
return decodeURIComponent(clientSecret);
|
|
2006
|
+
return clientSecret ? decodeURIComponent(clientSecret) : undefined;
|
|
2012
2007
|
}
|
|
2013
2008
|
setupUserIdConfig(ssoConfiguration) {
|
|
2014
2009
|
defaultsDeep(ssoConfiguration, { userIdConfig: { jwtField: 'upn' } });
|
|
2015
|
-
set(ssoConfiguration, 'userIdConfig.useConstantValue', false);
|
|
2016
2010
|
}
|
|
2017
2011
|
setupSignatureVerificationConfig(ssoConfiguration) {
|
|
2018
2012
|
defaultsDeep(ssoConfiguration, { signatureVerificationConfig: { aad: {} } });
|