Skip to content

Commit

Permalink
Merge pull request wso2-extensions#137 from senthuran16/loadTenantCon…
Browse files Browse the repository at this point in the history
…figBlockingMode

Add implementation to load tenant config blocking mode
  • Loading branch information
tharindu1st authored Apr 2, 2024
2 parents 10e6e4e + cd643b3 commit aef72ef
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@

package org.wso2.is.key.manager.core.handlers;

import org.apache.axis2.context.ConfigurationContext;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.core.multitenancy.utils.TenantAxisUtils;
import org.wso2.carbon.identity.application.common.model.User;
import org.wso2.carbon.identity.auth.service.AuthenticationContext;
import org.wso2.carbon.identity.auth.service.AuthenticationRequest;
Expand Down Expand Up @@ -112,6 +114,10 @@ protected AuthenticationResult doAuthenticate(MessageContext messageContext) thr
authenticationResult.setAuthenticationStatus(AuthenticationStatus.FAILED);
return authenticationResult;
} else {
if (tenantId != MultitenantConstants.SUPER_TENANT_ID) {
String tenantDomain = tenant.getDomain();
loadTenantConfigBlockingMode(tenantDomain);
}
user.setTenantDomain(tenant.getDomain());
user.setUserName(tenant.getAdminName());
}
Expand All @@ -138,6 +144,16 @@ protected AuthenticationResult doAuthenticate(MessageContext messageContext) thr
return authenticationResult;
}

private static void loadTenantConfigBlockingMode(String tenantDomain) {

try {
ConfigurationContext ctx = ServiceReferenceHolder.getContextService().getServerConfigContext();
TenantAxisUtils.getTenantAxisConfiguration(tenantDomain, ctx);
} catch (Exception e) {
log.error("Error while creating axis configuration for tenant " + tenantDomain, e);
}
}

private String getHeader(MessageContext messageContext, String header) {

if (messageContext instanceof AuthenticationContext) {
Expand Down

0 comments on commit aef72ef

Please sign in to comment.