Skip to content

Commit 0965104

Browse files
committed
Removed unused code.
1 parent 3be2b70 commit 0965104

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/main/java/cd/go/authorization/github/executors/UserAuthenticationRequestExecutor.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import cd.go.authorization.github.GitHubAuthenticator;
2020
import cd.go.authorization.github.GitHubAuthorizer;
21-
import cd.go.authorization.github.GitHubClientBuilder;
2221
import cd.go.authorization.github.exceptions.NoAuthorizationConfigurationException;
2322
import cd.go.authorization.github.models.AuthConfig;
2423
import cd.go.authorization.github.models.LoggedInUserInfo;
@@ -30,21 +29,18 @@
3029
import java.util.Map;
3130

3231
import static cd.go.authorization.github.utils.Util.GSON;
33-
import static com.thoughtworks.go.plugin.api.response.DefaultGoApiResponse.SUCCESS_RESPONSE_CODE;
3432

3533
public class UserAuthenticationRequestExecutor implements RequestExecutor {
3634
private final UserAuthenticationRequest request;
37-
private final GitHubClientBuilder providerManager;
3835
private final GitHubAuthenticator gitHubAuthenticator;
3936
private final GitHubAuthorizer gitHubAuthorizer;
4037

4138
public UserAuthenticationRequestExecutor(UserAuthenticationRequest request) {
42-
this(request, new GitHubClientBuilder(), new GitHubAuthenticator(), new GitHubAuthorizer());
39+
this(request, new GitHubAuthenticator(), new GitHubAuthorizer());
4340
}
4441

45-
UserAuthenticationRequestExecutor(UserAuthenticationRequest request, GitHubClientBuilder providerManager, GitHubAuthenticator gitHubAuthenticator, GitHubAuthorizer gitHubAuthorizer) {
42+
UserAuthenticationRequestExecutor(UserAuthenticationRequest request, GitHubAuthenticator gitHubAuthenticator, GitHubAuthorizer gitHubAuthorizer) {
4643
this.request = request;
47-
this.providerManager = providerManager;
4844
this.gitHubAuthenticator = gitHubAuthenticator;
4945
this.gitHubAuthorizer = gitHubAuthorizer;
5046
}
@@ -64,7 +60,6 @@ public GoPluginApiResponse execute() throws Exception {
6460
userMap.put("roles", gitHubAuthorizer.authorize(loggedInUserInfo.getGitHubUser(), authConfig, request.roles()));
6561
}
6662

67-
DefaultGoPluginApiResponse response = new DefaultGoPluginApiResponse(SUCCESS_RESPONSE_CODE, GSON.toJson(userMap));
68-
return response;
63+
return DefaultGoPluginApiResponse.success(GSON.toJson(userMap));
6964
}
7065
}

src/test/java/cd/go/authorization/github/executors/UserAuthenticationRequestExecutorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void setUp() throws Exception {
5959
authenticator = mock(GitHubAuthenticator.class);
6060
gitHubClientBuilder = mock(GitHubClientBuilder.class);
6161

62-
executor = new UserAuthenticationRequestExecutor(request, gitHubClientBuilder, authenticator, authorizer);
62+
executor = new UserAuthenticationRequestExecutor(request, authenticator, authorizer);
6363
}
6464

6565
@Test

0 commit comments

Comments
 (0)