Class SAML20AssertionValidator

    • Field Detail

      • DEFAULT_CLOCK_SKEW

        @Nonnull
        public static final Duration DEFAULT_CLOCK_SKEW
        Default clock skew of 5 minutes.
      • log

        @Nonnull
        private final org.slf4j.Logger log
        Class logger.
      • conditionValidators

        private net.shibboleth.utilities.java.support.collection.LazyMap<QName,​ConditionValidator> conditionValidators
        Registered Condition validators.
      • statementValidators

        private net.shibboleth.utilities.java.support.collection.LazyMap<QName,​StatementValidator> statementValidators
        Registered Statement validators.
      • trustEngine

        private org.opensaml.xmlsec.signature.support.SignatureTrustEngine trustEngine
        Trust engine for signature evaluation.
      • signaturePrevalidator

        private org.opensaml.xmlsec.signature.support.SignaturePrevalidator signaturePrevalidator
        SAML signature profile validator.
    • Constructor Detail

      • SAML20AssertionValidator

        public SAML20AssertionValidator​(@Nullable
                                        Collection<ConditionValidator> newConditionValidators,
                                        @Nullable
                                        Collection<SubjectConfirmationValidator> newConfirmationValidators,
                                        @Nullable
                                        Collection<StatementValidator> newStatementValidators,
                                        @Nullable
                                        org.opensaml.xmlsec.signature.support.SignatureTrustEngine newTrustEngine,
                                        @Nullable
                                        org.opensaml.xmlsec.signature.support.SignaturePrevalidator newSignaturePrevalidator)
        Constructor.
        Parameters:
        newConditionValidators - validators used to validate the Conditions within the assertion
        newConfirmationValidators - validators used to validate SubjectConfirmation methods within the assertion
        newStatementValidators - validators used to validate Statements within the assertion
        newTrustEngine - the trust used to validate the Assertion signature
        newSignaturePrevalidator - the signature pre-validator used to pre-validate the Assertion signature
    • Method Detail

      • log

        protected void log​(@Nonnull
                           Assertion assertion,
                           @Nonnull
                           ValidationContext context)
        Log the Assertion which is being validated, along with the supplied validation context parameters.
        Parameters:
        assertion - the SAML 2 Assertion being validated
        context - current validation context
      • validateSignature

        @Nonnull
        protected ValidationResult validateSignature​(@Nonnull
                                                     Assertion token,
                                                     @Nonnull
                                                     ValidationContext context)
                                              throws AssertionValidationException
        Validates the signature of the assertion, if it is signed.
        Parameters:
        token - assertion whose signature will be validated
        context - current validation context
        Returns:
        the result of the signature validation
        Throws:
        AssertionValidationException - thrown if there is a problem determining the validity of the signature
      • getSignatureValidationTrustEngine

        @Nonnull
        protected org.opensaml.xmlsec.signature.support.SignatureTrustEngine getSignatureValidationTrustEngine​(@Nonnull
                                                                                                               Assertion token,
                                                                                                               @Nonnull
                                                                                                               ValidationContext context)
        Get the signature trust engine that will be used in evaluating the Assertion signature.
        Parameters:
        token - assertion whose signature will be validated
        context - current validation context
        Returns:
        the criteria set to use
      • getSignatureValidationPrevalidator

        @Nonnull
        protected org.opensaml.xmlsec.signature.support.SignaturePrevalidator getSignatureValidationPrevalidator​(@Nonnull
                                                                                                                 Assertion token,
                                                                                                                 @Nonnull
                                                                                                                 ValidationContext context)
        Get the signature trust engine that will be used in evaluating the Assertion signature.
        Parameters:
        token - assertion whose signature will be validated
        context - current validation context
        Returns:
        the criteria set to use
      • getSignatureValidationCriteriaSet

        @Nonnull
        protected net.shibboleth.utilities.java.support.resolver.CriteriaSet getSignatureValidationCriteriaSet​(@Nonnull
                                                                                                               Assertion token,
                                                                                                               @Nonnull
                                                                                                               ValidationContext context)
        Get the criteria set that will be used in evaluating the Assertion signature via the supplied trust engine.
        Parameters:
        token - assertion whose signature will be validated
        context - current validation context
        Returns:
        the criteria set to use
      • validateConditions

        @Nonnull
        protected ValidationResult validateConditions​(@Nonnull
                                                      Assertion assertion,
                                                      @Nonnull
                                                      ValidationContext context)
                                               throws AssertionValidationException
        Validates the conditions on the assertion. Condition validators are looked up by the element QName and, if present, the schema type of the condition. If no validator can be found for the Condition the validation process fails.
        Parameters:
        assertion - the assertion whose conditions will be validated
        context - current validation context
        Returns:
        the result of the validation evaluation
        Throws:
        AssertionValidationException - thrown if there is a problem determining the validity of the conditions
      • validateRequiredConditions

        protected ValidationResult validateRequiredConditions​(@Nonnull
                                                              Assertion assertion,
                                                              @Nonnull
                                                              ValidationContext context)
        Validate that all conditions indicated to be required are present in the assertion.
        Parameters:
        assertion - the assertion whose conditions will be evaluated
        context - current validation context
        Returns:
        the result of the validation evaluation
      • validateConditionsTimeBounds

        @Nonnull
        protected ValidationResult validateConditionsTimeBounds​(@Nonnull
                                                                Assertion assertion,
                                                                @Nonnull
                                                                ValidationContext context)
                                                         throws AssertionValidationException
        Validates the NotBefore and NotOnOrAfter Conditions constraints on the assertion.
        Parameters:
        assertion - the assertion whose conditions will be validated
        context - current validation context
        Returns:
        the result of the validation evaluation
        Throws:
        AssertionValidationException - thrown if there is a problem determining the validity of the conditions
      • validateSubjectConfirmation

        @Nonnull
        protected ValidationResult validateSubjectConfirmation​(@Nonnull
                                                               Assertion assertion,
                                                               @Nonnull
                                                               ValidationContext context)
                                                        throws AssertionValidationException
        Validates the subject confirmations of the assertion. Validators are looked up by the subject confirmation method. If any one subject confirmation is met the subject is considered confirmed per the SAML specification.
        Parameters:
        assertion - assertion whose subject is being confirmed
        context - current validation context
        Returns:
        the result of the validation
        Throws:
        AssertionValidationException - thrown if there is a problem determining the validity the subject
      • validateStatements

        @Nonnull
        protected ValidationResult validateStatements​(@Nonnull
                                                      Assertion assertion,
                                                      @Nonnull
                                                      ValidationContext context)
                                               throws AssertionValidationException
        Validates the statements within the assertion. Validators are looked up by the Statement's element QName or, if present, its schema type. Any statement for which a validator can not be found is simply ignored.
        Parameters:
        assertion - assertion whose statements are being validated
        context - current validation context
        Returns:
        result of the validation
        Throws:
        AssertionValidationException - thrown if there is a problem determining the validity the statements