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 for
SubjectConfirmationValidator implementations.
This class takes care of processing the NotBefore, NotOnOrAfter,
Recipient, and Address checks.
Supports the following ValidationContext static 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 ValidationContext dynamic parameters:
- None.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.validate(SubjectConfirmation confirmation, Assertion assertion, ValidationContext context) Confirms theSubjectby means of the givenSubjectConfirmation.protected ValidationResultvalidateAddress(SubjectConfirmationData confirmationData, Assertion assertion, ValidationContext context, boolean required) Validates theAddresscondition of theSubjectConfirmationData, if any is present.protected ValidationResultvalidateInResponseTo(SubjectConfirmationData confirmationData, Assertion assertion, ValidationContext context, boolean required) Validates theInResponseTocondition of theSubjectConfirmationData, if any is present.protected ValidationResultvalidateNotBefore(SubjectConfirmationData confirmationData, Assertion assertion, ValidationContext context, boolean required) Validates theNotBeforecondition of theSubjectConfirmationData, if any is present.protected ValidationResultvalidateNotOnOrAfter(SubjectConfirmationData confirmationData, Assertion assertion, ValidationContext context, boolean required) Validates theNotOnOrAftercondition of theSubjectConfirmationData, if any is present.protected ValidationResultvalidateRecipient(SubjectConfirmationData confirmationData, 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, waitMethods inherited from interface org.opensaml.saml.saml2.assertion.SubjectConfirmationValidator
getServicedMethod
-
Field Details
-
log
@Nonnull private org.slf4j.Logger logClass logger.
-
-
Constructor Details
-
AbstractSubjectConfirmationValidator
public AbstractSubjectConfirmationValidator()
-
-
Method Details
-
validate
@Nonnull public ValidationResult validate(@Nonnull SubjectConfirmation confirmation, @Nonnull Assertion assertion, @Nonnull ValidationContext context) throws AssertionValidationException Confirms theSubjectby means of the givenSubjectConfirmation.- Specified by:
validatein interfaceSubjectConfirmationValidator- Parameters:
confirmation- the subject confirmation informationassertion- the assertion bearing the subjectcontext- the current Assertion validation context- Returns:
- the validation result
- Throws:
AssertionValidationException- if there is a problem processing the validation operation
-
isAddressRequired
Determine whether Address is required.- Parameters:
context- current validation context- Returns:
- true if required, false if not
-
isRecipientRequired
Determine whether Recipient is required.- Parameters:
context- current validation context- Returns:
- true if required, false if not
-
isNotBeforeRequired
Determine whether NotBefore is required.- Parameters:
context- current validation context- Returns:
- true if required, false if not
-
isNotOnOrAfterRequired
Determine whether NotOnOrAfter is required.- Parameters:
context- current validation context- Returns:
- true if required, false if not
-
isInResponseToRequired
Determine whether InResponseTo is required.- Parameters:
context- current validation context- Returns:
- true if required, false if not
-
validateInResponseTo
@Nonnull protected ValidationResult validateInResponseTo(@Nonnull SubjectConfirmationData confirmationData, @Nonnull Assertion assertion, @Nonnull ValidationContext context, boolean required) throws AssertionValidationException Validates theInResponseTocondition of theSubjectConfirmationData, if any is present.- Parameters:
confirmationData- confirmation data 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 SubjectConfirmationData confirmationData, @Nonnull Assertion assertion, @Nonnull ValidationContext context, boolean required) throws AssertionValidationException Validates theNotBeforecondition of theSubjectConfirmationData, if any is present.- Parameters:
confirmationData- confirmation data 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 SubjectConfirmationData confirmationData, @Nonnull Assertion assertion, @Nonnull ValidationContext context, boolean required) throws AssertionValidationException Validates theNotOnOrAftercondition of theSubjectConfirmationData, if any is present.- Parameters:
confirmationData- confirmation data 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 SubjectConfirmationData confirmationData, @Nonnull Assertion assertion, @Nonnull ValidationContext context, boolean required) throws AssertionValidationException Validates theRecipientcondition of theSubjectConfirmationData, if any is present.- Parameters:
confirmationData- confirmation data 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 SubjectConfirmationData confirmationData, @Nonnull Assertion assertion, @Nonnull ValidationContext context, boolean required) throws AssertionValidationException Validates theAddresscondition of theSubjectConfirmationData, if any is present.- Parameters:
confirmationData- confirmation data 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
-