From 3580786b21c75091f8ada628ea13949c47871da6 Mon Sep 17 00:00:00 2001 From: Julien Blondeau Date: Tue, 8 Mar 2022 23:30:05 +0100 Subject: [PATCH] Provide compliance with both javax.servlet and jakarta.servlet This compliance is for built jar only, and do not modify the original java sources. You will need to continue using javax to debug with sources. --- README.md | 21 ++++- samples/java-saml-tookit-jspsample/pom.xml | 63 ++++++++++++--- toolkit/pom.xml | 94 ++++++++++++++++++++-- 3 files changed, 153 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 025a7054..7366cda3 100644 --- a/README.md +++ b/README.md @@ -132,11 +132,23 @@ The toolkit is hosted on github. You can download it from: The toolkit is hosted at [Sonatype OSSRH (OSS Repository Hosting)](http://central.sonatype.org/pages/ossrh-guide.html) that is synced to the Central Repository. Install it as a maven dependency: + +To be compliant with JEE 8 (javax.servlet.*): +```xml + + com.onelogin + java-saml + 2.9.0 + +``` + +To be compliant with Jakarta EE 9+ (jakarta.servlet.*): ```xml com.onelogin java-saml 2.9.0 + jakarta ``` @@ -164,7 +176,8 @@ also the [Java Cryptography Extension (JCE)](https://en.wikipedia.org/wiki/Java_ *toolkit:* * com.onelogin:java-saml-core -* javax.servlet:servlet-api +* javax.servlet:servlet-api (default build `mvn ...`, or with javax profile `mvn -Pjavax ...`) +* jakarta.servlet:servlet-api (with javax profile `mvn -Pjakarta ...`) *maven:* * org.apache.maven.plugins:maven-jar-plugin @@ -207,7 +220,7 @@ In the repo, at *src/main/java* you will find the source; at *src/main/resources #### toolkit (com.onelogin:java-saml) #### -This folder contains a maven project with the Auth class to handle the low level classes of java-saml-core and the ServletUtils class to handle javax.servlet.http objects, used on the Auth class. +This folder contains a maven project with the Auth class to handle the low level classes of java-saml-core and the ServletUtils class to handle servlet objects (javax.servlet.http with javax profile (default) or jakarta.servlet.http with jakarta profile), used on the Auth class. In the repo, at *src/main/java* you will find the source and at *src/test/java* the junit tests for the classes Auth and ServletUtils. #### samples (com.onelogin:java-saml-tookit-samples) #### @@ -490,9 +503,9 @@ Auth auth = new Auth(settings, request, response); #### The HttpRequest java-saml-core uses HttpRequest class, a framework-agnostic representation of an HTTP request. -java-saml depends on javax.servlet:servlet-api, and the classes Auth and ServletUtils use HttpServletRequest and HttpServletResponse objects. +java-saml depends on javax.servlet:servlet-api (default javax profile) or jakarta.servlet:servlet-api (jakarta profile), and the classes Auth and ServletUtils use HttpServletRequest and HttpServletResponse objects. -If you want to use anything different than javax.servlet.http, you will need to reimplement Auth and ServletUtils based on that new representation of the HTTP request/responses. +If you want to use anything different than javax.servlet.http or jakarta.servlet.http, you will need to reimplement Auth and ServletUtils based on that new representation of the HTTP request/responses. #### Initiate SSO In order to send an AuthNRequest to the IdP: diff --git a/samples/java-saml-tookit-jspsample/pom.xml b/samples/java-saml-tookit-jspsample/pom.xml index 13afeb5b..5449b7bc 100644 --- a/samples/java-saml-tookit-jspsample/pom.xml +++ b/samples/java-saml-tookit-jspsample/pom.xml @@ -10,18 +10,55 @@ war OneLogin java-saml Toolkit Sample Webapp - - - com.onelogin - java-saml - ${project.version} - - - javax.servlet - javax.servlet-api - 4.0.1 - provided - - + + + javax + + true + + + com.onelogin + java-saml + ${project.version} + + + + javax.servlet + javax.servlet-api + 4.0.1 + provided + + + + + jakarta + + + com.onelogin + java-saml + ${project.version} + jakarta + + + + + jakarta.servlet + jakarta.servlet-api + 5.0.0 + provided + + + + + + maven-war-plugin + + jakarta + + + + + + diff --git a/toolkit/pom.xml b/toolkit/pom.xml index 47e8b5d2..bae6a315 100644 --- a/toolkit/pom.xml +++ b/toolkit/pom.xml @@ -57,14 +57,6 @@ true - - - javax.servlet - javax.servlet-api - 4.0.1 - provided - - joda-time @@ -91,6 +83,8 @@ + ${src.dir} + ${src.test.dir} org.jacoco @@ -121,6 +115,90 @@ + + + + javax + + true + + + + ${basedir}/src/main/java + ${basedir}/src/test/java + + + + + + javax.servlet + javax.servlet-api + 4.0.1 + provided + + + + + jakarta + + + ${project.build.directory}/generated-sources/jakarta + ${project.build.directory}/generated-test-sources/jakarta + + + + + + + jakarta.servlet + jakarta.servlet-api + 5.0.0 + provided + + + + + + + maven-antrun-plugin + + + jakarta-converter + generate-sources + + + + + + + + + + + + + + + + + + run + + + + + + + maven-jar-plugin + + jakarta + + + + + + +