Merge pull request #18378 from abpframework/auto-merge/rel-7-4/2321

Merge branch rel-8.0 with rel-7.4
pull/18379/head
maliming 1 year ago committed by GitHub
commit 807487dcd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,11 +9,14 @@ var abp = abp || {};
var oidcSupportedFlows = configObject.oidcSupportedFlows || [];
var oidcSupportedScopes = configObject.oidcSupportedScopes || [];
var oidcDiscoveryEndpoint = configObject.oidcDiscoveryEndpoint || [];
var tenantPlaceHolders = ["{{tenantId}}", "{{tenantName}}" , "{0}"]
abp.appPath = configObject.baseUrl || abp.appPath;
var requestInterceptor = configObject.requestInterceptor;
var responseInterceptor = configObject.responseInterceptor;
getAbpApplicationConfiguration();
configObject.requestInterceptor = async function (request) {
if (request.url.includes(excludeUrl[1])) {
@ -29,14 +32,15 @@ var abp = abp || {};
// Intercept .well-known request when the discoveryEndpoint is provided
if (!firstRequest && oidcDiscoveryEndpoint.length !== 0 && request.url.includes(".well-known/openid-configuration")) {
if (oidcDiscoveryEndpoint.endsWith(".well-known/openid-configuration")) {
request.url = oidcDiscoveryEndpoint;
request.url = replaceTenantPlaceHolder(oidcDiscoveryEndpoint);
console.log(request.url);
return;
}
if (!oidcDiscoveryEndpoint.endsWith("/")) {
oidcDiscoveryEndpoint += "/"
}
request.url = oidcDiscoveryEndpoint + ".well-known/openid-configuration";
request.url = replaceTenantPlaceHolder(oidcDiscoveryEndpoint) + ".well-known/openid-configuration";
console.log(request.url);
}
@ -79,6 +83,26 @@ var abp = abp || {};
}
return response;
};
function replaceTenantPlaceHolder(url) {
url.replace(tenantPlaceHolders[0], abp.currentTenant.id);
url.replace(tenantPlaceHolders[1], abp.currentTenant.name);
if(abp.currentTenant.name != null){
url.replace(tenantPlaceHolders[2], abp.currentTenant.name);
}else if (abp.currentTenant.id != null){
url.replace(tenantPlaceHolders[2], abp.currentTenant.id);
}
return url;
}
function getAbpApplicationConfiguration() {
fetch(`${abp.appPath}api/abp/application-configuration`).then(response => response.json()).then(data => {
abp.currentTenant = data.currentTenant;
});
}
return SwaggerUIBundle(configObject);
}

Loading…
Cancel
Save