Skip to content

Commit

Permalink
Fix login issue in tenant flow
Browse files Browse the repository at this point in the history
  • Loading branch information
Binara-Sachin committed Nov 4, 2024
1 parent 8b9dce0 commit 48b481e
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@
import java.util.Map;
import java.util.Properties;

import static org.wso2.carbon.identity.sts.passive.PassiveRequestorConstants.KEY_ALIAS_KEY;
import static org.wso2.carbon.identity.sts.passive.PassiveRequestorConstants.KEY_STORE_PASSWORD_KEY;
import static org.wso2.carbon.identity.sts.passive.PassiveRequestorConstants.STS_DIGEST_ALGORITHM_KEY;
import static org.wso2.carbon.identity.sts.passive.PassiveRequestorConstants.STS_SIGNATURE_ALGORITHM_KEY;
import static org.wso2.carbon.identity.sts.passive.PassiveRequestorConstants.STS_TIME_TO_LIVE_KEY;
Expand Down Expand Up @@ -211,19 +209,25 @@ public static void addSTSProperties(TokenIssueOperation issueOperation) throws E
IdentityKeyStoreResolverConstants.InboundProtocol.WS_FEDERATION,
RegistryResources.SecurityManagement.CustomKeyStore.PROP_LOCATION);

String keyStoreName = null;
String keyStoreName = generateKSNameFromDomainName(tenantDomain);

String signatureAlgorithm = serverConfig.getFirstProperty(STS_SIGNATURE_ALGORITHM_KEY);
String digestAlgorithm = serverConfig.getFirstProperty(STS_DIGEST_ALGORITHM_KEY);


if (keyAlias == null) {
throw new STSException("Private key alias cannot be null.");
}

if (MultitenantConstants.SUPER_TENANT_ID != tenantId) {
keyStoreName = generateKSNameFromDomainName(tenantDomain);
// Encryption properties expected by org.apache.wss4j.common.crypto.CryptoFactory is,
// If keystore is in <IS-HOME>/repository/resources/security, (Primary keystore or custom keystore)
// keyStoreName = "" or null, keyStoreFileLocation = path to key store
// If keystore is not located in file system, (tenant keystore)
// keyStoreName = keystore name, keyStoreFileLocation = "" or any path
if (MultitenantConstants.SUPER_TENANT_ID != tenantId && keyStoreFileLocation.equals(keyStoreName)) {
keyStoreFileLocation = "";
tenantId = IdentityTenantUtil.getTenantId(tenantDomain);
} else {
keyStoreName = "";
}

Crypto crypto = CryptoFactory
Expand Down

0 comments on commit 48b481e

Please sign in to comment.