use of org.eclipse.jkube.kit.build.api.auth.AuthConfig in project jkube by eclipse.
the class OpenShiftRegistryAuthHandlerTest method testOpenShiftConfigFromSystemPropsNegative.
@Test
public void testOpenShiftConfigFromSystemPropsNegative() throws Exception {
try {
System.setProperty("docker.useOpenShiftAuth", "false");
executeWithTempHomeDir(homeDir -> {
createOpenShiftConfig(homeDir, "openshift_simple_config.yaml");
AuthConfig config = handler.create(RegistryAuthConfig.Kind.PUSH, "roland", null, s -> s);
assertNull(config);
});
} finally {
System.getProperties().remove("docker.useOpenShiftAuth");
}
}
use of org.eclipse.jkube.kit.build.api.auth.AuthConfig in project jkube by eclipse.
the class KubernetesConfigAuthUtilTest method readKubeConfigAuth_withMissingCurrentContext.
@Test
public void readKubeConfigAuth_withMissingCurrentContext() throws IOException {
withKubeConfig("kube-config-missing-current-context.yaml");
executeWithTempSystemUserHome(() -> {
final AuthConfig result = readKubeConfigAuth();
assertThat(result).isNull();
});
}
use of org.eclipse.jkube.kit.build.api.auth.AuthConfig in project jkube by eclipse.
the class KubernetesConfigAuthUtilTest method readKubeConfigAuth_withEmptyFile.
@Test
public void readKubeConfigAuth_withEmptyFile() throws IOException {
withKubeConfig("kube-config-empty.yaml");
executeWithTempSystemUserHome(() -> {
final AuthConfig result = readKubeConfigAuth();
assertThat(result).isNull();
});
}
use of org.eclipse.jkube.kit.build.api.auth.AuthConfig in project jkube by eclipse.
the class AuthConfigFactoryTest method awsTemporaryCredentialsArePickedUpFromEnvironment.
@Test
public void awsTemporaryCredentialsArePickedUpFromEnvironment() throws IOException {
givenAwsSdkIsDisabled();
String accessKeyId = randomUUID().toString();
String secretAccessKey = randomUUID().toString();
String sessionToken = randomUUID().toString();
new Expectations() {
{
awsSdkHelper.getAwsAccessKeyIdEnvVar();
result = accessKeyId;
awsSdkHelper.getAwsSecretAccessKeyEnvVar();
result = secretAccessKey;
awsSdkHelper.getAwsSessionTokenEnvVar();
result = sessionToken;
}
};
AuthConfig authConfig = factory.createAuthConfig(false, true, null, Collections.emptyList(), "user", ECR_NAME, s -> s);
verifyAuthConfig(authConfig, accessKeyId, secretAccessKey, null, sessionToken);
}
use of org.eclipse.jkube.kit.build.api.auth.AuthConfig in project jkube by eclipse.
the class AuthConfigFactoryTest method testGetAuthConfigFromPluginConfiguration.
@Test
public void testGetAuthConfigFromPluginConfiguration() {
// Given
Map<String, Object> authConfigMap = new HashMap<>();
authConfigMap.put("username", "testuser");
authConfigMap.put("password", "testpass");
authConfigMap.put("email", "test@example.com");
// When
AuthConfig authConfig = AuthConfigFactory.getAuthConfigFromPluginConfiguration(AuthConfigFactory.LookupMode.DEFAULT, authConfigMap, s -> s);
// Then
assertNotNull(authConfig);
assertAuthConfig(authConfig, "testuser", "testpass");
assertEquals("test@example.com", authConfig.getEmail());
}
Aggregations