diff options
Diffstat (limited to 'plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java')
-rw-r--r-- | plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java b/plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java index e0312e5471fc..c5931f98df10 100644 --- a/plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java +++ b/plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java @@ -57,7 +57,6 @@ class GitHttpGuiAuthenticator implements GitHttpAuthenticator { private static final Class<GitHttpAuthenticator> PASS_REQUESTER = GitHttpAuthenticator.class; @NotNull private final Project myProject; - @Nullable private final ModalityState myModalityState; @NotNull private final String myTitle; @NotNull private final String myUrlFromCommand; @@ -69,10 +68,8 @@ class GitHttpGuiAuthenticator implements GitHttpAuthenticator { @Nullable private GitHttpAuthDataProvider myDataProvider; private boolean myWasCancelled; - GitHttpGuiAuthenticator(@NotNull Project project, @Nullable ModalityState modalityState, @NotNull GitCommand command, - @NotNull String url) { + GitHttpGuiAuthenticator(@NotNull Project project, @NotNull GitCommand command, @NotNull String url) { myProject = project; - myModalityState = modalityState; myTitle = "Git " + StringUtil.capitalize(command.name()); myUrlFromCommand = url; } @@ -87,7 +84,7 @@ class GitHttpGuiAuthenticator implements GitHttpAuthenticator { return ""; } url = adjustUrl(url); - Pair<GitHttpAuthDataProvider, AuthData> authData = findBestAuthData(url, myModalityState); + Pair<GitHttpAuthDataProvider, AuthData> authData = findBestAuthData(url); if (authData != null && authData.second.getPassword() != null) { String password = authData.second.getPassword(); myDataProvider = authData.first; @@ -97,7 +94,7 @@ class GitHttpGuiAuthenticator implements GitHttpAuthenticator { String prompt = "Enter the password for " + url; myPasswordKey = url; - String password = PasswordSafePromptDialog.askPassword(myProject, myModalityState, myTitle, prompt, PASS_REQUESTER, url, false, null); + String password = PasswordSafePromptDialog.askPassword(myProject, myTitle, prompt, PASS_REQUESTER, url, false, null); if (password == null) { myWasCancelled = true; return ""; @@ -114,7 +111,7 @@ class GitHttpGuiAuthenticator implements GitHttpAuthenticator { @NotNull public String askUsername(@NotNull String url) { url = adjustUrl(url); - Pair<GitHttpAuthDataProvider, AuthData> authData = findBestAuthData(url, myModalityState); + Pair<GitHttpAuthDataProvider, AuthData> authData = findBestAuthData(url); String login = null; String password = null; if (authData != null) { @@ -152,7 +149,7 @@ class GitHttpGuiAuthenticator implements GitHttpAuthenticator { dialog.set(new AuthDialog(myProject, myTitle, "Enter credentials for " + url, login, null, true)); dialog.get().show(); } - }, myModalityState == null ? ModalityState.defaultModalityState() : myModalityState); + }, ModalityState.any()); return dialog.get(); } @@ -223,10 +220,10 @@ class GitHttpGuiAuthenticator implements GitHttpAuthenticator { // 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, @Nullable ModalityState modalityState) { + private Pair<GitHttpAuthDataProvider, AuthData> findBestAuthData(@NotNull String url) { Pair<GitHttpAuthDataProvider, AuthData> candidate = null; for (GitHttpAuthDataProvider provider : getProviders()) { - AuthData data = provider.getAuthData(url, modalityState); + AuthData data = provider.getAuthData(url); if (data != null) { Pair<GitHttpAuthDataProvider, AuthData> pair = Pair.create(provider, data); if (data.getPassword() != null) { @@ -268,12 +265,12 @@ class GitHttpGuiAuthenticator implements GitHttpAuthenticator { @Nullable @Override - public AuthData getAuthData(@NotNull String url, @Nullable ModalityState modalityState) { + public AuthData getAuthData(@NotNull String url) { String userName = getUsername(url); String key = makeKey(url, userName); final PasswordSafe passwordSafe = PasswordSafe.getInstance(); try { - String password = passwordSafe.getPassword(myProject, PASS_REQUESTER, key, modalityState); + String password = passwordSafe.getPassword(myProject, PASS_REQUESTER, key); return new AuthData(StringUtil.notNullize(userName), password); } catch (PasswordSafeException e) { |