Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve keystore configuration retrieval. #481

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions components/event/org.wso2.carbon.event.core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
<groupId>org.wso2.carbon.commons</groupId>
<artifactId>org.wso2.carbon.event.client.stub</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.utils</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package org.wso2.carbon.event.core.qpid;

import org.wso2.carbon.utils.ServerConstants;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
import org.wso2.carbon.utils.security.KeystoreUtils;

@Deprecated
public class QpidServerDetails {
Expand All @@ -25,8 +27,9 @@ public class QpidServerDetails {
private static final String DOMAIN_NAME_SEPARATOR_INTERNAL = "!";

private static final String SECURITY_RESOURCES_DIR = "/repository/resources/security/";
private static final String KEYSTORE_FILE = "wso2carbon.jks";
private static final String TRUSTSTORE_FILE = "client-truststore.jks";
private static final String KEYSTORE_FILE = "wso2carbon" +
KeystoreUtils.getKeyStoreFileExtension(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
private static final String TRUSTSTORE_FILE = KeystoreUtils.getTrustStoreFileLocation();

private String accessKey;
private String clientID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.core</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.utils</artifactId>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.ds-annotations</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.zip.DeflaterOutputStream;
import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream;
import org.wso2.carbon.utils.security.KeystoreUtils;

import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
Expand Down Expand Up @@ -222,7 +223,7 @@ public static boolean validateSignature(Response resp, String keyStoreName,
keyStore = keyStoreManager.getKeyStore(generateKSNameFromDomainName(tenantDomain));
cert = (java.security.cert.X509Certificate) keyStore.getCertificate(tenantDomain);
} else {
keyStore = KeyStore.getInstance("JKS");
keyStore = KeyStore.getInstance(KeystoreUtils.getKeyStoreFileType(tenantDomain));
keyStore.load(new FileInputStream(new File(keyStoreName)), keyStorePassword.toCharArray());
cert = (java.security.cert.X509Certificate) keyStore.getCertificate(alias);
}
Expand Down Expand Up @@ -258,8 +259,8 @@ public static String getDomainName(XMLObject samlObject) {
* @return key store file name
*/
private static String generateKSNameFromDomainName(String tenantDomain) {
String ksName = tenantDomain.trim().replace(".", "-");
return (ksName + ".jks");

return KeystoreUtils.getKeyStoreFileType(tenantDomain);
}


Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1800,7 +1800,7 @@

<properties>
<!-- Carbon kernel version -->
<carbon.kernel.version>4.5.3</carbon.kernel.version>
<carbon.kernel.version>4.9.23</carbon.kernel.version>
<carbon.kernel.feature.version>${carbon.kernel.version}</carbon.kernel.feature.version>
<carbon.kernel.imp.pkg.version>[4.5.0, 5.0.0)</carbon.kernel.imp.pkg.version>
<carbon.kernel.registry.imp.pkg.version>[1.0.1, 2.0.0)</carbon.kernel.registry.imp.pkg.version>
Expand Down