Skip to content

Commit

Permalink
Port away from deprecated GitHttpAuthDataProvider API
Browse files Browse the repository at this point in the history
  • Loading branch information
uwolfer committed Jun 13, 2021
1 parent f89f94f commit 6d83069
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package com.urswolfer.intellij.plugin.gerrit.extension;

import com.google.inject.Inject;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.AuthData;
import com.urswolfer.intellij.plugin.gerrit.GerritModule;
Expand All @@ -37,9 +38,8 @@ public class GerritHttpAuthDataProvider implements GitHttpAuthDataProvider {
@Inject
private GerritSettings gerritSettings;

@Nullable
@Override
public AuthData getAuthData(@NotNull String url) {
public @Nullable AuthData getAuthData(@NotNull Project project, @NotNull String url) {
if (!gerritSettings.getHost().equalsIgnoreCase(url)) {
return null;
}
Expand All @@ -51,7 +51,7 @@ public AuthData getAuthData(@NotNull String url) {
}

@Override
public void forgetPassword(@NotNull String url) {
public void forgetPassword(@NotNull Project project, @NotNull String url, @NotNull AuthData authData) {
if (gerritSettings.getHost().equalsIgnoreCase(url)) {
gerritSettings.forgetPassword();
}
Expand All @@ -66,13 +66,18 @@ public Proxy() {

@Nullable
@Override
public AuthData getAuthData(@NotNull String url) {
return delegate.getAuthData(url);
public AuthData getAuthData(@NotNull Project project, @NotNull String url) {
return delegate.getAuthData(project, url);
}

@Override
public void forgetPassword(@NotNull String url) {
delegate.forgetPassword(url);
public @Nullable AuthData getAuthData(@NotNull Project project, @NotNull String url, @NotNull String login) {
return delegate.getAuthData(project, url, login);
}

@Override
public void forgetPassword(@NotNull Project project, @NotNull String url, @NotNull AuthData authData) {
delegate.forgetPassword(project, url, authData);
}
}
}

0 comments on commit 6d83069

Please sign in to comment.