@Override
protected V2ProjectList run0() throws Exception {
KeyPair keypair = ((SshContextImpl) sshContext).getKeypair();
URI uri = URI.create(server);
OpenstackIdentityClient identityClient = OpenstackIdentityClient.build(uri);
X500Principal subject = new X500Principal("CN=" + "test");
CertificateAndKey certificateAndKey = ChallengeResponses.createSelfSigned(subject, keypair);
String project = null;
CertificateAuthTokenProvider tokenProvider = CertificateAuthTokenProvider.build(identityClient, project,
certificateAndKey);
identityClient = identityClient.withTokenProvider(tokenProvider);
// V2AuthRequest authRequest = new V2AuthRequest();
// authRequest.auth = new V2AuthRequest.V2AuthCredentials();
//
// V2AuthResponse authResponse = client.doLogin(authRequest,
// certificateAndKey);
//
// V2AuthRequest.ChallengeResponse challengeResponse =
// ChallengeResponses.respondToAuthChallenge(
// certificateAndKey, authResponse.challenge);
// authRequest.auth.challengeResponse = challengeResponse;
//
// authResponse = client.doLogin(authRequest, certificateAndKey);
V2ProjectList projects = identityClient.listProjects();
return projects;
}