Skip to content

Commit

Permalink
remove useless char "?" at the end of redirect_uri
Browse files Browse the repository at this point in the history
it's not compatible with gitlab-ce 12.5, gitlab will return 401 when trying to get access_token.
  • Loading branch information
zhangethan authored Jul 13, 2023
1 parent ca26368 commit 2be2827
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/main/java/org/jenkinsci/plugins/GitLabSecurityRealm.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,9 @@ public HttpResponse doCommenceLogin(StaplerRequest request, @QueryParameter Stri

private String buildRedirectUrl(StaplerRequest request) throws MalformedURLException {
URL currentUrl = new URL(Jenkins.get().getRootUrl());
List<NameValuePair> parameters = new ArrayList<>();

URL redirect_uri = new URL(currentUrl.getProtocol(), currentUrl.getHost(), currentUrl.getPort(),
request.getContextPath() + "/securityRealm/finishLogin?" + URLEncodedUtils.format(parameters, StandardCharsets.UTF_8));
request.getContextPath() + "/securityRealm/finishLogin");

Check warning on line 295 in src/main/java/org/jenkinsci/plugins/GitLabSecurityRealm.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 295 is not covered by tests
return redirect_uri.toString();
}

Expand Down

0 comments on commit 2be2827

Please sign in to comment.