[java-opensaml] 02/02: Refactor for Checkstyle return count.

Brent Putman putmanb at georgetown.edu
Wed Mar 2 05:05:44 UTC 2022


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

putmanb 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=325022e4b0851ef48b6dca4fbc28792912b4606d

commit 325022e4b0851ef48b6dca4fbc28792912b4606d
Author: Brent Putman <putmanb at georgetown.edu>
AuthorDate: Wed Mar 2 00:04:34 2022 -0500

    Refactor for Checkstyle return count.
---
 .../saml2/assertion/SAML20AssertionValidator.java  | 44 ++++++++++++++++------
 1 file changed, 33 insertions(+), 11 deletions(-)

diff --git a/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/assertion/SAML20AssertionValidator.java b/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/assertion/SAML20AssertionValidator.java
index dee4140b6..b3ac51343 100644
--- a/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/assertion/SAML20AssertionValidator.java
+++ b/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/assertion/SAML20AssertionValidator.java
@@ -309,17 +309,7 @@ public class SAML20AssertionValidator {
         
         log(assertion, context);
         
-        ValidationResult result = validateVersion(assertion, context);
-        if (result != ValidationResult.VALID) {
-            return result;
-        }
-
-        result = validateIssueInstant(assertion, context);
-        if (result != ValidationResult.VALID) {
-            return result;
-        }
-
-        result = validateIssuer(assertion, context);
+        ValidationResult result = validateBasicData(assertion, context);
         if (result != ValidationResult.VALID) {
             return result;
         }
@@ -369,6 +359,38 @@ public class SAML20AssertionValidator {
             log.trace("SAML 2 Assertion ValidationContext - dynamic parameters: {}", context.getDynamicParameters());
         }
     }
+    
+    
+    /**
+     * Validate basic Assertion data, such as version, issuer and issue instant.
+     * 
+     * @param assertion the assertion being evaluated
+     * @param context the current validation context
+     * 
+     * @return the validation result
+     * 
+     * @throws AssertionValidationException if there is a fatal error evaluating the validity of the assertion
+     */
+    @Nonnull protected ValidationResult validateBasicData(@Nonnull final Assertion assertion, 
+            @Nonnull final ValidationContext context) throws AssertionValidationException {
+        
+        ValidationResult result = validateVersion(assertion, context);
+        if (result != ValidationResult.VALID) {
+            return result;
+        }
+
+        result = validateIssueInstant(assertion, context);
+        if (result != ValidationResult.VALID) {
+            return result;
+        }
+
+        result = validateIssuer(assertion, context);
+        if (result != ValidationResult.VALID) {
+            return result;
+        }
+        
+        return ValidationResult.VALID;
+    }
 
     /**
      * Validates that the assertion is a {@link SAMLVersion#VERSION_20} assertion.

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


More information about the commits mailing list