Search in sources :

Example 1 with TppSshCertRequest

use of com.venafi.vcert.sdk.connectors.tpp.endpoint.ssh.TppSshCertRequest in project vcert-java by Venafi.

the class TppConnectorUtils method convertToTppSshCertReq.

public static TppSshCertRequest convertToTppSshCertReq(SshCertificateRequest sshCertificateRequest) throws VCertException {
    TppSshCertRequest tppSshCertRequest = new TppSshCertRequest();
    tppSshCertRequest.cadn(isNotBlank(sshCertificateRequest.template()) ? getSshCADN(sshCertificateRequest.template()) : null);
    tppSshCertRequest.policyDN(isNotBlank(sshCertificateRequest.policyDN()) ? sshCertificateRequest.policyDN() : null);
    tppSshCertRequest.objectName(isNotBlank(sshCertificateRequest.objectName()) ? sshCertificateRequest.objectName() : null);
    tppSshCertRequest.destinationAddresses(sshCertificateRequest.destinationAddresses() != null && sshCertificateRequest.destinationAddresses().length > 0 ? sshCertificateRequest.destinationAddresses() : null);
    tppSshCertRequest.keyId(isNotBlank(sshCertificateRequest.keyId()) ? sshCertificateRequest.keyId() : null);
    tppSshCertRequest.principals(sshCertificateRequest.principals() != null && sshCertificateRequest.principals().length > 0 ? sshCertificateRequest.principals() : null);
    tppSshCertRequest.validityPeriod(isNotBlank(sshCertificateRequest.validityPeriod()) ? sshCertificateRequest.validityPeriod() : null);
    tppSshCertRequest.publicKeyData(isNotBlank(sshCertificateRequest.publicKeyData()) ? sshCertificateRequest.publicKeyData() : null);
    tppSshCertRequest.extensions(sshCertificateRequest.extensions() != null && !sshCertificateRequest.extensions().isEmpty() ? sshCertificateRequest.extensions() : null);
    tppSshCertRequest.forceCommand(isNotBlank(sshCertificateRequest.forceCommand()) ? sshCertificateRequest.forceCommand() : null);
    tppSshCertRequest.sourceAddresses(sshCertificateRequest.sourceAddresses() != null && sshCertificateRequest.sourceAddresses().length > 0 ? sshCertificateRequest.sourceAddresses() : null);
    return tppSshCertRequest;
}
Also used : TppSshCertRequest(com.venafi.vcert.sdk.connectors.tpp.endpoint.ssh.TppSshCertRequest)

Example 2 with TppSshCertRequest

use of com.venafi.vcert.sdk.connectors.tpp.endpoint.ssh.TppSshCertRequest in project vcert-java by Venafi.

the class AbstractTppConnector method requestTppSshCertificate.

protected TppSshCertRequestResponse requestTppSshCertificate(SshCertificateRequest sshCertificateRequest) throws VCertException {
    TppSshCertRequest tppSshCertRequest = TppConnectorUtils.convertToTppSshCertReq(sshCertificateRequest);
    TppSshCertRequestResponse requestResponse;
    try {
        requestResponse = tppAPI.requestSshCertificate(tppSshCertRequest);
    } catch (Exception e) {
        throw new VCertException(e);
    }
    if (!requestResponse.response().success())
        throw new RequestCertificateException(requestResponse.response().errorCode(), requestResponse.response().errorMessage());
    return requestResponse;
}
Also used : TppSshCertRequestResponse(com.venafi.vcert.sdk.connectors.tpp.endpoint.ssh.TppSshCertRequestResponse) VCertException(com.venafi.vcert.sdk.VCertException) TppSshCertRequest(com.venafi.vcert.sdk.connectors.tpp.endpoint.ssh.TppSshCertRequest) VCertException(com.venafi.vcert.sdk.VCertException) ConnectorException(com.venafi.vcert.sdk.connectors.ConnectorException)

Aggregations

TppSshCertRequest (com.venafi.vcert.sdk.connectors.tpp.endpoint.ssh.TppSshCertRequest)2 VCertException (com.venafi.vcert.sdk.VCertException)1 ConnectorException (com.venafi.vcert.sdk.connectors.ConnectorException)1 TppSshCertRequestResponse (com.venafi.vcert.sdk.connectors.tpp.endpoint.ssh.TppSshCertRequestResponse)1