Skip to content

Commit 0c04ccf

Browse files
committed
Jakarta EE 9 migration
1 parent 8d1af63 commit 0c04ccf

16 files changed

Lines changed: 1167 additions & 470 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
### Requirements
2626

27-
Java 8 or above and `javax.servlet` version 3.
27+
Java 8 or above and `jakarta.servlet` version 3.
2828

2929
> If you are using Spring, we recommend leveraging Spring's OIDC and OAuth2 support, as demonstrated by the [Spring Boot Quickstart](https://auth0.com/docs/quickstart/webapp/java-spring-boot).
3030

build.gradle

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ plugins {
1313
id 'java'
1414
id 'java-library'
1515
id 'jacoco'
16-
id 'me.champeau.gradle.japicmp' version '0.4.1'
16+
id 'me.champeau.gradle.japicmp' version '0.2.9'
1717
}
1818

1919
repositories {
@@ -81,7 +81,7 @@ project.afterEvaluate {
8181

8282
ext {
8383
//baselineCompareVersion = '1.5.0'
84-
testInJavaVersions = [8, 11, 17, 21]
84+
testInJavaVersions = [11, 17, 21]
8585
}
8686

8787
jacocoTestReport {
@@ -93,7 +93,7 @@ jacocoTestReport {
9393

9494
java {
9595
toolchain {
96-
languageVersion = JavaLanguageVersion.of(8)
96+
languageVersion = JavaLanguageVersion.of(11)
9797
}
9898
// Needed because of broken gradle metadata, see https://github.com/google/guava/issues/6612#issuecomment-1614992368
9999
sourceSets.all {
@@ -107,8 +107,8 @@ java {
107107
}
108108

109109
compileJava {
110-
sourceCompatibility '1.8'
111-
targetCompatibility '1.8'
110+
sourceCompatibility '11'
111+
targetCompatibility '11'
112112
}
113113

114114
test {
@@ -120,7 +120,7 @@ test {
120120
}
121121

122122
dependencies {
123-
implementation 'javax.servlet:javax.servlet-api:3.1.0'
123+
implementation 'jakarta.servlet:jakarta.servlet-api:5.0.0'
124124
implementation 'org.apache.commons:commons-lang3:3.12.0'
125125
implementation 'com.google.guava:guava-annotations:r03'
126126
implementation 'commons-codec:commons-codec:1.15'
@@ -130,11 +130,9 @@ dependencies {
130130
api 'com.auth0:jwks-rsa:0.22.1'
131131

132132
testImplementation 'org.bouncycastle:bcprov-jdk15on:1.64'
133-
testImplementation 'org.hamcrest:java-hamcrest:2.0.0.0'
134-
testImplementation 'org.hamcrest:hamcrest-core:1.3'
135-
testImplementation 'org.mockito:mockito-core:2.8.9'
136-
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
137-
testImplementation 'org.springframework:spring-test:4.3.14.RELEASE'
133+
testImplementation 'org.hamcrest:hamcrest:2.2'
134+
testImplementation 'org.mockito:mockito-core:5.12.0'
135+
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0'
138136
testImplementation 'com.squareup.okhttp3:okhttp:4.11.0'
139137
}
140138

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ POM_SCM_CONNECTION=scm:git:https://github.com/auth0/auth0-java-mvc-common.git
1212
POM_SCM_DEV_CONNECTION=scm:git:https://github.com/auth0/auth0-java-mvc-common.git
1313

1414
POM_LICENCE_NAME=The MIT License (MIT)
15-
POM_LICENCE_URL=https://raw.githubusercontent.com/auth0/java-jwt/master/LICENSE
15+
POM_LICENCE_URL=https://raw.githubusercontent.com/auth0/auth0-java-mvc-common/master/LICENSE
1616
POM_LICENCE_DIST=repo
1717

1818
POM_DEVELOPER_ID=auth0

src/main/java/com/auth0/AuthenticationController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import com.google.common.annotations.VisibleForTesting;
88
import org.apache.commons.lang3.Validate;
99

10-
import javax.servlet.http.HttpServletRequest;
11-
import javax.servlet.http.HttpServletResponse;
10+
import jakarta.servlet.http.HttpServletRequest;
11+
import jakarta.servlet.http.HttpServletResponse;
1212

1313

1414
/**
@@ -284,7 +284,7 @@ public Tokens handle(HttpServletRequest request, HttpServletResponse response) t
284284
* when building the {@link AuthorizeUrl} that the user will be redirected to to login. Failure to do so may result
285285
* in a broken login experience for the user.</p>
286286
*
287-
* @deprecated This method uses the {@link javax.servlet.http.HttpSession} for auth-based data, and is incompatible
287+
* @deprecated This method uses the {@link jakarta.servlet.http.HttpSession} for auth-based data, and is incompatible
288288
* with clients that are using the "id_token" or "token" responseType with browsers that enforce SameSite cookie
289289
* restrictions. This method will be removed in version 2.0.0. Use
290290
* {@link AuthenticationController#handle(HttpServletRequest, HttpServletResponse)} instead.
@@ -308,7 +308,7 @@ public Tokens handle(HttpServletRequest request) throws IdentityVerificationExce
308308
* {@link AuthenticationController#handle(HttpServletRequest)} method. Failure to do so may result in a broken login
309309
* experience for users.</p>
310310
*
311-
* @deprecated This method stores data in the {@link javax.servlet.http.HttpSession}, and is incompatible with clients
311+
* @deprecated This method stores data in the {@link jakarta.servlet.http.HttpSession}, and is incompatible with clients
312312
* that are using the "id_token" or "token" responseType with browsers that enforce SameSite cookie restrictions.
313313
* This method will be removed in version 2.0.0. Use
314314
* {@link AuthenticationController#buildAuthorizeUrl(HttpServletRequest, HttpServletResponse, String)} instead.

src/main/java/com/auth0/AuthorizeUrl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import com.auth0.exception.Auth0Exception;
66
import com.auth0.json.auth.PushedAuthorizationResponse;
77

8-
import javax.servlet.http.HttpServletRequest;
9-
import javax.servlet.http.HttpServletResponse;
8+
import jakarta.servlet.http.HttpServletRequest;
9+
import jakarta.servlet.http.HttpServletResponse;
1010
import java.util.*;
1111

1212
import static com.auth0.IdentityVerificationException.API_ERROR;
@@ -39,7 +39,7 @@ public class AuthorizeUrl {
3939
*
4040
* Using this constructor with a non-null {@link HttpServletResponse} will store the state and nonce as
4141
* cookies when the {@link AuthorizeUrl#build()} method is called, with the appropriate SameSite attribute depending
42-
* on the responseType. State and nonce will also be stored in the {@link javax.servlet.http.HttpSession} as a fallback,
42+
* on the responseType. State and nonce will also be stored in the {@link jakarta.servlet.http.HttpSession} as a fallback,
4343
* but this behavior will be removed in a future release, and only cookies will be used.
4444
*
4545
* @param client the Auth0 Authentication API client

src/main/java/com/auth0/RandomStorage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.auth0;
22

3-
import javax.servlet.http.HttpServletRequest;
4-
import javax.servlet.http.HttpSession;
3+
import jakarta.servlet.http.HttpServletRequest;
4+
import jakarta.servlet.http.HttpSession;
55

66
class RandomStorage extends SessionUtils {
77

src/main/java/com/auth0/RequestProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import com.auth0.json.auth.TokenHolder;
66
import org.apache.commons.lang3.Validate;
77

8-
import javax.servlet.http.HttpServletRequest;
9-
import javax.servlet.http.HttpServletResponse;
8+
import jakarta.servlet.http.HttpServletRequest;
9+
import jakarta.servlet.http.HttpServletResponse;
1010
import java.util.Arrays;
1111
import java.util.List;
1212

src/main/java/com/auth0/SessionUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import org.apache.commons.lang3.Validate;
44

5-
import javax.servlet.http.HttpServletRequest;
6-
import javax.servlet.http.HttpSession;
5+
import jakarta.servlet.http.HttpServletRequest;
6+
import jakarta.servlet.http.HttpSession;
77

88
/**
99
* Helper class to handle easy session key-value storage.

src/main/java/com/auth0/TransientCookieStore.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import org.apache.commons.lang3.Validate;
44

5-
import javax.servlet.http.Cookie;
6-
import javax.servlet.http.HttpServletRequest;
7-
import javax.servlet.http.HttpServletResponse;
5+
import jakarta.servlet.http.Cookie;
6+
import jakarta.servlet.http.HttpServletRequest;
7+
import jakarta.servlet.http.HttpServletResponse;
88
import java.io.UnsupportedEncodingException;
99
import java.net.URLDecoder;
1010
import java.nio.charset.StandardCharsets;

0 commit comments

Comments
 (0)