|
|
|
@ -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); |
|
|
|
} |
|
|
|
|