use of git4idea.remote.GitHttpAuthDataProvider in project intellij-community by JetBrains.
the class GitHttpGuiAuthenticator method askUsername.
@Override
@NotNull
public String askUsername(@NotNull String url) {
myUnifiedUrl = getUnifiedUrl(url);
Pair<GitHttpAuthDataProvider, AuthData> authData = findBestAuthData(getUnifiedUrl(url));
String login = null;
String password = null;
if (authData != null) {
login = authData.second.getLogin();
password = authData.second.getPassword();
myDataProvider = authData.first;
}
LOG.debug("askUsername. dataProvider=" + getCurrentDataProviderName() + ", unifiedUrl= " + getUnifiedUrl(url) + ", login=" + login + ", passwordKnown=" + (password != null));
if (login != null && password != null) {
myPassword = password;
return login;
}
AuthDialog dialog = showAuthDialog(getDisplayableUrl(url), login);
LOG.debug("askUsername. Showed dialog:" + (dialog == null ? "NULL" : dialog.isOK() ? "OK" : "Cancel"));
if (dialog == null || !dialog.isOK()) {
myWasCancelled = true;
return "";
}
// remember values to store in the database afterwards, if authentication succeeds
myPassword = dialog.getPassword();
myLogin = dialog.getUsername();
mySaveOnDisk = dialog.isRememberPassword();
myPasswordKey = makeKey(myUnifiedUrl, myLogin);
return myLogin;
}
Aggregations