use of io.kubernetes.client.openapi.ApiClient in project java by kubernetes-client.
the class ClientCertificateAuthenticationTest method testInvalidCertificates.
@Test(expected = RuntimeException.class)
public void testInvalidCertificates() {
final ApiClient client = new ApiClient();
new ClientCertificateAuthentication(new byte[] {}, new byte[] {}).provide(client);
}
use of io.kubernetes.client.openapi.ApiClient in project java by kubernetes-client.
the class ClientCertificateAuthenticationTest method testValidCertificatesChain.
@Test
public void testValidCertificatesChain() throws Exception {
try {
final ApiClient client = new ApiClient();
final byte[] certificate = Files.readAllBytes(Paths.get(CLIENT_CERT_CHAIN_PATH));
final byte[] key = Files.readAllBytes(Paths.get(CLIENT_CERT_CHAIN_KEY_PATH));
new ClientCertificateAuthentication(certificate, key).provide(client);
} catch (Exception ex) {
ex.printStackTrace();
}
}
use of io.kubernetes.client.openapi.ApiClient in project java by kubernetes-client.
the class ClientCertificateAuthenticationTest method testValidECCertificates.
@Test
public void testValidECCertificates() throws Exception {
try {
final ApiClient client = new ApiClient();
final byte[] certificate = Files.readAllBytes(Paths.get(CLIENT_EC_CERT_PATH));
final byte[] key = Files.readAllBytes(Paths.get(CLIENT_EC_KEY_PATH));
new ClientCertificateAuthentication(certificate, key).provide(client);
} catch (Exception ex) {
ex.printStackTrace();
}
}
use of io.kubernetes.client.openapi.ApiClient in project java by kubernetes-client.
the class TokenFileAuthenticationTest method setup.
@Before
public void setup() throws IOException {
final ApiClient client = new ApiClient();
client.setBasePath("http://localhost:" + wireMockRule.port());
this.auth = new TokenFileAuthentication(SERVICEACCOUNT_TOKEN1_PATH);
this.auth.provide(client);
Configuration.setDefaultApiClient(client);
}
use of io.kubernetes.client.openapi.ApiClient in project java by kubernetes-client.
the class UsernamePasswordAuthenticationTest method testUsernamePasswordProvided.
@Test
public void testUsernamePasswordProvided() {
final ApiClient client = new ApiClient();
new UsernamePasswordAuthentication(USERNAME, PASSWORD).provide(client);
assertThat(getApiKeyAuthFromClient(client).getApiKeyPrefix(), is("Basic"));
assertThat(getApiKeyAuthFromClient(client).getApiKey(), is(ByteString.of(USERNAME_PASSWORD_BYTES).base64()));
}
Aggregations