From 086f2ce821d41363460d1b897b3631dc498524c5 Mon Sep 17 00:00:00 2001 From: Jacek Poreda Date: Tue, 10 Dec 2024 15:19:41 +0100 Subject: SONAR-23932 Update sonar-plugin-api and remove dropped methods --- gradle.properties | 2 +- .../org/sonar/auth/bitbucket/IntegrationTest.java | 20 -------------------- .../java/org/sonar/auth/github/IntegrationTest.java | 19 ------------------- .../org/sonar/auth/saml/SamlIdentityProviderIT.java | 18 ------------------ .../server/authentication/BaseContextFactory.java | 14 -------------- .../CredentialsExternalAuthentication.java | 7 +++---- .../server/authentication/OAuth2ContextFactory.java | 10 ---------- .../authentication/BaseContextFactoryTest.java | 2 -- .../authentication/OAuth2ContextFactoryTest.java | 3 --- 9 files changed, 4 insertions(+), 91 deletions(-) diff --git a/gradle.properties b/gradle.properties index 5f7d20503cd..5b303bc4702 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ version=25.1 # 30 months from the release date for LTA versions # No change required for patch versions versionEOL=2026-07-01 -pluginApiVersion=10.14.0.2599 +pluginApiVersion=11.0.0.2664 description=Open source platform for continuous inspection of code quality projectTitle=SonarQube org.gradle.jvmargs=-Xmx2048m diff --git a/server/sonar-auth-bitbucket/src/test/java/org/sonar/auth/bitbucket/IntegrationTest.java b/server/sonar-auth-bitbucket/src/test/java/org/sonar/auth/bitbucket/IntegrationTest.java index a490ace714b..bf1919ea5b4 100644 --- a/server/sonar-auth-bitbucket/src/test/java/org/sonar/auth/bitbucket/IntegrationTest.java +++ b/server/sonar-auth-bitbucket/src/test/java/org/sonar/auth/bitbucket/IntegrationTest.java @@ -24,7 +24,6 @@ import java.util.Arrays; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; @@ -266,15 +265,6 @@ public class IntegrationTest { throw new UnsupportedOperationException("not used"); } - @Override - public HttpServletRequest getRequest() { - throw new UnsupportedOperationException("deprecated"); - } - - @Override - public HttpServletResponse getResponse() { - throw new UnsupportedOperationException("deprecated"); - } } private static class DumbInitContext implements OAuth2IdentityProvider.InitContext { @@ -309,15 +299,5 @@ public class IntegrationTest { public HttpResponse getHttpResponse() { return null; } - - @Override - public HttpServletRequest getRequest() { - return null; - } - - @Override - public HttpServletResponse getResponse() { - return null; - } } } diff --git a/server/sonar-auth-github/src/test/java/org/sonar/auth/github/IntegrationTest.java b/server/sonar-auth-github/src/test/java/org/sonar/auth/github/IntegrationTest.java index 3e4a29a9c48..30fa54728e6 100644 --- a/server/sonar-auth-github/src/test/java/org/sonar/auth/github/IntegrationTest.java +++ b/server/sonar-auth-github/src/test/java/org/sonar/auth/github/IntegrationTest.java @@ -26,7 +26,6 @@ import java.util.List; import java.util.TreeSet; import java.util.concurrent.atomic.AtomicBoolean; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; @@ -460,15 +459,6 @@ public class IntegrationTest { throw new UnsupportedOperationException("not used"); } - @Override - public HttpServletRequest getRequest() { - throw new UnsupportedOperationException("deprecated"); - } - - @Override - public HttpServletResponse getResponse() { - throw new UnsupportedOperationException("deprecated"); - } } private static class DumbInitContext implements OAuth2IdentityProvider.InitContext { @@ -504,14 +494,5 @@ public class IntegrationTest { return null; } - @Override - public HttpServletRequest getRequest() { - return null; - } - - @Override - public HttpServletResponse getResponse() { - return null; - } } } diff --git a/server/sonar-auth-saml/src/it/java/org/sonar/auth/saml/SamlIdentityProviderIT.java b/server/sonar-auth-saml/src/it/java/org/sonar/auth/saml/SamlIdentityProviderIT.java index ebf0e0c9a5b..f179a7717d4 100644 --- a/server/sonar-auth-saml/src/it/java/org/sonar/auth/saml/SamlIdentityProviderIT.java +++ b/server/sonar-auth-saml/src/it/java/org/sonar/auth/saml/SamlIdentityProviderIT.java @@ -380,15 +380,6 @@ public class SamlIdentityProviderIT { return new JavaxHttpResponse(response); } - @Override - public HttpServletRequest getRequest() { - throw new UnsupportedOperationException("deprecated"); - } - - @Override - public HttpServletResponse getResponse() { - throw new UnsupportedOperationException("deprecated"); - } } private static class DumbCallbackContext implements OAuth2IdentityProvider.CallbackContext { @@ -454,14 +445,5 @@ public class SamlIdentityProviderIT { return new JavaxHttpResponse(response); } - @Override - public HttpServletRequest getRequest() { - return null; - } - - @Override - public HttpServletResponse getResponse() { - return null; - } } } diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/BaseContextFactory.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/BaseContextFactory.java index bb7f7366820..1d50e955ada 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/BaseContextFactory.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/BaseContextFactory.java @@ -19,8 +19,6 @@ */ package org.sonar.server.authentication; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import org.sonar.api.platform.Server; import org.sonar.api.server.authentication.BaseIdentityProvider; import org.sonar.api.server.authentication.UserIdentity; @@ -28,8 +26,6 @@ import org.sonar.api.server.http.HttpRequest; import org.sonar.api.server.http.HttpResponse; import org.sonar.db.user.UserDto; import org.sonar.server.authentication.event.AuthenticationEvent.Source; -import org.sonar.server.http.JavaxHttpRequest; -import org.sonar.server.http.JavaxHttpResponse; import org.sonar.server.user.ThreadLocalUserSession; import org.sonar.server.user.UserSessionFactory; @@ -75,16 +71,6 @@ public class BaseContextFactory { return response; } - @Override - public HttpServletRequest getRequest() { - return ((JavaxHttpRequest) request).getDelegate(); - } - - @Override - public HttpServletResponse getResponse() { - return ((JavaxHttpResponse) response).getDelegate(); - } - @Override public String getServerBaseURL() { return server.getPublicRootUrl(); diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/CredentialsExternalAuthentication.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/CredentialsExternalAuthentication.java index 65ef290d7c4..70553116a60 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/CredentialsExternalAuthentication.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/CredentialsExternalAuthentication.java @@ -94,7 +94,7 @@ public class CredentialsExternalAuthentication implements Startable { private UserDto doAuthenticate(Credentials credentials, HttpRequest request, AuthenticationEvent.Method method) { try { HttpServletRequest httpServletRequest = ((JavaxHttpRequest) request).getDelegate(); - ExternalUsersProvider.Context externalUsersProviderContext = new ExternalUsersProvider.Context(credentials.getLogin(), request, httpServletRequest); + ExternalUsersProvider.Context externalUsersProviderContext = new ExternalUsersProvider.Context(credentials.getLogin(), request); UserDetails details = externalUsersProvider.doGetUserDetails(externalUsersProviderContext); if (details == null) { throw AuthenticationException.newBuilder() @@ -104,7 +104,7 @@ public class CredentialsExternalAuthentication implements Startable { .build(); } - Authenticator.Context authenticatorContext = new Authenticator.Context(credentials.getLogin(), credentials.getPassword().orElse(null), request, httpServletRequest); + Authenticator.Context authenticatorContext = new Authenticator.Context(credentials.getLogin(), credentials.getPassword().orElse(null), request); boolean status = authenticator.doAuthenticate(authenticatorContext); if (!status) { throw AuthenticationException.newBuilder() @@ -140,8 +140,7 @@ public class CredentialsExternalAuthentication implements Startable { .setEmail(trimToNull(details.getEmail())) .setProviderLogin(userLogin); if (externalGroupsProvider != null) { - HttpServletRequest httpServletRequest = ((JavaxHttpRequest) request).getDelegate(); - ExternalGroupsProvider.Context context = new ExternalGroupsProvider.Context(userLogin, request, httpServletRequest); + ExternalGroupsProvider.Context context = new ExternalGroupsProvider.Context(userLogin, request); Collection groups = externalGroupsProvider.doGetGroups(context); userIdentityBuilder.setGroups(new HashSet<>(groups)); } diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2ContextFactory.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2ContextFactory.java index 2e42458b592..9b6bd81e60e 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2ContextFactory.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2ContextFactory.java @@ -107,16 +107,6 @@ public class OAuth2ContextFactory { return response; } - @Override - public HttpServletRequest getRequest() { - return ((JavaxHttpRequest) request).getDelegate(); - } - - @Override - public HttpServletResponse getResponse() { - return ((JavaxHttpResponse) response).getDelegate(); - } - @Override public void redirectTo(String url) { try { diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/BaseContextFactoryTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/BaseContextFactoryTest.java index f7ee17d40c1..9bc79673382 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/BaseContextFactoryTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/BaseContextFactoryTest.java @@ -81,8 +81,6 @@ public class BaseContextFactoryTest { assertThat(context.getHttpRequest()).isEqualTo(httpRequest); assertThat(context.getHttpResponse()).isEqualTo(httpResponse); - assertThat(context.getRequest()).isEqualTo(request); - assertThat(context.getResponse()).isEqualTo(response); assertThat(context.getServerBaseURL()).isEqualTo(PUBLIC_ROOT_URL); } diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2ContextFactoryTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2ContextFactoryTest.java index fe6e2741ba0..6260841dfdc 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2ContextFactoryTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2ContextFactoryTest.java @@ -90,9 +90,6 @@ public class OAuth2ContextFactoryTest { assertThat(context.getHttpRequest()).isEqualTo(httpRequest); assertThat(context.getHttpResponse()).isEqualTo(httpResponse); - assertThat(context.getRequest()).isEqualTo(request); - assertThat(context.getResponse()).isEqualTo(response); - assertThat(context.getCallbackUrl()).isEqualTo("https://mydomain.com/oauth2/callback/github"); } -- cgit v1.2.3