diff --git a/pom.xml b/pom.xml
index 54e2dc39..ec9dadff 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,17 +45,27 @@
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
com.google.http-client
google-http-client
1.44.2
+
+
+ com.google.errorprone
+ error_prone_annotations
+
+
+ com.google.guava
+ guava
+
+
com.google.http-client
@@ -67,6 +77,12 @@
com.google.oauth-client
google-oauth-client
1.36.0
+
+
+ com.google.guava
+ guava
+
+
io.burt
@@ -90,7 +106,6 @@
${configuration-as-code.version}
test
-
org.apache.httpcomponents
httpclient
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..5bb2836a
--- /dev/null
+++ b/src/test/java/org/jenkinsci/plugins/oic/MockHttpServletRequest.java
@@ -0,0 +1,371 @@
+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();
+ }
+}