Skip to content

Commit

Permalink
[JENKINS-73139] Adapt Kubernetes Credentials for Jetty 12 (EE 8)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Jul 10, 2024
1 parent a36e093 commit 559e4f2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>

<!-- jenkins versions -->
<jenkins.version>2.401.3</jenkins.version>
<!-- TODO JENKINS-73130 https://ci.jenkins.io/job/Core/job/jenkins/job/prototype/ -->
<jenkins.version>2.468-rc35110.010999645350</jenkins.version>
<bom.artifactId>bom-2.401.x</bom.artifactId>
<bom.version>2745.vc7b_fe4c876fa_</bom.version>

Expand All @@ -51,6 +52,10 @@

<spotbugs.effort>Max</spotbugs.effort>
<spotbugs.threshold>Low</spotbugs.threshold>

<!-- TODO JENKINS-73339 until in parent POM -->
<jenkins-test-harness.version>2244.v77428109fd1f</jenkins-test-harness.version>
<maven.compiler.release>17</maven.compiler.release>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.jenkinsci.plugins.kubernetes.credentials;

import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.ee8.nested.Request;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
Expand Down Expand Up @@ -36,10 +36,12 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
// Now create matcher object.
Matcher m = r.matcher(request.getPathInfo());
if (m.find()) {
Request jettyRequest = (Request) request;
String rootUrl = jettyRequest.getHttpURI().getScheme() + "://" + jettyRequest.getHttpURI().getHost() + ":" + jettyRequest.getHttpURI().getPort();
String responseToClient = "{\n" +
" \"issuer\": \"" + ((Request) request).getRootURL() + "\",\n" +
" \"authorization_endpoint\": \"" + ((Request) request).getRootURL() + "/" + m.group(1) + "/oauth/authorize\",\n" +
" \"token_endpoint\": \"" + ((Request) request).getRootURL() + "/oauth/token\",\n" +
" \"issuer\": \"" + rootUrl + "\",\n" +
" \"authorization_endpoint\": \"" + rootUrl + "/" + m.group(1) + "/oauth/authorize\",\n" +
" \"token_endpoint\": \"" + rootUrl + "/oauth/token\",\n" +
" \"scopes_supported\": [\n" +
" \"user:check-access\",\n" +
" \"user:full\",\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.cloudbees.plugins.credentials.CredentialsScope;
import hudson.util.Secret;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.ee8.servlet.ServletContextHandler;
import org.eclipse.jetty.ee8.servlet.ServletHolder;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand Down

0 comments on commit 559e4f2

Please sign in to comment.