use of com.venafi.vcert.sdk.certificate.SshCaTemplateRequest in project vcert-java by Venafi.
the class TppConnectorATForSSH method retrieveSshConfigFromCADN.
@Test
@DisplayName("TPP - Testing the retrieveSshConfig() method using CADN")
public void retrieveSshConfigFromCADN() throws VCertException, Exception {
SshCaTemplateRequest req = new SshCaTemplateRequest().template(System.getenv("TPP_SSH_CADN"));
// getting the sshConfig of the SSH Cert CA
retrieveSshConfig(req);
}
use of com.venafi.vcert.sdk.certificate.SshCaTemplateRequest in project vcert-java by Venafi.
the class TppTokenConnectorATForSSH method retrieveSshConfigWithoutCredentialsFromCADN.
@Test
@Tag("AuthenticationUnneeded")
@DisplayName("TPP - Testing the retrieveSshConfig() method without authentication using CADN")
public void retrieveSshConfigWithoutCredentialsFromCADN() throws VCertException, Exception {
// Given this test is tagged as AuthenticationUnneeded, then the Authentication will not be performed
SshCaTemplateRequest req = new SshCaTemplateRequest().template(System.getenv("TPP_SSH_CADN"));
// getting the sshConfig of the SSH Cert CA
retrieveSshConfigWithoutCredentials(req);
}
use of com.venafi.vcert.sdk.certificate.SshCaTemplateRequest in project vcert-java by Venafi.
the class TppTokenConnectorATForSSH method retrieveSshConfigFromCADN.
@Test
@DisplayName("TPP - Testing the retrieveSshConfig() method using CADN")
public void retrieveSshConfigFromCADN() throws VCertException, Exception {
SshCaTemplateRequest req = new SshCaTemplateRequest().template(System.getenv("TPP_SSH_CADN"));
// getting the sshConfig of the SSH Cert CA
retrieveSshConfig(req);
}
use of com.venafi.vcert.sdk.certificate.SshCaTemplateRequest in project vcert-java by Venafi.
the class SshConfigRetrieving method main.
/**
* @param args
*/
public static void main(String[] args) {
try {
// replace it by the CADN or the CA Name
String template = "<TPP_SSH_CA>";
// replace it by the TPP User
String user = "<TPPUSER>";
// replace it by the TPP Password
String password = "<TPPPASSWORD>";
// replace it by the TPP URL
String baseUri = "<TPP_URL>";
// 1. Get a VCertClient for TPP setting the scope to "ssh:manage"
// 1.a The Authentication is optional, but if that is not provided,
// then the principals of the returned SshConfig object will not be retrieved.
Authentication auth = Authentication.builder().user(user).password(password).scope("ssh:manage").build();
Config config = Config.builder().connectorType(ConnectorType.TPP_TOKEN).baseUrl(baseUri).build();
VCertTknClient client = new VCertTknClient(config);
client.getAccessToken(auth);
// 2. Get an instance of com.venafi.vcert.sdk.certificate.SshCaTemplateRequest class.
SshCaTemplateRequest req = new SshCaTemplateRequest().template(template);
// 3. Use the VCertClient method retrieveSshConfig() to retrieve the Config of the given
// SSH CA on TPP.
// 3.a Remember that Authentication is optional, but if that is not provided,
// then the principals attribute of the returned SshConfig object will not be retrieved.
SshConfig sshConfig = client.retrieveSshConfig(req);
client.revokeAccessToken();
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations