From 760f08ac62fa98d9e26521f3fe43f0f0ed789054 Mon Sep 17 00:00:00 2001 From: Michael DOUBEZ Date: Wed, 3 Jul 2024 13:16:08 +0200 Subject: [PATCH 1/7] Bump Jenkins version to 2.426.3 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 54e2dc39..2c93f779 100644 --- a/pom.xml +++ b/pom.xml @@ -45,11 +45,11 @@ 4 999999-SNAPSHOT jenkinsci/oic-auth-plugin - 2.361.4 + 2.426.3 false true Max - 1569.vb_72405b_80249 + 1810.v9b_c30a_249a_4c From f40becc3c91be069a9956c93c27dc67c4caa8384 Mon Sep 17 00:00:00 2001 From: Michael DOUBEZ Date: Wed, 3 Jul 2024 13:34:16 +0200 Subject: [PATCH 2/7] Exclude error_prone annotations dep --- pom.xml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2c93f779..4fcbcb5e 100644 --- a/pom.xml +++ b/pom.xml @@ -61,12 +61,24 @@ com.google.http-client google-http-client-gson 1.44.2 + + + com.google.errorprone + error_prone_annotations + + com.google.oauth-client google-oauth-client 1.36.0 + + + com.google.errorprone + error_prone_annotations + + io.burt @@ -90,7 +102,6 @@ ${configuration-as-code.version} test - org.apache.httpcomponents httpclient From 1fd119c6d331feb49be8731854abfb3f7a995601 Mon Sep 17 00:00:00 2001 From: Michael DOUBEZ Date: Wed, 3 Jul 2024 14:01:03 +0200 Subject: [PATCH 3/7] Update pom.xml --- pom.xml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 4fcbcb5e..b7037f8a 100644 --- a/pom.xml +++ b/pom.xml @@ -56,29 +56,27 @@ com.google.http-client google-http-client 1.44.2 - - - com.google.http-client - google-http-client-gson - 1.44.2 + + com.google.guava + guava + com.google.errorprone error_prone_annotations + + com.google.http-client + google-http-client-gson + 1.44.2 + com.google.oauth-client google-oauth-client 1.36.0 - - - com.google.errorprone - error_prone_annotations - - io.burt From f3b2731bed3acc4dfe93be0bc890bb54f5182f7e Mon Sep 17 00:00:00 2001 From: Michael Doubez Date: Mon, 8 Jul 2024 23:11:22 +0200 Subject: [PATCH 4/7] Apply spotless --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index b7037f8a..87e57ba8 100644 --- a/pom.xml +++ b/pom.xml @@ -57,14 +57,14 @@ google-http-client 1.44.2 - - com.google.guava - guava - com.google.errorprone error_prone_annotations + + com.google.guava + guava + From ed528218e71702ed425b0955a4d6174b8fa70289 Mon Sep 17 00:00:00 2001 From: Michael Doubez Date: Tue, 9 Jul 2024 00:04:11 +0200 Subject: [PATCH 5/7] Exclude guava --- pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pom.xml b/pom.xml index 87e57ba8..ec9dadff 100644 --- a/pom.xml +++ b/pom.xml @@ -77,6 +77,12 @@ com.google.oauth-client google-oauth-client 1.36.0 + + + com.google.guava + guava + + io.burt From ee652bd33c847a1cf5a949808d84be56fbb4ad46 Mon Sep 17 00:00:00 2001 From: Michael Doubez Date: Tue, 9 Jul 2024 00:52:18 +0200 Subject: [PATCH 6/7] Make compatible with jetty 12 --- .../oic/EscapeHatchCrumbExclusionTest.java | 11 +- .../plugins/oic/MockHttpServletRequest.java | 372 ++++++++++++++++++ 2 files changed, 377 insertions(+), 6 deletions(-) create mode 100644 src/test/java/org/jenkinsci/plugins/oic/MockHttpServletRequest.java diff --git a/src/test/java/org/jenkinsci/plugins/oic/EscapeHatchCrumbExclusionTest.java b/src/test/java/org/jenkinsci/plugins/oic/EscapeHatchCrumbExclusionTest.java index 3d8d97e1..e3155ef5 100644 --- a/src/test/java/org/jenkinsci/plugins/oic/EscapeHatchCrumbExclusionTest.java +++ b/src/test/java/org/jenkinsci/plugins/oic/EscapeHatchCrumbExclusionTest.java @@ -6,7 +6,6 @@ import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.server.Request; import org.junit.Test; import static org.junit.Assert.assertFalse; @@ -19,8 +18,8 @@ public class EscapeHatchCrumbExclusionTest { private FilterChain chain = null; - private Request newRequestWithPath(String requestPath) { - return new Request(null, null) { + private MockHttpServletRequest newRequestWithPath(String requestPath) { + return new MockHttpServletRequest() { @Override public String getPathInfo() { return requestPath; @@ -30,13 +29,13 @@ public String getPathInfo() { @Test public void process_WithNullPath() throws IOException, ServletException { - Request request = new Request(null, null); + MockHttpServletRequest request = newRequestWithPath(""); assertFalse(crumb.process(request, response, chain)); } @Test public void process_WithWrongPath() throws IOException, ServletException { - Request request = newRequestWithPath("fictionalPath"); + MockHttpServletRequest request = newRequestWithPath("fictionalPath"); assertFalse(crumb.process(request, response, chain)); } @@ -49,7 +48,7 @@ public void doFilter(ServletRequest arg0, ServletResponse arg1) throws IOExcepti } }; - Request request = newRequestWithPath("/securityRealm/escapeHatch"); + MockHttpServletRequest request = newRequestWithPath("/securityRealm/escapeHatch"); assertTrue(crumb.process(request, response, chain)); } } diff --git a/src/test/java/org/jenkinsci/plugins/oic/MockHttpServletRequest.java b/src/test/java/org/jenkinsci/plugins/oic/MockHttpServletRequest.java new file mode 100644 index 00000000..bda5d7a6 --- /dev/null +++ b/src/test/java/org/jenkinsci/plugins/oic/MockHttpServletRequest.java @@ -0,0 +1,372 @@ +package org.jenkinsci.plugins.oic; + +import java.io.BufferedReader; +import java.security.Principal; +import java.util.Collection; +import java.util.Enumeration; +import java.util.Locale; +import java.util.Map; +import javax.servlet.AsyncContext; +import javax.servlet.DispatcherType; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletContext; +import javax.servlet.ServletInputStream; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpUpgradeHandler; +import javax.servlet.http.Part; + +public class MockHttpServletRequest implements HttpServletRequest { + + public MockHttpServletRequest() { + } + + @Override + public String getAuthType() { + throw new UnsupportedOperationException(); + } + + @Override + public Cookie[] getCookies() { + throw new UnsupportedOperationException(); + } + + @Override + public long getDateHeader(String name) { + throw new UnsupportedOperationException(); + } + + @Override + public String getHeader(String name) { + throw new UnsupportedOperationException(); + } + + @Override + public Enumeration getHeaders(String name) { + throw new UnsupportedOperationException(); + } + + @Override + public Enumeration getHeaderNames() { + throw new UnsupportedOperationException(); + } + + @Override + public int getIntHeader(String name) { + throw new UnsupportedOperationException(); + } + + @Override + public String getMethod() { + throw new UnsupportedOperationException(); + } + + @Override + public String getPathInfo() { + throw new UnsupportedOperationException(); + } + + @Override + public String getPathTranslated() { + throw new UnsupportedOperationException(); + } + + @Override + public String getContextPath() { + throw new UnsupportedOperationException(); + } + + @Override + public String getQueryString() { + throw new UnsupportedOperationException(); + } + + @Override + public String getRemoteUser() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isUserInRole(String role) { + throw new UnsupportedOperationException(); + } + + @Override + public Principal getUserPrincipal() { + throw new UnsupportedOperationException(); + } + + @Override + public String getRequestedSessionId() { + throw new UnsupportedOperationException(); + } + + @Override + public String getRequestURI() { + return "/"; + } + + @Override + public StringBuffer getRequestURL() { + throw new UnsupportedOperationException(); + } + + @Override + public String getServletPath() { + throw new UnsupportedOperationException(); + } + + @Override + public HttpSession getSession(boolean create) { + throw new UnsupportedOperationException(); + } + + @Override + public HttpSession getSession() { + throw new UnsupportedOperationException(); + } + + @Override + public String changeSessionId() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isRequestedSessionIdValid() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isRequestedSessionIdFromCookie() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isRequestedSessionIdFromURL() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isRequestedSessionIdFromUrl() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean authenticate(HttpServletResponse response) { + throw new UnsupportedOperationException(); + } + + @Override + public void login(String username, String password) { + throw new UnsupportedOperationException(); + } + + @Override + public void logout() { + throw new UnsupportedOperationException(); + } + + @Override + public Collection getParts() { + throw new UnsupportedOperationException(); + } + + @Override + public Part getPart(String name) { + throw new UnsupportedOperationException(); + } + + @Override + public T upgrade(Class handlerClass) { + throw new UnsupportedOperationException(); + } + + @Override + public Object getAttribute(String name) { + throw new UnsupportedOperationException(); + } + + @Override + public Enumeration getAttributeNames() { + throw new UnsupportedOperationException(); + } + + @Override + public String getCharacterEncoding() { + throw new UnsupportedOperationException(); + } + + @Override + public void setCharacterEncoding(String env) { + throw new UnsupportedOperationException(); + } + + @Override + public int getContentLength() { + throw new UnsupportedOperationException(); + } + + @Override + public long getContentLengthLong() { + throw new UnsupportedOperationException(); + } + + @Override + public String getContentType() { + return null; + } + + @Override + public ServletInputStream getInputStream() { + throw new UnsupportedOperationException(); + } + + @Override + public String getParameter(String name) { + throw new UnsupportedOperationException(); + } + + @Override + public Enumeration getParameterNames() { + throw new UnsupportedOperationException(); + } + + @Override + public String[] getParameterValues(String name) { + throw new UnsupportedOperationException(); + } + + @Override + public Map getParameterMap() { + throw new UnsupportedOperationException(); + } + + @Override + public String getProtocol() { + throw new UnsupportedOperationException(); + } + + @Override + public String getScheme() { + throw new UnsupportedOperationException(); + } + + @Override + public String getServerName() { + throw new UnsupportedOperationException(); + } + + @Override + public int getServerPort() { + throw new UnsupportedOperationException(); + } + + @Override + public BufferedReader getReader() { + throw new UnsupportedOperationException(); + } + + @Override + public String getRemoteAddr() { + throw new UnsupportedOperationException(); + } + + @Override + public String getRemoteHost() { + throw new UnsupportedOperationException(); + } + + @Override + public void setAttribute(String name, Object o) { + throw new UnsupportedOperationException(); + } + + @Override + public void removeAttribute(String name) { + throw new UnsupportedOperationException(); + } + + @Override + public Locale getLocale() { + throw new UnsupportedOperationException(); + } + + @Override + public Enumeration getLocales() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isSecure() { + throw new UnsupportedOperationException(); + } + + @Override + public RequestDispatcher getRequestDispatcher(String path) { + throw new UnsupportedOperationException(); + } + + @Override + public String getRealPath(String path) { + throw new UnsupportedOperationException(); + } + + @Override + public int getRemotePort() { + throw new UnsupportedOperationException(); + } + + @Override + public String getLocalName() { + throw new UnsupportedOperationException(); + } + + @Override + public String getLocalAddr() { + throw new UnsupportedOperationException(); + } + + @Override + public int getLocalPort() { + throw new UnsupportedOperationException(); + } + + @Override + public ServletContext getServletContext() { + throw new UnsupportedOperationException(); + } + + @Override + public AsyncContext startAsync() { + throw new UnsupportedOperationException(); + } + + @Override + public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isAsyncStarted() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isAsyncSupported() { + throw new UnsupportedOperationException(); + } + + @Override + public AsyncContext getAsyncContext() { + throw new UnsupportedOperationException(); + } + + @Override + public DispatcherType getDispatcherType() { + throw new UnsupportedOperationException(); + } +} From 31c64a9ca490c92337dda5b6599f589361aae55d Mon Sep 17 00:00:00 2001 From: Michael Doubez Date: Tue, 9 Jul 2024 08:18:10 +0200 Subject: [PATCH 7/7] apply spotless --- .../java/org/jenkinsci/plugins/oic/MockHttpServletRequest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/java/org/jenkinsci/plugins/oic/MockHttpServletRequest.java b/src/test/java/org/jenkinsci/plugins/oic/MockHttpServletRequest.java index bda5d7a6..5bb2836a 100644 --- a/src/test/java/org/jenkinsci/plugins/oic/MockHttpServletRequest.java +++ b/src/test/java/org/jenkinsci/plugins/oic/MockHttpServletRequest.java @@ -22,8 +22,7 @@ public class MockHttpServletRequest implements HttpServletRequest { - public MockHttpServletRequest() { - } + public MockHttpServletRequest() {} @Override public String getAuthType() {