@Test public void testFromSettingsDefault2() throws IOException { setupServers(); AuthConfig config = registryAuthHandler.create(RegistryAuthConfig.Kind.PUSH, "tanja", null, s -> s); assertNotNull(config); verifyAuthConfig(config,"tanja","doublesecret","tanja@jolokia.org"); }
@Override public AuthConfig create(RegistryAuthConfig.Kind kind, String user, String registry, Function<String, String> decryptor) { Server defaultServer = null; Server found; for (Server server : settings.getServers()) { String id = server.getId(); if (defaultServer == null) { defaultServer = checkForServer(server, id, registry, null); } found = checkForServer(server, id, registry, user); if (found != null) { log.debug("AuthConfig: credentials from ~/.m2/setting.xml (%s)", found); return createAuthConfigFromServer(found, decryptor); } } if (defaultServer != null) { log.debug("AuthConfig: credentials from ~/.m2/setting.xml (%s)", defaultServer); return createAuthConfigFromServer(defaultServer, decryptor); } return null; }
SettingsRegistryAuthHandler implements RegistryAuthHandler { @Override public AuthConfig create(RegistryAuthConfig.Kind kind, String user, String registry, Function<String, String> decryptor) { Server defaultServer = null; Server found; for (Server server : settings.getServers()) { String id = server.getId(); if (defaultServer == null) { defaultServer = checkForServer(server, id, registry, null); } found = checkForServer(server, id, registry, user); if (found != null) { log.debug("AuthConfig: credentials from ~/.m2/setting.xml (%s)", found); return createAuthConfigFromServer(found, decryptor); } } if (defaultServer != null) { log.debug("AuthConfig: credentials from ~/.m2/setting.xml (%s)", defaultServer); return createAuthConfigFromServer(defaultServer, decryptor); } return null; } }
SettingsRegistryAuthHandler implements RegistryAuthHandler { @Override public AuthConfig create(RegistryAuthConfig.Kind kind, String user, String registry, Function<String, String> decryptor) { Server defaultServer = null; Server found; for (Server server : settings.getServers()) { String id = server.getId(); if (defaultServer == null) { defaultServer = checkForServer(server, id, registry, null); } found = checkForServer(server, id, registry, user); if (found != null) { log.debug("AuthConfig: credentials from ~/.m2/setting.xml (%s)", found); return createAuthConfigFromServer(found, decryptor); } } if (defaultServer != null) { log.debug("AuthConfig: credentials from ~/.m2/setting.xml (%s)", defaultServer); return createAuthConfigFromServer(defaultServer, decryptor); } return null; } SettingsRegistryAuthHandler(Settings settings, KitLogger log); }
SettingsRegistryAuthHandler implements RegistryAuthHandler { @Override public AuthConfig create(RegistryAuthConfig.Kind kind, String user, String registry, Function<String, String> decryptor) { Server defaultServer = null; Server found; for (Server server : settings.getServers()) { String id = server.getId(); if (defaultServer == null) { defaultServer = checkForServer(server, id, registry, null); } found = checkForServer(server, id, registry, user); if (found != null) { log.debug("AuthConfig: credentials from ~/.m2/setting.xml (%s)", found); return createAuthConfigFromServer(found, decryptor); } } if (defaultServer != null) { log.debug("AuthConfig: credentials from ~/.m2/setting.xml (%s)", defaultServer); return createAuthConfigFromServer(defaultServer, decryptor); } return null; } SettingsRegistryAuthHandler(Settings settings, KitLogger log); @Override String getId(); @Override AuthConfig create(RegistryAuthConfig.Kind kind, String user, String registry, Function<String, String> decryptor); }
SettingsRegistryAuthHandler implements RegistryAuthHandler { @Override public AuthConfig create(RegistryAuthConfig.Kind kind, String user, String registry, Function<String, String> decryptor) { Server defaultServer = null; Server found; for (Server server : settings.getServers()) { String id = server.getId(); if (defaultServer == null) { defaultServer = checkForServer(server, id, registry, null); } found = checkForServer(server, id, registry, user); if (found != null) { log.debug("AuthConfig: credentials from ~/.m2/setting.xml (%s)", found); return createAuthConfigFromServer(found, decryptor); } } if (defaultServer != null) { log.debug("AuthConfig: credentials from ~/.m2/setting.xml (%s)", defaultServer); return createAuthConfigFromServer(defaultServer, decryptor); } return null; } SettingsRegistryAuthHandler(Settings settings, KitLogger log); @Override String getId(); @Override AuthConfig create(RegistryAuthConfig.Kind kind, String user, String registry, Function<String, String> decryptor);  }