use of com.venafi.vcert.sdk.certificate.SshConfig 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