diff --git a/pom.xml b/pom.xml
index e5d3ec2..d3d4818 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,12 +7,12 @@
com.czertainly
dependencies
- 1.0.0
+ 1.1.0
com.czertainly
keystore-entity-provider
- 1.4.0
+ 1.4.1
CZERTAINLY-Keystore-Entity-Provider
@@ -24,18 +24,18 @@
com.czertainly
interfaces
- 2.8.0
+ 2.10.0
org.apache.sshd
sshd-core
- 2.7.0
+ 2.11.0
org.apache.sshd
sshd-scp
- 2.5.1
+ 2.11.0
diff --git a/settings.xml b/settings.xml
index 28cde57..c74062f 100644
--- a/settings.xml
+++ b/settings.xml
@@ -12,8 +12,8 @@
github
- central
- https://repo1.maven.org/maven2
+ ossrh-releases
+ https://s01.oss.sonatype.org/content/repositories/releases
github
diff --git a/src/main/java/com/czertainly/provider/entity/keystore/service/impl/LocationServiceImpl.java b/src/main/java/com/czertainly/provider/entity/keystore/service/impl/LocationServiceImpl.java
index fd21a54..27e53bc 100644
--- a/src/main/java/com/czertainly/provider/entity/keystore/service/impl/LocationServiceImpl.java
+++ b/src/main/java/com/czertainly/provider/entity/keystore/service/impl/LocationServiceImpl.java
@@ -4,6 +4,7 @@
import com.czertainly.api.exception.NotFoundException;
import com.czertainly.api.model.client.attribute.RequestAttributeDto;
import com.czertainly.api.model.common.attribute.v2.AttributeType;
+import com.czertainly.api.model.common.attribute.v2.BaseAttribute;
import com.czertainly.api.model.common.attribute.v2.DataAttribute;
import com.czertainly.api.model.common.attribute.v2.MetadataAttribute;
import com.czertainly.api.model.common.attribute.v2.content.AttributeContentType;
@@ -94,6 +95,8 @@ public LocationDetailResponseDto getLocationDetail(String entityUuid, LocationDe
List certificates = new ArrayList<>();
// parse the response and get certificates
List certs = KeystoreResponseUtil.getAllKeystoreCertificates(response);
+ List csrAttributesDefinitions = locationAttributeService.listGenerateCsrAttributes(entity);
+ List pushAttributesDefinitions = locationAttributeService.listPushCertificateAttributes(entity);
for (KeystoreCertificate cert : certs) {
CertificateLocationDto certificateLocationDto = new CertificateLocationDto();
certificateLocationDto.setCertificateData(CertificateUtil.getBase64Certificate(cert.getCertificate()));
@@ -104,33 +107,29 @@ public LocationDetailResponseDto getLocationDetail(String entityUuid, LocationDe
certificateLocationDto.setMetadata(certificateMeta);
- List pushAttributes = new ArrayList<>();
- DataAttribute aliasAttribute = new DataAttribute();
+ List pushAttributes = new ArrayList<>();
+ RequestAttributeDto aliasAttribute = new RequestAttributeDto();
aliasAttribute.setName(AttributeConstants.ATTRIBUTE_ALIAS_NAME);
aliasAttribute.setContent(List.of(new StringAttributeContent(cert.getAlias())));
- aliasAttribute.setContentType(AttributeContentType.STRING);
pushAttributes.add(aliasAttribute);
- certificateLocationDto.setPushAttributes(pushAttributes);
+ certificateLocationDto.setPushAttributes(AttributeDefinitionUtils.mergeAttributes(pushAttributesDefinitions, pushAttributes));
- List csrAttributes = new ArrayList<>();
+ List csrAttributes = new ArrayList<>();
if (cert.isKeyEntry()) {
- DataAttribute subjectDnAttribute = new DataAttribute();
+ RequestAttributeDto subjectDnAttribute = new RequestAttributeDto();
subjectDnAttribute.setName(AttributeConstants.ATTRIBUTE_DN_NAME);
subjectDnAttribute.setContent(List.of(new StringAttributeContent(cert.getCertificate().getSubjectDN().toString())));
- subjectDnAttribute.setContentType(AttributeContentType.STRING);
csrAttributes.add(subjectDnAttribute);
PublicKey pubk = cert.getCertificate().getPublicKey();
- DataAttribute keyAlgorithmAttribute = new DataAttribute();
+ RequestAttributeDto keyAlgorithmAttribute = new RequestAttributeDto();
keyAlgorithmAttribute.setName(AttributeConstants.ATTRIBUTE_KEY_ALG_NAME);
keyAlgorithmAttribute.setContent(List.of(new StringAttributeContent(pubk.getAlgorithm())));
- keyAlgorithmAttribute.setContentType(AttributeContentType.STRING);
csrAttributes.add(keyAlgorithmAttribute);
- DataAttribute keyLengthAttribute = new DataAttribute();
+ RequestAttributeDto keyLengthAttribute = new RequestAttributeDto();
keyLengthAttribute.setName(AttributeConstants.ATTRIBUTE_KEY_SIZE_NAME);
- keyLengthAttribute.setContentType(AttributeContentType.STRING);
if (pubk instanceof RSAPublicKey) {
RSAPublicKey rsaPubk = (RSAPublicKey) pubk;
keyLengthAttribute.setContent(List.of(new StringAttributeContent(String.valueOf(rsaPubk.getModulus().bitLength()))));
@@ -145,17 +144,16 @@ public LocationDetailResponseDto getLocationDetail(String entityUuid, LocationDe
}
csrAttributes.add(keyLengthAttribute);
- DataAttribute signatureAlgorithmAttribute = new DataAttribute();
+ RequestAttributeDto signatureAlgorithmAttribute = new RequestAttributeDto();
signatureAlgorithmAttribute.setName(AttributeConstants.ATTRIBUTE_SIG_ALG_NAME);
signatureAlgorithmAttribute.setContent(List.of(new StringAttributeContent(cert.getCertificate().getSigAlgName())));
- signatureAlgorithmAttribute.setContentType(AttributeContentType.STRING);
csrAttributes.add(signatureAlgorithmAttribute);
// alias include
csrAttributes.add(aliasAttribute);
}
- certificateLocationDto.setCsrAttributes(csrAttributes);
+ certificateLocationDto.setCsrAttributes(AttributeDefinitionUtils.mergeAttributes(csrAttributesDefinitions, csrAttributes));
certificates.add(certificateLocationDto);
}
diff --git a/src/main/java/com/czertainly/provider/entity/keystore/service/impl/SshServiceImpl.java b/src/main/java/com/czertainly/provider/entity/keystore/service/impl/SshServiceImpl.java
index 1e1ee96..05a566f 100644
--- a/src/main/java/com/czertainly/provider/entity/keystore/service/impl/SshServiceImpl.java
+++ b/src/main/java/com/czertainly/provider/entity/keystore/service/impl/SshServiceImpl.java
@@ -12,10 +12,10 @@
import org.apache.sshd.client.SshClient;
import org.apache.sshd.client.channel.ClientChannel;
import org.apache.sshd.client.channel.ClientChannelEvent;
-import org.apache.sshd.client.scp.ScpClient;
-import org.apache.sshd.client.scp.ScpClientCreator;
import org.apache.sshd.client.session.ClientSession;
import org.apache.sshd.common.channel.Channel;
+import org.apache.sshd.scp.client.ScpClient;
+import org.apache.sshd.scp.client.ScpClientCreator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;