@Test public void testFromPluginConfigurationPull() throws IOException { 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"); }
@Override public AuthConfig create(RegistryAuthConfig.Kind kind, String user, String registry, Function<String, String> decryptor) { if (registryAuthConfig.getUsername(kind) != null) { if (registryAuthConfig.getPassword(kind) == null) { throw new IllegalArgumentException("No 'password' given while using <authConfig> in configuration for mode " + kind); } log.debug("AuthConfig: credentials from plugin config"); return AuthConfig.fromRegistryAuthConfig(registryAuthConfig, kind, decryptor); } return null; }
FromConfigRegistryAuthHandler implements RegistryAuthHandler { @Override public AuthConfig create(RegistryAuthConfig.Kind kind, String user, String registry, Function<String, String> decryptor) { if (registryAuthConfig.getUsername(kind) != null) { if (registryAuthConfig.getPassword(kind) == null) { throw new IllegalArgumentException("No 'password' given while using <authConfig> in configuration for mode " + kind); } log.debug("AuthConfig: credentials from plugin config"); return AuthConfig.fromRegistryAuthConfig(registryAuthConfig, kind, decryptor); } return null; } }
FromConfigRegistryAuthHandler implements RegistryAuthHandler { @Override public AuthConfig create(RegistryAuthConfig.Kind kind, String user, String registry, Function<String, String> decryptor) { if (registryAuthConfig.getUsername(kind) != null) { if (registryAuthConfig.getPassword(kind) == null) { throw new IllegalArgumentException("No 'password' given while using <authConfig> in configuration for mode " + kind); } log.debug("AuthConfig: credentials from plugin config"); return AuthConfig.fromRegistryAuthConfig(registryAuthConfig, kind, decryptor); } return null; } FromConfigRegistryAuthHandler(RegistryAuthConfig registryAuthConfig, KitLogger log); }
FromConfigRegistryAuthHandler implements RegistryAuthHandler { @Override public AuthConfig create(RegistryAuthConfig.Kind kind, String user, String registry, Function<String, String> decryptor) { if (registryAuthConfig.getUsername(kind) != null) { if (registryAuthConfig.getPassword(kind) == null) { throw new IllegalArgumentException("No 'password' given while using <authConfig> in configuration for mode " + kind); } log.debug("AuthConfig: credentials from plugin config"); return AuthConfig.fromRegistryAuthConfig(registryAuthConfig, kind, decryptor); } return null; } FromConfigRegistryAuthHandler(RegistryAuthConfig registryAuthConfig, KitLogger log); @Override String getId(); @Override AuthConfig create(RegistryAuthConfig.Kind kind, String user, String registry, Function<String, String> decryptor); }
FromConfigRegistryAuthHandler implements RegistryAuthHandler { @Override public AuthConfig create(RegistryAuthConfig.Kind kind, String user, String registry, Function<String, String> decryptor) { if (registryAuthConfig.getUsername(kind) != null) { if (registryAuthConfig.getPassword(kind) == null) { throw new IllegalArgumentException("No 'password' given while using <authConfig> in configuration for mode " + kind); } log.debug("AuthConfig: credentials from plugin config"); return AuthConfig.fromRegistryAuthConfig(registryAuthConfig, kind, decryptor); } return null; } FromConfigRegistryAuthHandler(RegistryAuthConfig registryAuthConfig, KitLogger log); @Override String getId(); @Override AuthConfig create(RegistryAuthConfig.Kind kind, String user, String registry, Function<String, String> decryptor);  }