You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2021/03/26 17:37:31 UTC
[tomee-jakarta] 02/02: Attempt to patch Tomcat classes
This is an automated email from the ASF dual-hosted git repository.
jlmonteiro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee-jakarta.git
commit 5bd672b6d7417e156b0e1df63c3a486549679612
Author: Jean-Louis Monteiro <jl...@tomitribe.com>
AuthorDate: Fri Mar 26 18:35:39 2021 +0100
Attempt to patch Tomcat classes
---
pom.xml | 2 +-
tomee/apache-tomee/pom.xml | 20 ++++++++++++++++++++
.../authenticator/jaspic/CallbackHandlerImpl.java | 18 ++++++++++--------
3 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/pom.xml b/pom.xml
index e8124c4..b85032d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1127,7 +1127,7 @@
<dependency>
<groupId>org.apache.tomee</groupId>
<artifactId>taglibs-shade</artifactId>
- <version>${project.version}</version>
+ <version>${tomee.version}</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
diff --git a/tomee/apache-tomee/pom.xml b/tomee/apache-tomee/pom.xml
index 637e548..d4de012 100644
--- a/tomee/apache-tomee/pom.xml
+++ b/tomee/apache-tomee/pom.xml
@@ -521,6 +521,26 @@
</execution>
</executions>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.tomee.patch</groupId>
+ <artifactId>tomee-patch-plugin</artifactId>
+ <version>0.4-SNAPSHOT</version>
+ <configuration>
+ <select>apache-tomee-(plus|plume|webprofile|microprofile).*\.zip</select>
+ <skipTransform>true</skipTransform>
+ <createTarGz>true</createTarGz>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
</build>
diff --git a/transform/src/patch/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java b/tomee/apache-tomee/src/patch/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java
similarity index 92%
rename from transform/src/patch/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java
rename to tomee/apache-tomee/src/patch/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java
index 6e4e60c..294a783 100644
--- a/transform/src/patch/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java
+++ b/tomee/apache-tomee/src/patch/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java
@@ -27,9 +27,11 @@ import javax.security.auth.Subject;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.security.auth.message.callback.CallerPrincipalCallback;
-import javax.security.auth.message.callback.GroupPrincipalCallback;
-import javax.security.auth.message.callback.PasswordValidationCallback;
+
+import jakarta.security.auth.message.callback.CallerPrincipalCallback;
+import jakarta.security.auth.message.callback.GroupPrincipalCallback;
+import jakarta.security.auth.message.callback.PasswordValidationCallback;
+
import java.io.IOException;
import java.security.Principal;
import java.util.ArrayList;
@@ -40,18 +42,18 @@ import java.util.List;
/**
* This is a clone of Tomcat default callback handler but with a better handling of the Generic Principals when more than
* one callback is used.
- *
+ * <p>
* For instance https://github.com/apache/tomcat/blob/master/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java#L96
* keeps adding new Generic Principals even for the same name whereas the authenticator base
* https://github.com/apache/tomcat/blob/master/java/org/apache/catalina/authenticator/AuthenticatorBase.java#L956
* randomly picks the first one. So it results in random failures
- *
+ * <p>
* See https://github.com/eclipse-ee4j/jakartaee-tck/issues/575
*/
public class CallbackHandlerImpl implements CallbackHandler, Contained {
private static final StringManager sm = StringManager.getManager(
- org.apache.catalina.authenticator.jaspic.CallbackHandlerImpl.class);
+ org.apache.catalina.authenticator.jaspic.CallbackHandlerImpl.class);
private final Log log = LogFactory.getLog(org.apache.catalina.authenticator.jaspic.CallbackHandlerImpl.class); // must not be static
private Container container;
@@ -83,11 +85,11 @@ public class CallbackHandlerImpl implements CallbackHandler, Contained {
log.warn(sm.getString("callbackHandlerImpl.containerMissing", callback.getClass().getName()));
} else if (container.getRealm() == null) {
log.warn(sm.getString("callbackHandlerImpl.realmMissing",
- callback.getClass().getName(), container.getName()));
+ callback.getClass().getName(), container.getName()));
} else {
PasswordValidationCallback pvc = (PasswordValidationCallback) callback;
principal = container.getRealm().authenticate(pvc.getUsername(),
- String.valueOf(pvc.getPassword()));
+ String.valueOf(pvc.getPassword()));
subject = pvc.getSubject();
}
} else {