// return the first that knows username + password; otherwise return the first that knows just the // username @Nullable private Pair<GitHttpAuthDataProvider, AuthData> findBestAuthData(@NotNull String url) { Pair<GitHttpAuthDataProvider, AuthData> candidate = null; for (GitHttpAuthDataProvider provider : getProviders()) { AuthData data = provider.getAuthData(url); if (data != null) { Pair<GitHttpAuthDataProvider, AuthData> pair = Pair.create(provider, data); if (data.getPassword() != null) { return pair; } if (candidate == null) { candidate = pair; } } } return candidate; }
@Override public void forgetPassword() { LOG.debug( "forgetPassword. dataProvider=" + getCurrentDataProviderName() + ", unifiedUrl=" + myUnifiedUrl); if (myDataProvider != null && myUnifiedUrl != null) { myDataProvider.forgetPassword(myUnifiedUrl); } }
@Nullable private String getCurrentDataProviderName() { return myDataProvider == null ? null : myDataProvider.getClass().getName(); }