Package com.venafi.vcert.sdk
Class VCertTknClient
- java.lang.Object
-
- com.venafi.vcert.sdk.VCertTknClient
-
- All Implemented Interfaces:
TokenConnector
public class VCertTknClient extends Object implements TokenConnector
-
-
Constructor Summary
Constructors Constructor Description VCertTknClient(Config config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CertificateRequestgenerateRequest(ZoneConfiguration config, CertificateRequest request)VedAuth method.TokenInfogetAccessToken()returns a new access token.TokenInfogetAccessToken(Authentication auth)returns a new access token.PolicySpecificationgetPolicy(String policyName)Returns the policySpecification from the policy which matches with the policyName argument.ConnectorTypegetType()StringgetVendorAndProductName()ImportResponseimportCertificate(ImportRequest request)VedAuth method.voidping()VedAuth method.PolicyreadPolicyConfiguration(String zone)VedAuth method.ZoneConfigurationreadZoneConfiguration(String zone)VedAuth method.TokenInforefreshAccessToken(String applicationId)this is for refreshing a token.StringrenewCertificate(RenewalRequest request)VedAuth method.StringrequestCertificate(CertificateRequest request, ZoneConfiguration zoneConfiguration)VedAuth method.StringrequestCertificate(CertificateRequest request, String zone)VedAuth method.StringrequestSshCertificate(SshCertificateRequest sshCertificateRequest)Request a new SSH Certificate.PEMCollectionretrieveCertificate(CertificateRequest request)VedAuth method.SshCertRetrieveDetailsretrieveSshCertificate(SshCertificateRequest sshCertificateRequest)Retrieve a requested SSH CertificateSshConfigretrieveSshConfig(SshCaTemplateRequest sshCaTemplateRequest)Retrieve theSshConfigof the CA specified in theSshCaTemplateRequest.intrevokeAccessToken()voidrevokeCertificate(RevocationRequest request)VedAuth method.voidsetBaseUrl(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
-
-
-
Constructor Detail
-
VCertTknClient
public VCertTknClient(Config config) throws VCertException
- Throws:
VCertException
-
-
Method Detail
-
getType
public ConnectorType getType()
- Specified by:
getTypein interfaceTokenConnector- Returns:
- ConnectorType the type of connector Cloud or TPP
-
setBaseUrl
public void setBaseUrl(String url) throws VCertException
Method not implemented yet. Guaranteed to throw an exception.- Specified by:
setBaseUrlin interfaceTokenConnector- Throws:
UnsupportedOperationException- alwaysVCertException
-
setZone
public void setZone(String zone)
Set the default zone- Specified by:
setZonein interfaceTokenConnector
-
setVendorAndProductName
public void setVendorAndProductName(String vendorAndProductName)
Set the vendor and product name- Specified by:
setVendorAndProductNamein interfaceTokenConnector
-
getVendorAndProductName
public String getVendorAndProductName()
- Specified by:
getVendorAndProductNamein interfaceTokenConnector- Returns:
- the vendor and product name
-
getAccessToken
public TokenInfo getAccessToken(Authentication auth) throws VCertException
Description copied from interface:TokenConnectorreturns a new access token.- Specified by:
getAccessTokenin interfaceTokenConnector- Parameters:
auth- authentication info- Returns:
- the new token.
- Throws:
VCertException- throws this exception when authentication info is null.
-
getAccessToken
public TokenInfo getAccessToken() throws VCertException
Description copied from interface:TokenConnectorreturns a new access token. This method uses theAuthenticationobject passed earlier with theConfigobject.- Specified by:
getAccessTokenin interfaceTokenConnector- Returns:
- the new token.
- Throws:
VCertException- throws this exception when authentication info is null.
-
refreshAccessToken
public TokenInfo refreshAccessToken(String applicationId) throws VCertException
Description copied from interface:TokenConnectorthis is for refreshing a token.- Specified by:
refreshAccessTokenin interfaceTokenConnector- Parameters:
applicationId- the application id.- Returns:
- a complete info about the new access token, refresh token, expires.
- Throws:
VCertException
-
revokeAccessToken
public int revokeAccessToken() throws VCertException- Specified by:
revokeAccessTokenin interfaceTokenConnector- Returns:
- 1 if the access token was revoked and 0 if not.
- Throws:
VCertException
-
ping
public void ping() throws VCertExceptionVedAuth method. Attempt to connect the Venafi API and returns an error if it cannot- Specified by:
pingin interfaceTokenConnector- Throws:
VCertException
-
readZoneConfiguration
public ZoneConfiguration readZoneConfiguration(String zone) throws VCertException
VedAuth method. Reads the zone configuration needed for generating and requesting a certificate- Specified by:
readZoneConfigurationin interfaceTokenConnector- 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
VedAuth method. GenerateRequest creates a new certificate request, based on the zone/policy configuration and the user data- Specified by:
generateRequestin interfaceTokenConnector- Returns:
- the zone configuration
- Throws:
VCertException
-
requestCertificate
public String requestCertificate(CertificateRequest request, String zone) throws VCertException
Description copied from interface:TokenConnectorVedAuth method. Submits the CSR to Venafi for processing- Specified by:
requestCertificatein interfaceTokenConnector- Returns:
- request id to track the certificate status.
- Throws:
VCertException
-
requestCertificate
public String requestCertificate(CertificateRequest request, ZoneConfiguration zoneConfiguration) throws VCertException
VedAuth method. Submits the CSR to Venafi for processing- Specified by:
requestCertificatein interfaceTokenConnector- Returns:
- request id to track the certificate status.
- Throws:
VCertException
-
retrieveCertificate
public PEMCollection retrieveCertificate(CertificateRequest request) throws VCertException
VedAuth method. Retrieves the certificate for the specific ID- Specified by:
retrieveCertificatein interfaceTokenConnector- Returns:
- A collection of PEM files including certificate, chain and potentially a private key.
- Throws:
VCertException
-
revokeCertificate
public void revokeCertificate(RevocationRequest request) throws VCertException
VedAuth method. Attempts to revoke a certificate- Specified by:
revokeCertificatein interfaceTokenConnector- Throws:
VCertException
-
renewCertificate
public String renewCertificate(RenewalRequest request) throws VCertException
VedAuth method. Attempts to renew a certificate- Specified by:
renewCertificatein interfaceTokenConnector- Returns:
- Throws:
VCertException
-
importCertificate
public ImportResponse importCertificate(ImportRequest request) throws VCertException
VedAuth method. Import an external certificate into Venafi.- Specified by:
importCertificatein interfaceTokenConnector- Returns:
- Throws:
VCertException
-
readPolicyConfiguration
public Policy readPolicyConfiguration(String zone) throws VCertException
VedAuth method. Reads the policy configuration for a specific zone in Venafi- Specified by:
readPolicyConfigurationin interfaceTokenConnector- 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 interfaceTokenConnector- 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 interfaceTokenConnector- Returns:
- Throws:
VCertException
-
requestSshCertificate
public String requestSshCertificate(SshCertificateRequest sshCertificateRequest) throws VCertException
Description copied from interface:TokenConnectorRequest a new SSH Certificate.- Specified by:
requestSshCertificatein interfaceTokenConnector- 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:TokenConnectorRetrieve a requested SSH Certificate- Specified by:
retrieveSshCertificatein interfaceTokenConnector- 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:TokenConnectorRetrieve theSshConfigof the CA specified in theSshCaTemplateRequest.- Specified by:
retrieveSshConfigin interfaceTokenConnector- Returns:
- A
SshConfig. - Throws:
VCertException
-
-