Package com.venafi.vcert.sdk
Class VCertClient
- java.lang.Object
-
- com.venafi.vcert.sdk.VCertClient
-
- All Implemented Interfaces:
Connector,IPMConnector,ISSHConnector
- Direct Known Subclasses:
VCertTknClient
public class VCertClient extends Object implements Connector
-
-
Constructor Summary
Constructors Constructor Description VCertClient(Config config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidauthenticate(Authentication credentials)This is the default implementation which provides a mechanism to authenticate the credentials provided in theAuthenticationobject.voidauthorize(Authentication credentials)Performs the authorization actions using the credentials provided.protected ConnectorcreateConnector(Config config)CertificateRequestgenerateRequest(ZoneConfiguration config, CertificateRequest request)GenerateRequest creates a new certificate request, based on the zone/policy configuration and the user dataAuthenticationgetCredentials()PolicySpecificationgetPolicy(String policyName)Returns the policySpecification from the policy which matches with the policyName argument.ConnectorTypegetType()StringgetVendorAndProductName()ImportResponseimportCertificate(ImportRequest request)Import an external certificate into Venafi.booleanisEmptyCredentials(Authentication credentials)Determines if the given credentials object is empty or not.voidping()Attempt to connect the Venafi API and returns an error if it cannotPolicyreadPolicyConfiguration(String zone)Reads the policy configuration for a specific zone in VenafiZoneConfigurationreadZoneConfiguration(String zone)Reads the zone configuration needed for generating and requesting a certificateStringrenewCertificate(RenewalRequest request)Attempts to renew a certificateStringrequestCertificate(CertificateRequest request, ZoneConfiguration zoneConfiguration)Submits the CSR to Venafi for processingStringrequestCertificate(CertificateRequest request, String zone)Submits the CSR to Venafi for processingStringrequestSshCertificate(SshCertificateRequest sshCertificateRequest)Request a new SSH Certificate.PEMCollectionretrieveCertificate(CertificateRequest request)Retrieves the certificate for the specific IDSshCertRetrieveDetailsretrieveSshCertificate(SshCertificateRequest sshCertificateRequest)Retrieve a requested SSH CertificateSshConfigretrieveSshConfig(SshCaTemplateRequest sshCaTemplateRequest)Retrieve theSshConfigof the CA specified in theSshCaTemplateRequest.voidrevokeCertificate(RevocationRequest request)Attempts to revoke a certificatevoidsetBaseUrl(String url)Method not implemented yet.voidsetPolicy(String policyName, PolicySpecification policySpecification)Create/update a policy based on the policySpecification passed as argument.voidsetVendorAndProductName(String vendorAndProductName)Set the vendor and product namevoidsetZone(String zone)Set the default zone
-
-
-
Field Detail
-
connector
protected Connector connector
-
-
Constructor Detail
-
VCertClient
public VCertClient(Config config) throws VCertException
- Throws:
VCertException
-
-
Method Detail
-
createConnector
protected Connector createConnector(Config config) throws VCertException
- Throws:
VCertException
-
getCredentials
public Authentication getCredentials()
- Specified by:
getCredentialsin interfaceConnector
-
getType
public ConnectorType getType()
-
setBaseUrl
public void setBaseUrl(String url) throws VCertException
Method not implemented yet. Guaranteed to throw an exception.- Specified by:
setBaseUrlin interfaceConnector- Throws:
UnsupportedOperationException- alwaysVCertException
-
setZone
public void setZone(String zone)
Set the default zone
-
setVendorAndProductName
public void setVendorAndProductName(String vendorAndProductName)
Set the vendor and product name- Specified by:
setVendorAndProductNamein interfaceConnector
-
getVendorAndProductName
public String getVendorAndProductName()
- Specified by:
getVendorAndProductNamein interfaceConnector- Returns:
- the vendor and product name
-
ping
public void ping() throws VCertExceptionAttempt to connect the Venafi API and returns an error if it cannot- Specified by:
pingin interfaceConnector- Throws:
VCertException
-
authenticate
public void authenticate(Authentication credentials) throws VCertException
This is the default implementation which provides a mechanism to authenticate the credentials provided in theAuthenticationobject. Behind the scene, it's validating if the credentials were provided calling theConnector.isEmptyCredentials(Authentication)method and if that returns true, then aConnectorException.MissingCredentialsExceptionis thrown. If the credentials are not empty then is called theConnector.authorize(Authentication)method.- Specified by:
authenticatein interfaceConnector- Throws:
VCertException
-
isEmptyCredentials
public boolean isEmptyCredentials(Authentication credentials)
Determines if the given credentials object is empty or not. This method is used byConnector.authenticate(Authentication)method to determine if the credentials were provided in order to after invoke theConnector.authorize(Authentication)method.- Specified by:
isEmptyCredentialsin interfaceConnector- Returns:
-
authorize
public void authorize(Authentication credentials) throws VCertException
Performs the authorization actions using the credentials provided. This method is used byConnector.authenticate(Authentication)method after the credentials were validated as not empty.- Specified by:
authorizein interfaceConnector- Throws:
VCertException
-
readZoneConfiguration
public ZoneConfiguration readZoneConfiguration(String zone) throws VCertException
Reads the zone configuration needed for generating and requesting a certificate- Specified by:
readZoneConfigurationin interfaceConnector- Parameters:
zone- ID (e.g. 2ebd4ec1-57f7-4994-8651-e396b286a3a8) or zone path (e.g. "ProjectName\ZoneName")- Returns:
- Throws:
VCertException
-
generateRequest
public CertificateRequest generateRequest(ZoneConfiguration config, CertificateRequest request) throws VCertException
GenerateRequest creates a new certificate request, based on the zone/policy configuration and the user data- Specified by:
generateRequestin interfaceConnector- Returns:
- the zone configuration
- Throws:
VCertException
-
requestCertificate
public String requestCertificate(CertificateRequest request, String zone) throws VCertException
Description copied from interface:ConnectorSubmits the CSR to Venafi for processing- Specified by:
requestCertificatein interfaceConnector- Returns:
- request id to track the certificate status.
- Throws:
VCertException
-
requestCertificate
public String requestCertificate(CertificateRequest request, ZoneConfiguration zoneConfiguration) throws VCertException
Submits the CSR to Venafi for processing- Specified by:
requestCertificatein interfaceConnector- Returns:
- request id to track the certificate status.
- Throws:
VCertException
-
retrieveCertificate
public PEMCollection retrieveCertificate(CertificateRequest request) throws VCertException
Retrieves the certificate for the specific ID- Specified by:
retrieveCertificatein interfaceConnector- Returns:
- A collection of PEM files including certificate, chain and potentially a private key.
- Throws:
VCertException
-
revokeCertificate
public void revokeCertificate(RevocationRequest request) throws VCertException
Attempts to revoke a certificate- Specified by:
revokeCertificatein interfaceConnector- Throws:
VCertException
-
renewCertificate
public String renewCertificate(RenewalRequest request) throws VCertException
Attempts to renew a certificate- Specified by:
renewCertificatein interfaceConnector- Returns:
- Throws:
VCertException
-
importCertificate
public ImportResponse importCertificate(ImportRequest request) throws VCertException
Import an external certificate into Venafi.- Specified by:
importCertificatein interfaceConnector- Returns:
- Throws:
VCertException
-
readPolicyConfiguration
public Policy readPolicyConfiguration(String zone) throws VCertException
Reads the policy configuration for a specific zone in Venafi- Specified by:
readPolicyConfigurationin interfaceIPMConnector- Returns:
- Throws:
VCertException
-
setPolicy
public void setPolicy(String policyName, PolicySpecification policySpecification) throws VCertException
Create/update a policy based on the policySpecification passed as argument.- Specified by:
setPolicyin interfaceIPMConnector- Throws:
VCertException
-
getPolicy
public PolicySpecification getPolicy(String policyName) throws VCertException
Returns the policySpecification from the policy which matches with the policyName argument.- Specified by:
getPolicyin interfaceIPMConnector- Returns:
- Throws:
VCertException
-
requestSshCertificate
public String requestSshCertificate(SshCertificateRequest sshCertificateRequest) throws VCertException
Description copied from interface:ISSHConnectorRequest a new SSH Certificate.- Specified by:
requestSshCertificatein interfaceISSHConnector- Parameters:
sshCertificateRequest- TheSshCertificateRequestinstance needed to do the request. For more information about of which properties should be filled, please review the documentation ofSshCertificateRequest.- Returns:
- The DN of the created SSH certificate object. It can be used as pickup ID to retrieve the created SSH Certificate.
For more details review the
retrieveSshCertificate(SshCertificateRequest)method. - Throws:
VCertException
-
retrieveSshCertificate
public SshCertRetrieveDetails retrieveSshCertificate(SshCertificateRequest sshCertificateRequest) throws VCertException
Description copied from interface:ISSHConnectorRetrieve a requested SSH Certificate- Specified by:
retrieveSshCertificatein interfaceISSHConnector- Parameters:
sshCertificateRequest- TheSshCertificateRequestinstance needed to do the request.
It's mandatory to set the PickUpID which is the value of the DN returned when the SSH Certificate was requested. For more information about of which properties should be filled, please review the documentation ofSshCertificateRequest.- Returns:
- A
SshCertRetrieveDetailscontaining the Certificate Data of the created Certificate. - Throws:
VCertException
-
retrieveSshConfig
public SshConfig retrieveSshConfig(SshCaTemplateRequest sshCaTemplateRequest) throws VCertException
Description copied from interface:ISSHConnectorRetrieve theSshConfigof the CA specified in theSshCaTemplateRequest.- Specified by:
retrieveSshConfigin interfaceISSHConnector- Returns:
- A
SshConfig. - Throws:
VCertException
-
-