Class AbstractSubjectConfirmationValidator
- java.lang.Object
-
- org.opensaml.saml.saml2.assertion.impl.AbstractSubjectConfirmationValidator
-
- All Implemented Interfaces:
SubjectConfirmationValidator
- Direct Known Subclasses:
BearerSubjectConfirmationValidator,HolderOfKeySubjectConfirmationValidator,SenderVouchersSubjectConfirmationValidator
@ThreadSafe public abstract class AbstractSubjectConfirmationValidator extends Object implements SubjectConfirmationValidator
A base class forSubjectConfirmationValidatorimplementations.This class takes care of processing the
NotBefore,NotOnOrAfter,Recipient, andAddresschecks.Supports the following
ValidationContextstatic parameters:-
SAML2AssertionValidationParameters.SC_ADDRESS_REQUIRED: Optional. -
SAML2AssertionValidationParameters.SC_CHECK_ADDRESS: Optional. -
SAML2AssertionValidationParameters.SC_VALID_ADDRESSES: Required ifSAML2AssertionValidationParameters.SC_CHECK_ADDRESSis true or omitted, otherwise optional. -
SAML2AssertionValidationParameters.SC_RECIPIENT_REQUIRED: Optional. -
SAML2AssertionValidationParameters.SC_VALID_RECIPIENTS: Required. -
SAML2AssertionValidationParameters.SC_IN_RESPONSE_TO_REQUIRED: Optional. -
SAML2AssertionValidationParameters.SC_VALID_IN_RESPONSE_TO: Required. -
SAML2AssertionValidationParameters.SC_NOT_BEFORE_REQUIRED: Optional. -
SAML2AssertionValidationParameters.SC_NOT_ON_OR_AFTER_REQUIRED: Optional.
Supports the following
ValidationContextdynamic parameters:- None.
-
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.LoggerlogClass logger.
-
Constructor Summary
Constructors Constructor Description AbstractSubjectConfirmationValidator()Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract ValidationResultdoValidate(SubjectConfirmation confirmation, Assertion assertion, ValidationContext context)Performs any further validation required for the specific confirmation method implementation.protected booleanisAddressRequired(ValidationContext context)Determine whether Address is required.protected booleanisInResponseToRequired(ValidationContext context)Determine whether InResponseTo is required.protected booleanisNotBeforeRequired(ValidationContext context)Determine whether NotBefore is required.protected booleanisNotOnOrAfterRequired(ValidationContext context)Determine whether NotOnOrAfter is required.protected booleanisRecipientRequired(ValidationContext context)Determine whether Recipient is required.ValidationResultvalidate(SubjectConfirmation confirmation, Assertion assertion, ValidationContext context)protected ValidationResultvalidateAddress(SubjectConfirmation confirmation, Assertion assertion, ValidationContext context, boolean required)Validates theAddresscondition of theSubjectConfirmationData, if any is present.protected ValidationResultvalidateInResponseTo(SubjectConfirmation confirmation, Assertion assertion, ValidationContext context, boolean required)Validates theInResponseTocondition of theSubjectConfirmationData, if any is present.protected ValidationResultvalidateNotBefore(SubjectConfirmation confirmation, Assertion assertion, ValidationContext context, boolean required)Validates theNotBeforecondition of theSubjectConfirmationData, if any is present.protected ValidationResultvalidateNotOnOrAfter(SubjectConfirmation confirmation, Assertion assertion, ValidationContext context, boolean required)Validates theNotOnOrAftercondition of theSubjectConfirmationData, if any is present.protected ValidationResultvalidateRecipient(SubjectConfirmation confirmation, Assertion assertion, ValidationContext context, boolean required)Validates theRecipientcondition of theSubjectConfirmationData, if any is present.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opensaml.saml.saml2.assertion.SubjectConfirmationValidator
getServicedMethod
-
-
-
-
Method Detail
-
validate
@Nonnull public ValidationResult validate(@Nonnull SubjectConfirmation confirmation, @Nonnull Assertion assertion, @Nonnull ValidationContext context) throws AssertionValidationException
- Specified by:
validatein interfaceSubjectConfirmationValidator- Throws:
AssertionValidationException
-
isAddressRequired
protected boolean isAddressRequired(ValidationContext context)
Determine whether Address is required.- Parameters:
context- current validation context- Returns:
- true if required, false if not
-
isRecipientRequired
protected boolean isRecipientRequired(ValidationContext context)
Determine whether Recipient is required.- Parameters:
context- current validation context- Returns:
- true if required, false if not
-
isNotBeforeRequired
protected boolean isNotBeforeRequired(ValidationContext context)
Determine whether NotBefore is required.- Parameters:
context- current validation context- Returns:
- true if required, false if not
-
isNotOnOrAfterRequired
protected boolean isNotOnOrAfterRequired(ValidationContext context)
Determine whether NotOnOrAfter is required.- Parameters:
context- current validation context- Returns:
- true if required, false if not
-
isInResponseToRequired
protected boolean isInResponseToRequired(ValidationContext context)
Determine whether InResponseTo is required.- Parameters:
context- current validation context- Returns:
- true if required, false if not
-
validateInResponseTo
protected ValidationResult validateInResponseTo(@Nonnull SubjectConfirmation confirmation, @Nonnull Assertion assertion, @Nonnull ValidationContext context, boolean required) throws AssertionValidationException
Validates theInResponseTocondition of theSubjectConfirmationData, if any is present.- Parameters:
confirmation- confirmation method, withSubjectConfirmationData, being validatedassertion- assertion bearing the confirmation methodcontext- current validation contextrequired- whether the InResponseTo value is required- Returns:
- the result of the validation evaluation
- Throws:
AssertionValidationException- thrown if there is a problem determining the validity of the NotBefore
-
validateNotBefore
@Nonnull protected ValidationResult validateNotBefore(@Nonnull SubjectConfirmation confirmation, @Nonnull Assertion assertion, @Nonnull ValidationContext context, boolean required) throws AssertionValidationException
Validates theNotBeforecondition of theSubjectConfirmationData, if any is present.- Parameters:
confirmation- confirmation method, withSubjectConfirmationData, being validatedassertion- assertion bearing the confirmation methodcontext- current validation contextrequired- whether the NotBefore value is required- Returns:
- the result of the validation evaluation
- Throws:
AssertionValidationException- thrown if there is a problem determining the validity of the NotBefore
-
validateNotOnOrAfter
@Nonnull protected ValidationResult validateNotOnOrAfter(@Nonnull SubjectConfirmation confirmation, @Nonnull Assertion assertion, @Nonnull ValidationContext context, boolean required) throws AssertionValidationException
Validates theNotOnOrAftercondition of theSubjectConfirmationData, if any is present.- Parameters:
confirmation- confirmation method, withSubjectConfirmationData, being validatedassertion- assertion bearing the confirmation methodcontext- current validation contextrequired- whether the NotOnOrAfter value is required- Returns:
- the result of the validation evaluation
- Throws:
AssertionValidationException- thrown if there is a problem determining the validity of the NotOnOrAFter
-
validateRecipient
@Nonnull protected ValidationResult validateRecipient(@Nonnull SubjectConfirmation confirmation, @Nonnull Assertion assertion, @Nonnull ValidationContext context, boolean required) throws AssertionValidationException
Validates theRecipientcondition of theSubjectConfirmationData, if any is present.- Parameters:
confirmation- confirmation method being validatedassertion- assertion bearing the confirmation methodcontext- current validation contextrequired- whether the Recipient value is required- Returns:
- the result of the validation evaluation
- Throws:
AssertionValidationException- thrown if there is a problem determining the validity of the recipient
-
validateAddress
@Nonnull protected ValidationResult validateAddress(@Nonnull SubjectConfirmation confirmation, @Nonnull Assertion assertion, @Nonnull ValidationContext context, boolean required) throws AssertionValidationException
Validates theAddresscondition of theSubjectConfirmationData, if any is present.- Parameters:
confirmation- confirmation method being validatedassertion- assertion bearing the confirmation methodcontext- current validation contextrequired- whether the Address value is required- Returns:
- the result of the validation evaluation
- Throws:
AssertionValidationException- thrown if there is a problem determining the validity of the address
-
doValidate
@Nonnull protected abstract ValidationResult doValidate(@Nonnull SubjectConfirmation confirmation, @Nonnull Assertion assertion, @Nonnull ValidationContext context) throws AssertionValidationException
Performs any further validation required for the specific confirmation method implementation.- Parameters:
confirmation- confirmation method being validatedassertion- assertion bearing the confirmation methodcontext- current validation context- Returns:
- the result of the validation evaluation
- Throws:
AssertionValidationException- thrown if further validation finds the confirmation method to be invalid
-
-