[java-opensaml] branch main updated: Reverse cert lookup to favor Jakarta attribute name.

Scott Cantor cantor.2 at osu.edu
Thu Aug 18 13:51:43 UTC 2022


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository java-opensaml.

View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=96e9863e76eb671854531a4fdb8ce232cbd2b42e

The following commit(s) were added to refs/heads/main by this push:
     new 96e9863e7 Reverse cert lookup to favor Jakarta attribute name.
96e9863e7 is described below

commit 96e9863e76eb671854531a4fdb8ce232cbd2b42e
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Aug 18 09:51:41 2022 -0400

    Reverse cert lookup to favor Jakarta attribute name.
---
 .../messaging/ServletRequestX509CredentialAdapter.java         | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/opensaml-security-api/src/main/java/org/opensaml/security/messaging/ServletRequestX509CredentialAdapter.java b/opensaml-security-api/src/main/java/org/opensaml/security/messaging/ServletRequestX509CredentialAdapter.java
index 3547b8b52..27741839d 100644
--- a/opensaml-security-api/src/main/java/org/opensaml/security/messaging/ServletRequestX509CredentialAdapter.java
+++ b/opensaml-security-api/src/main/java/org/opensaml/security/messaging/ServletRequestX509CredentialAdapter.java
@@ -58,18 +58,14 @@ public class ServletRequestX509CredentialAdapter extends AbstractCredential impl
      *  request attribute 'javax.servlet.request.X509Certificate'
      */
     public ServletRequestX509CredentialAdapter(final ServletRequest request) throws SecurityException {
-        X509Certificate[] chain = (X509Certificate[]) request.getAttribute(X509_CERT_REQUEST_ATTRIBUTE);
+        X509Certificate[] chain = (X509Certificate[]) request.getAttribute(JAKARTA_X509_CERT_REQUEST_ATTRIBUTE);
         
         if (chain == null || chain.length == 0) {
-            // Check for newer Jakarta variant.
-            // TODO: Once Jakarta is "common", probably reverse these checks.
-            chain = (X509Certificate[]) request.getAttribute(JAKARTA_X509_CERT_REQUEST_ATTRIBUTE);
+            chain = (X509Certificate[]) request.getAttribute(X509_CERT_REQUEST_ATTRIBUTE);
         }
         
         if (chain == null || chain.length == 0) {
-            throw new SecurityException(
-                    String.format("Servlet request does not contain X.509 certificates in either attribute %s or %s",
-                    X509_CERT_REQUEST_ATTRIBUTE, JAKARTA_X509_CERT_REQUEST_ATTRIBUTE));
+            throw new SecurityException("Servlet request does not contain X.509 certificates");
         }
 
         cert = chain[0];

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list