You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2024/09/19 14:13:19 UTC
(tomcat) branch 11.0.x updated (6d097a6674 -> ebe54c8206)
This is an automated email from the ASF dual-hosted git repository.
markt pushed a change to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
from 6d097a6674 If the Jakarta Authentication fails with an exception, set a 500 status
new fd33d1f399 Create dirs if required when persisting Jakarta Auth provider config
new 1477dee9be Fix logic of delete tests
new ebe54c8206 Don't overwrite valid Principal from password callback will null
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../authenticator/jaspic/CallbackHandlerImpl.java | 4 +++-
.../authenticator/jaspic/LocalStrings.properties | 1 +
.../jaspic/PersistentProviderRegistrations.java | 11 +++++++++--
webapps/docs/changelog.xml | 16 ++++++++++++++++
4 files changed, 29 insertions(+), 3 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
(tomcat) 02/03: Fix logic of delete tests
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 1477dee9be3d873356fa35d8e4b7dce8b148da17
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Sep 19 14:57:55 2024 +0100
Fix logic of delete tests
---
.../authenticator/jaspic/PersistentProviderRegistrations.java | 4 ++--
webapps/docs/changelog.xml | 5 +++++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/catalina/authenticator/jaspic/PersistentProviderRegistrations.java b/java/org/apache/catalina/authenticator/jaspic/PersistentProviderRegistrations.java
index 2766807d9d..875ab1cff0 100644
--- a/java/org/apache/catalina/authenticator/jaspic/PersistentProviderRegistrations.java
+++ b/java/org/apache/catalina/authenticator/jaspic/PersistentProviderRegistrations.java
@@ -98,13 +98,13 @@ public final class PersistentProviderRegistrations {
// Remove left over temporary files if present
if (configFileOld.exists()) {
- if (configFileOld.delete()) {
+ if (!configFileOld.delete()) {
throw new SecurityException(sm.getString("persistentProviderRegistrations.existsDeleteFail",
configFileOld.getAbsolutePath()));
}
}
if (configFileNew.exists()) {
- if (configFileNew.delete()) {
+ if (!configFileNew.delete()) {
throw new SecurityException(sm.getString("persistentProviderRegistrations.existsDeleteFail",
configFileNew.getAbsolutePath()));
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 303a27cf39..6d0064461f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -127,6 +127,11 @@
create any necessary parent directories that don't already exist.
(markt)
</fix>
+ <fix>
+ Correct the logic used to detect errors when deleting temporary files
+ associated with persisting the Jakarta Authentication provider
+ configuration. (markt)
+ </fix>
</changelog>
</subsection>
</section>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
(tomcat) 03/03: Don't overwrite valid Principal from password callback will null
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit ebe54c8206e89813020e964de47fb6256d1eab6a
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Sep 19 14:59:04 2024 +0100
Don't overwrite valid Principal from password callback will null
---
.../apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java | 4 +++-
webapps/docs/changelog.xml | 6 ++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java b/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java
index e95654c4bc..afb0626eaf 100644
--- a/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java
+++ b/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java
@@ -69,7 +69,9 @@ public class CallbackHandlerImpl implements CallbackHandler, Contained {
if (callback instanceof CallerPrincipalCallback) {
CallerPrincipalCallback cpc = (CallerPrincipalCallback) callback;
name = cpc.getName();
- principal = cpc.getPrincipal();
+ if (cpc.getPrincipal() != null) {
+ principal = cpc.getPrincipal();
+ }
subject = cpc.getSubject();
} else if (callback instanceof GroupPrincipalCallback) {
GroupPrincipalCallback gpc = (GroupPrincipalCallback) callback;
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 6d0064461f..5718f5898d 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -132,6 +132,12 @@
associated with persisting the Jakarta Authentication provider
configuration. (markt)
</fix>
+ <fix>
+ When processing Jakarta Authentication callbacks, don't overwrite a
+ Principal obtained from the <code>PasswordValidationCallback</code> with
+ <code>null</code> if the <code>CallerPrincipalCallback</code> does not
+ provide a Principal. (markt)
+ </fix>
</changelog>
</subsection>
</section>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
(tomcat) 01/03: Create dirs if required when persisting Jakarta Auth provider config
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit fd33d1f39932aa483522e4ea68a94547d1040407
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Sep 19 14:57:29 2024 +0100
Create dirs if required when persisting Jakarta Auth provider config
Unlikely to be required when running in Tomcat. Is required when running
the TCK since the persistence mechanism is used outside of Tomcat and
the dirs don.t exist.
---
.../apache/catalina/authenticator/jaspic/LocalStrings.properties | 1 +
.../authenticator/jaspic/PersistentProviderRegistrations.java | 7 +++++++
webapps/docs/changelog.xml | 5 +++++
3 files changed, 13 insertions(+)
diff --git a/java/org/apache/catalina/authenticator/jaspic/LocalStrings.properties b/java/org/apache/catalina/authenticator/jaspic/LocalStrings.properties
index 1930492629..7a3b0ece4a 100644
--- a/java/org/apache/catalina/authenticator/jaspic/LocalStrings.properties
+++ b/java/org/apache/catalina/authenticator/jaspic/LocalStrings.properties
@@ -29,6 +29,7 @@ jaspicAuthenticator.authenticate=Authenticating request for [{0}] via JASPIC
persistentProviderRegistrations.deleteFail=The temporary file [{0}] cannot be deleted
persistentProviderRegistrations.existsDeleteFail=The temporary file [{0}] already exists and cannot be deleted
+persistentProviderRegistrations.mkdirsFail=The directory for the persistent provider registrations [{0}] cannot be created
persistentProviderRegistrations.moveFail=Failed to move [{0}] to [{1}]
persistentProviderRegistrations.xmlFeatureEncoding=Exception configuring JASPIC to permit java encoding names in XML configuration files. Only IANA encoding names will be supported.
diff --git a/java/org/apache/catalina/authenticator/jaspic/PersistentProviderRegistrations.java b/java/org/apache/catalina/authenticator/jaspic/PersistentProviderRegistrations.java
index 40845783a0..2766807d9d 100644
--- a/java/org/apache/catalina/authenticator/jaspic/PersistentProviderRegistrations.java
+++ b/java/org/apache/catalina/authenticator/jaspic/PersistentProviderRegistrations.java
@@ -94,6 +94,7 @@ public final class PersistentProviderRegistrations {
static void writeProviders(Providers providers, File configFile) {
File configFileOld = new File(configFile.getAbsolutePath() + ".old");
File configFileNew = new File(configFile.getAbsolutePath() + ".new");
+ File configParent = configFileNew.getParentFile();
// Remove left over temporary files if present
if (configFileOld.exists()) {
@@ -108,6 +109,12 @@ public final class PersistentProviderRegistrations {
configFileNew.getAbsolutePath()));
}
}
+ if (!configParent.exists()) {
+ if (!configParent.mkdirs()) {
+ throw new SecurityException(sm.getString("persistentProviderRegistrations.mkdirsFail",
+ configParent.getAbsolutePath()));
+ }
+ }
// Write out the providers to the temporary new file
try (OutputStream fos = new FileOutputStream(configFileNew);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 10958df67c..303a27cf39 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -122,6 +122,11 @@
explicitly set the HTTP response status to 500 as the
<code>ServerAuthContext</code> may not have set it. (markt)
</fix>
+ <fix>
+ When persisting the Jakarta Authentication provider configuration,
+ create any necessary parent directories that don't already exist.
+ (markt)
+ </fix>
</changelog>
</subsection>
</section>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org