aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver-auth
diff options
context:
space:
mode:
authorJacek Poreda <jacek.poreda@sonarsource.com>2024-12-11 13:08:24 +0100
committersonartech <sonartech@sonarsource.com>2024-12-18 20:03:11 +0000
commit6a146e820674a08f14b03db7f48f3ec7d393d38b (patch)
tree18e1663e8c7399f31bbc99f627d5223adfe472b3 /server/sonar-webserver-auth
parent086f2ce821d41363460d1b897b3631dc498524c5 (diff)
downloadsonarqube-6a146e820674a08f14b03db7f48f3ec7d393d38b.tar.gz
sonarqube-6a146e820674a08f14b03db7f48f3ec7d393d38b.zip
SONAR-19122 Upgrade to Spring 6
Diffstat (limited to 'server/sonar-webserver-auth')
-rw-r--r--server/sonar-webserver-auth/src/it/java/org/sonar/server/authentication/JwtHttpHandlerIT.java8
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/AuthenticationRedirection.java2
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/Cookies.java10
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/CredentialsExternalAuthentication.java3
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2AuthenticationParameters.java2
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2ContextFactory.java4
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/usertoken/notification/TokenExpirationEmailComposer.java4
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/BaseContextFactoryTest.java16
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsExternalAuthenticationTest.java6
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2AuthenticationParametersImplTest.java6
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2ContextFactoryTest.java12
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuthCsrfVerifierTest.java6
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/SamlValidationRedirectionFilterTest.java2
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContext.java18
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContextTest.java16
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/usertoken/notification/TokenExpirationEmailComposerTest.java4
16 files changed, 56 insertions, 63 deletions
diff --git a/server/sonar-webserver-auth/src/it/java/org/sonar/server/authentication/JwtHttpHandlerIT.java b/server/sonar-webserver-auth/src/it/java/org/sonar/server/authentication/JwtHttpHandlerIT.java
index 4ba2fed40e3..bdef1364725 100644
--- a/server/sonar-webserver-auth/src/it/java/org/sonar/server/authentication/JwtHttpHandlerIT.java
+++ b/server/sonar-webserver-auth/src/it/java/org/sonar/server/authentication/JwtHttpHandlerIT.java
@@ -22,11 +22,11 @@ package org.sonar.server.authentication;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.ClaimsBuilder;
import io.jsonwebtoken.impl.DefaultClaimsBuilder;
+import jakarta.servlet.http.HttpSession;
import java.util.Date;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;
-import javax.servlet.http.HttpSession;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -41,7 +41,7 @@ import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
import org.sonar.db.user.SessionTokenDto;
import org.sonar.db.user.UserDto;
-import org.sonar.server.http.JavaxHttpRequest;
+import org.sonar.server.http.JakartaHttpRequest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -278,7 +278,7 @@ public class JwtHttpHandlerIT {
@Test
public void validate_token_does_nothing_when_empty_value_in_jwt_cookie() {
- when(request.getCookies()).thenReturn(new Cookie[] {new JavaxHttpRequest.JavaxCookie(new javax.servlet.http.Cookie("JWT-SESSION", ""))});
+ when(request.getCookies()).thenReturn(new Cookie[] {new JakartaHttpRequest.JakartaCookie(new jakarta.servlet.http.Cookie("JWT-SESSION", ""))});
underTest.validateToken(request, response);
@@ -434,7 +434,7 @@ public class JwtHttpHandlerIT {
}
private Cookie addJwtCookie() {
- Cookie cookie = new JavaxHttpRequest.JavaxCookie(new javax.servlet.http.Cookie("JWT-SESSION", JWT_TOKEN));
+ Cookie cookie = new JakartaHttpRequest.JakartaCookie(new jakarta.servlet.http.Cookie("JWT-SESSION", JWT_TOKEN));
when(request.getCookies()).thenReturn(new Cookie[] {cookie});
return cookie;
}
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/AuthenticationRedirection.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/AuthenticationRedirection.java
index 76f29230bce..567ea370a44 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/AuthenticationRedirection.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/AuthenticationRedirection.java
@@ -21,7 +21,7 @@ package org.sonar.server.authentication;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletResponse;
import org.sonar.api.server.http.HttpResponse;
import static java.lang.String.format;
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/Cookies.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/Cookies.java
index 7c6dfd61886..3bd249c817e 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/Cookies.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/Cookies.java
@@ -24,15 +24,15 @@ import java.util.Optional;
import javax.annotation.Nullable;
import org.sonar.api.server.http.Cookie;
import org.sonar.api.server.http.HttpRequest;
-import org.sonar.server.http.JavaxHttpRequest.JavaxCookie;
+import org.sonar.server.http.JakartaHttpRequest.JakartaCookie;
import static com.google.common.base.Strings.isNullOrEmpty;
import static java.util.Objects.requireNonNull;
/**
- * Helper class to create a {@link javax.servlet.http.Cookie}.
+ * Helper class to create a {@link jakarta.servlet.http.Cookie}.
*
- * The {@link javax.servlet.http.Cookie#setSecure(boolean)} will automatically be set to true.
+ * The {@link jakarta.servlet.http.Cookie#setSecure(boolean)} will automatically be set to true.
*/
public class Cookies {
public static final String SET_COOKIE = "Set-Cookie";
@@ -115,12 +115,12 @@ public class Cookies {
}
public Cookie build() {
- javax.servlet.http.Cookie cookie = new javax.servlet.http.Cookie(requireNonNull(name), value);
+ jakarta.servlet.http.Cookie cookie = new jakarta.servlet.http.Cookie(requireNonNull(name), value);
cookie.setPath(getContextPath(request));
cookie.setSecure(isHttps(request));
cookie.setHttpOnly(httpOnly);
cookie.setMaxAge(expiry);
- return new JavaxCookie(cookie);
+ return new JakartaCookie(cookie);
}
public String toValueString() {
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 70553116a60..65f5f025acf 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
@@ -23,7 +23,6 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Locale;
import java.util.Optional;
-import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.Startable;
@@ -41,7 +40,6 @@ import org.sonar.db.user.UserDto;
import org.sonar.server.authentication.event.AuthenticationEvent;
import org.sonar.server.authentication.event.AuthenticationEvent.Source;
import org.sonar.server.authentication.event.AuthenticationException;
-import org.sonar.server.http.JavaxHttpRequest;
import org.sonar.server.user.SecurityRealmFactory;
import static java.util.Objects.requireNonNull;
@@ -93,7 +91,6 @@ 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);
UserDetails details = externalUsersProvider.doGetUserDetails(externalUsersProviderContext);
if (details == null) {
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2AuthenticationParameters.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2AuthenticationParameters.java
index f5e5efd2858..095148fa299 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2AuthenticationParameters.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2AuthenticationParameters.java
@@ -20,7 +20,7 @@
package org.sonar.server.authentication;
import java.util.Optional;
-import javax.servlet.FilterConfig;
+import jakarta.servlet.FilterConfig;
import org.sonar.api.server.authentication.OAuth2IdentityProvider;
import org.sonar.api.server.http.HttpRequest;
import org.sonar.api.server.http.HttpResponse;
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 9b6bd81e60e..d2ab21c9a69 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
@@ -21,8 +21,6 @@ package org.sonar.server.authentication;
import java.io.IOException;
import java.util.Optional;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import org.jetbrains.annotations.NotNull;
import org.sonar.api.platform.Server;
import org.sonar.api.server.ServerSide;
@@ -32,8 +30,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;
-import org.sonar.server.http.JavaxHttpRequest;
-import org.sonar.server.http.JavaxHttpResponse;
import org.sonar.server.user.ThreadLocalUserSession;
import org.sonar.server.user.UserSessionFactory;
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/usertoken/notification/TokenExpirationEmailComposer.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/usertoken/notification/TokenExpirationEmailComposer.java
index 602e8fc1cae..89d248a6d44 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/usertoken/notification/TokenExpirationEmailComposer.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/usertoken/notification/TokenExpirationEmailComposer.java
@@ -22,8 +22,8 @@ package org.sonar.server.usertoken.notification;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
-import org.apache.commons.mail.EmailException;
-import org.apache.commons.mail.HtmlEmail;
+import org.apache.commons.mail2.core.EmailException;
+import org.apache.commons.mail2.jakarta.HtmlEmail;
import org.sonar.api.platform.Server;
import org.sonar.db.user.UserTokenDto;
import org.sonar.server.email.EmailSender;
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 9bc79673382..8fc46180465 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
@@ -19,8 +19,8 @@
*/
package org.sonar.server.authentication;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
@@ -28,8 +28,8 @@ import org.sonar.api.platform.Server;
import org.sonar.api.server.authentication.BaseIdentityProvider;
import org.sonar.api.server.authentication.UserIdentity;
import org.sonar.db.user.UserDto;
-import org.sonar.server.http.JavaxHttpRequest;
-import org.sonar.server.http.JavaxHttpResponse;
+import org.sonar.server.http.JakartaHttpRequest;
+import org.sonar.server.http.JakartaHttpResponse;
import org.sonar.server.user.TestUserSessionFactory;
import org.sonar.server.user.ThreadLocalUserSession;
import org.sonar.server.user.UserSession;
@@ -74,8 +74,8 @@ public class BaseContextFactoryTest {
@Test
public void create_context() {
- JavaxHttpRequest httpRequest = new JavaxHttpRequest(request);
- JavaxHttpResponse httpResponse = new JavaxHttpResponse(response);
+ JakartaHttpRequest httpRequest = new JakartaHttpRequest(request);
+ JakartaHttpResponse httpResponse = new JakartaHttpResponse(response);
BaseIdentityProvider.Context context = underTest.newContext(httpRequest, httpResponse, identityProvider);
assertThat(context.getHttpRequest()).isEqualTo(httpRequest);
@@ -86,8 +86,8 @@ public class BaseContextFactoryTest {
@Test
public void authenticate() {
- JavaxHttpRequest httpRequest = new JavaxHttpRequest(request);
- JavaxHttpResponse httpResponse = new JavaxHttpResponse(response);
+ JakartaHttpRequest httpRequest = new JakartaHttpRequest(request);
+ JakartaHttpResponse httpResponse = new JakartaHttpResponse(response);
BaseIdentityProvider.Context context = underTest.newContext(httpRequest, httpResponse, identityProvider);
ArgumentCaptor<UserDto> userArgumentCaptor = ArgumentCaptor.forClass(UserDto.class);
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsExternalAuthenticationTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsExternalAuthenticationTest.java
index cb4d18d4ef3..89a2be6d537 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsExternalAuthenticationTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsExternalAuthenticationTest.java
@@ -19,7 +19,7 @@
*/
package org.sonar.server.authentication;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import org.junit.Before;
import org.junit.Test;
import org.sonar.api.config.internal.MapSettings;
@@ -32,7 +32,7 @@ import org.sonar.api.server.http.HttpRequest;
import org.sonar.server.authentication.event.AuthenticationEvent;
import org.sonar.server.authentication.event.AuthenticationEvent.Source;
import org.sonar.server.authentication.event.AuthenticationException;
-import org.sonar.server.http.JavaxHttpRequest;
+import org.sonar.server.http.JakartaHttpRequest;
import org.sonar.server.user.SecurityRealmFactory;
import static java.util.Arrays.asList;
@@ -66,7 +66,7 @@ public class CredentialsExternalAuthenticationTest {
private final TestUserRegistrar userIdentityAuthenticator = new TestUserRegistrar();
private final AuthenticationEvent authenticationEvent = mock(AuthenticationEvent.class);
- private final HttpRequest request = new JavaxHttpRequest(mock(HttpServletRequest.class));
+ private final HttpRequest request = new JakartaHttpRequest(mock(HttpServletRequest.class));
private final CredentialsExternalAuthentication underTest = new CredentialsExternalAuthentication(settings.asConfig(), securityRealmFactory, userIdentityAuthenticator,
authenticationEvent);
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2AuthenticationParametersImplTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2AuthenticationParametersImplTest.java
index c3d2ddc05b8..ba7f94446a0 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2AuthenticationParametersImplTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2AuthenticationParametersImplTest.java
@@ -31,7 +31,7 @@ import org.mockito.ArgumentCaptor;
import org.sonar.api.server.http.Cookie;
import org.sonar.api.server.http.HttpRequest;
import org.sonar.api.server.http.HttpResponse;
-import org.sonar.server.http.JavaxHttpRequest;
+import org.sonar.server.http.JakartaHttpRequest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
@@ -176,7 +176,7 @@ public class OAuth2AuthenticationParametersImplTest {
assertThat(redirection).isEqualTo(Optional.ofNullable(expectedSanitizedUrl));
}
- private JavaxHttpRequest.JavaxCookie wrapCookie(String name, String value) {
- return new JavaxHttpRequest.JavaxCookie(new javax.servlet.http.Cookie(name, value));
+ private JakartaHttpRequest.JakartaCookie wrapCookie(String name, String value) {
+ return new JakartaHttpRequest.JakartaCookie(new jakarta.servlet.http.Cookie(name, value));
}
}
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 6260841dfdc..62daaf4fce8 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
@@ -20,8 +20,8 @@
package org.sonar.server.authentication;
import java.util.Optional;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
@@ -31,8 +31,8 @@ import org.sonar.api.server.authentication.UserIdentity;
import org.sonar.api.server.http.HttpRequest;
import org.sonar.api.server.http.HttpResponse;
import org.sonar.db.user.UserDto;
-import org.sonar.server.http.JavaxHttpRequest;
-import org.sonar.server.http.JavaxHttpResponse;
+import org.sonar.server.http.JakartaHttpRequest;
+import org.sonar.server.http.JakartaHttpResponse;
import org.sonar.server.user.TestUserSessionFactory;
import org.sonar.server.user.ThreadLocalUserSession;
import org.sonar.server.user.UserSession;
@@ -66,8 +66,8 @@ public class OAuth2ContextFactoryTest {
private final HttpServletRequest request = mock(HttpServletRequest.class);
private final HttpServletResponse response = mock(HttpServletResponse.class);
- private final HttpRequest httpRequest = new JavaxHttpRequest(request);
- private final HttpResponse httpResponse = new JavaxHttpResponse(response);
+ private final HttpRequest httpRequest = new JakartaHttpRequest(request);
+ private final HttpResponse httpResponse = new JakartaHttpResponse(response);
private final OAuth2IdentityProvider identityProvider = mock(OAuth2IdentityProvider.class);
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuthCsrfVerifierTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuthCsrfVerifierTest.java
index 3bf791405f1..d6fdb3a503b 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuthCsrfVerifierTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuthCsrfVerifierTest.java
@@ -29,7 +29,7 @@ import org.sonar.api.server.http.HttpRequest;
import org.sonar.api.server.http.HttpResponse;
import org.sonar.server.authentication.event.AuthenticationEvent;
import org.sonar.server.authentication.event.AuthenticationException;
-import org.sonar.server.http.JavaxHttpRequest;
+import org.sonar.server.http.JakartaHttpRequest;
import static org.apache.commons.codec.digest.DigestUtils.sha1Hex;
import static org.apache.commons.codec.digest.DigestUtils.sha256Hex;
@@ -151,7 +151,7 @@ public class OAuthCsrfVerifierTest {
assertThat(cookie.isSecure()).isFalse();
}
- private JavaxHttpRequest.JavaxCookie wrapCookie(String name, String value) {
- return new JavaxHttpRequest.JavaxCookie(new javax.servlet.http.Cookie(name, value));
+ private JakartaHttpRequest.JakartaCookie wrapCookie(String name, String value) {
+ return new JakartaHttpRequest.JakartaCookie(new jakarta.servlet.http.Cookie(name, value));
}
}
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/SamlValidationRedirectionFilterTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/SamlValidationRedirectionFilterTest.java
index 411347eb172..6188b312dbf 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/SamlValidationRedirectionFilterTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/SamlValidationRedirectionFilterTest.java
@@ -25,7 +25,7 @@ import com.tngtech.java.junit.dataprovider.UseDataProvider;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
-import javax.servlet.ServletException;
+import jakarta.servlet.ServletException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContext.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContext.java
index 52fe20778ee..62b2200c88c 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContext.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContext.java
@@ -27,15 +27,15 @@ import java.util.EventListener;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-import javax.servlet.Filter;
-import javax.servlet.FilterRegistration;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletRegistration;
-import javax.servlet.SessionCookieConfig;
-import javax.servlet.SessionTrackingMode;
-import javax.servlet.descriptor.JspConfigDescriptor;
+import jakarta.servlet.Filter;
+import jakarta.servlet.FilterRegistration;
+import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.Servlet;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.ServletRegistration;
+import jakarta.servlet.SessionCookieConfig;
+import jakarta.servlet.SessionTrackingMode;
+import jakarta.servlet.descriptor.JspConfigDescriptor;
/**
* A dummy implementation of {@link ServletContext} which only implements the attribute related methods. All other
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContextTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContextTest.java
index 674be09beec..3eb984793fa 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContextTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContextTest.java
@@ -23,14 +23,14 @@ import com.google.common.collect.ImmutableSet;
import java.util.Collections;
import java.util.Enumeration;
import java.util.EventListener;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.Servlet;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.SessionTrackingMode;
+import jakarta.servlet.Filter;
+import jakarta.servlet.FilterChain;
+import jakarta.servlet.FilterConfig;
+import jakarta.servlet.Servlet;
+import jakarta.servlet.ServletConfig;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletResponse;
+import jakarta.servlet.SessionTrackingMode;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/usertoken/notification/TokenExpirationEmailComposerTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/usertoken/notification/TokenExpirationEmailComposerTest.java
index a61647e4a1c..2f396ad78fa 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/usertoken/notification/TokenExpirationEmailComposerTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/usertoken/notification/TokenExpirationEmailComposerTest.java
@@ -23,8 +23,8 @@ import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
-import org.apache.commons.mail.EmailException;
-import org.apache.commons.mail.HtmlEmail;
+import org.apache.commons.mail2.core.EmailException;
+import org.apache.commons.mail2.jakarta.HtmlEmail;
import org.junit.Before;
import org.junit.Test;
import org.sonar.api.platform.Server;