Skip to content

Commit 7a12756

Browse files
author
Nikos Anestos
committed
reverted withPath and added it on webServiceClient creation
1 parent 9bd959d commit 7a12756

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/main/java/io/curity/identityserver/plugin/github/authentication/CallbackRequestHandler.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ private Map<String, String> getUserInfo(@Nullable Object accessToken)
131131
throw _exceptionFactory.internalServerException(ErrorCode.EXTERNAL_SERVICE_ERROR);
132132
}
133133

134-
HttpResponse userInfoResponse = getWebServiceClient("https://api.github.com/")
135-
.withPath("user")
134+
HttpResponse userInfoResponse = getWebServiceClient("https://api.github.com/user")
136135
.request()
137136
.accept("application/json")
138137
.header("Authorization", "Bearer " + accessToken.toString())
@@ -178,7 +177,7 @@ private WebServiceClient getWebServiceClient(String uri)
178177
requiredScheme, configuredScheme));
179178
}
180179

181-
return _webServiceClientFactory.create(h).withHost(u.getHost());
180+
return _webServiceClientFactory.create(h).withHost(u.getHost()).withPath(u.getPath());
182181
}
183182
else
184183
{
@@ -188,8 +187,7 @@ private WebServiceClient getWebServiceClient(String uri)
188187

189188
private Map<String, Object> redeemCodeForTokens(CallbackGetRequestModel requestModel)
190189
{
191-
HttpResponse tokenResponse = getWebServiceClient("https://github.com/")
192-
.withPath("login/oauth/access_token")
190+
HttpResponse tokenResponse = getWebServiceClient("https://github.com/login/oauth/access_token")
193191
.request()
194192
.contentType("application/x-www-form-urlencoded")
195193
.accept("application/json")
@@ -231,8 +229,8 @@ private void checkUserOrganizationMembership(String username, String accessToken
231229
_config.getManageOrganization().ifPresent(manageOrganization ->
232230
manageOrganization.getOrganizationName().ifPresent(organizationName ->
233231
{
234-
HttpResponse tokenResponse = getWebServiceClient("https://api.github.com/")
235-
.withPath("orgs/" + organizationName + "/members/" + username)
232+
HttpResponse tokenResponse = getWebServiceClient("https://api.github.com/orgs/" +
233+
organizationName + "/members/" + username)
236234
.request()
237235
.accept("application/json")
238236
.header("Authorization", "Bearer " + accessToken)

0 commit comments

Comments
 (0)