Search in sources :

Example 1 with AuthConfig

use of org.eclipse.jkube.kit.build.api.auth.AuthConfig in project jkube by eclipse.

the class FromConfigRegistryAuthHandlerTest method testFromPluginConfigurationPull.

@Test
public void testFromPluginConfigurationPull() {
    FromConfigRegistryAuthHandler handler = new FromConfigRegistryAuthHandler(setupAuthConfigFactoryWithConfigDataForKind(RegistryAuthConfig.Kind.PULL), log);
    AuthConfig config = handler.create(RegistryAuthConfig.Kind.PULL, null, null, s -> s);
    verifyAuthConfig(config, "roland", "secret", "roland@jolokia.org");
}
Also used : AuthConfig(org.eclipse.jkube.kit.build.api.auth.AuthConfig) RegistryAuthConfig(org.eclipse.jkube.kit.build.api.auth.RegistryAuthConfig) Test(org.junit.Test)

Example 2 with AuthConfig

use of org.eclipse.jkube.kit.build.api.auth.AuthConfig in project jkube by eclipse.

the class FromConfigRegistryAuthHandlerTest method testFromPluginConfiguration.

@Test
public void testFromPluginConfiguration() throws IOException {
    FromConfigRegistryAuthHandler handler = new FromConfigRegistryAuthHandler(setupAuthConfigFactoryWithConfigData(), log);
    AuthConfig config = handler.create(RegistryAuthConfig.Kind.PUSH, null, null, s -> s);
    verifyAuthConfig(config, "roland", "secret", "roland@jolokia.org");
}
Also used : AuthConfig(org.eclipse.jkube.kit.build.api.auth.AuthConfig) RegistryAuthConfig(org.eclipse.jkube.kit.build.api.auth.RegistryAuthConfig) Test(org.junit.Test)

Example 3 with AuthConfig

use of org.eclipse.jkube.kit.build.api.auth.AuthConfig in project jkube by eclipse.

the class OpenShiftRegistryAuthHandlerTest method testOpenShiftConfigFromSystemProps.

@Test
public void testOpenShiftConfigFromSystemProps() throws Exception {
    try {
        System.setProperty("docker.useOpenShiftAuth", "true");
        executeWithTempHomeDir(homeDir -> {
            createOpenShiftConfig(homeDir, "openshift_simple_config.yaml");
            AuthConfig config = handler.create(RegistryAuthConfig.Kind.PUSH, "roland", null, s -> s);
            verifyAuthConfig(config, "admin", "token123", null);
        });
    } finally {
        System.getProperties().remove("docker.useOpenShiftAuth");
    }
}
Also used : AuthConfig(org.eclipse.jkube.kit.build.api.auth.AuthConfig) RegistryAuthConfig(org.eclipse.jkube.kit.build.api.auth.RegistryAuthConfig) Test(org.junit.Test)

Example 4 with AuthConfig

use of org.eclipse.jkube.kit.build.api.auth.AuthConfig in project jkube by eclipse.

the class OpenShiftRegistryAuthHandlerTest method testOpenShiftConfigFromPluginConfig.

@Test
public void testOpenShiftConfigFromPluginConfig() throws Exception {
    executeWithTempHomeDir(homeDir -> {
        createOpenShiftConfig(homeDir, "openshift_simple_config.yaml");
        AuthConfig config = handler.create(RegistryAuthConfig.Kind.PUSH, "roland", null, s -> s);
        verifyAuthConfig(config, "admin", "token123", null);
    });
}
Also used : AuthConfig(org.eclipse.jkube.kit.build.api.auth.AuthConfig) RegistryAuthConfig(org.eclipse.jkube.kit.build.api.auth.RegistryAuthConfig) Test(org.junit.Test)

Example 5 with AuthConfig

use of org.eclipse.jkube.kit.build.api.auth.AuthConfig in project jkube by eclipse.

the class SystemPropertyRegistryAuthHandlerTest method testSystemProperty.

@Test
public void testSystemProperty() throws Exception {
    System.setProperty("jkube.docker.push.username", "roland");
    System.setProperty("jkube.docker.push.password", "secret");
    System.setProperty("jkube.docker.push.email", "roland@jolokia.org");
    try {
        AuthConfig config = handler.create(RegistryAuthConfig.Kind.PUSH, null, null, s -> s);
        verifyAuthConfig(config, "roland", "secret", "roland@jolokia.org");
    } finally {
        System.clearProperty("jkube.docker.push.username");
        System.clearProperty("jkube.docker.push.password");
        System.clearProperty("jkube.docker.push.email");
    }
}
Also used : AuthConfig(org.eclipse.jkube.kit.build.api.auth.AuthConfig) RegistryAuthConfig(org.eclipse.jkube.kit.build.api.auth.RegistryAuthConfig) Test(org.junit.Test)

Aggregations

AuthConfig (org.eclipse.jkube.kit.build.api.auth.AuthConfig)42 Test (org.junit.Test)34 RegistryAuthConfig (org.eclipse.jkube.kit.build.api.auth.RegistryAuthConfig)10 JsonObject (com.google.gson.JsonObject)6 Expectations (mockit.Expectations)6 IOException (java.io.IOException)4 HashMap (java.util.HashMap)4 Date (java.util.Date)3 MockUp (mockit.MockUp)3 ImageName (org.eclipse.jkube.kit.config.image.ImageName)3 ArrayList (java.util.ArrayList)2 HttpPost (org.apache.http.client.methods.HttpPost)2 StringEntity (org.apache.http.entity.StringEntity)2 AuthConfigFactory (org.eclipse.jkube.kit.build.service.docker.auth.AuthConfigFactory)2 RegistryServerConfiguration (org.eclipse.jkube.kit.common.RegistryServerConfiguration)2 SystemMock (org.eclipse.jkube.kit.common.SystemMock)2 Credential (com.google.cloud.tools.jib.api.Credential)1 Gson (com.google.gson.Gson)1 JsonPrimitive (com.google.gson.JsonPrimitive)1 KubernetesList (io.fabric8.kubernetes.api.model.KubernetesList)1