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_ADDRESS
is 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 ValidationResult
doValidate
(SubjectConfirmation confirmation, Assertion assertion, ValidationContext context) Performs any further validation required for the specific confirmation method implementation.protected boolean
isAddressRequired
(ValidationContext context) Determine whether Address is required.protected boolean
isInResponseToRequired
(ValidationContext context) Determine whether InResponseTo is required.protected boolean
isNotBeforeRequired
(ValidationContext context) Determine whether NotBefore is required.protected boolean
isNotOnOrAfterRequired
(ValidationContext context) Determine whether NotOnOrAfter is required.protected boolean
isRecipientRequired
(ValidationContext context) Determine whether Recipient is required.validate
(SubjectConfirmation confirmation, Assertion assertion, ValidationContext context) Confirms theSubject
by means of the givenSubjectConfirmation
.protected ValidationResult
validateAddress
(SubjectConfirmation confirmation, Assertion assertion, ValidationContext context, boolean required) Validates theAddress
condition of theSubjectConfirmationData
, if any is present.protected ValidationResult
validateInResponseTo
(SubjectConfirmation confirmation, Assertion assertion, ValidationContext context, boolean required) Validates theInResponseTo
condition of theSubjectConfirmationData
, if any is present.protected ValidationResult
validateNotBefore
(SubjectConfirmation confirmation, Assertion assertion, ValidationContext context, boolean required) Validates theNotBefore
condition of theSubjectConfirmationData
, if any is present.protected ValidationResult
validateNotOnOrAfter
(SubjectConfirmation confirmation, Assertion assertion, ValidationContext context, boolean required) Validates theNotOnOrAfter
condition of theSubjectConfirmationData
, if any is present.protected ValidationResult
validateRecipient
(SubjectConfirmation confirmation, Assertion assertion, ValidationContext context, boolean required) Validates theRecipient
condition 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
-
Field Details
-
log
private org.slf4j.Logger logClass logger.
-
-
Constructor Details
-
AbstractSubjectConfirmationValidator
public AbstractSubjectConfirmationValidator()Constructor.
-
-
Method Details
-
validate
@Nonnull public ValidationResult validate(@Nonnull SubjectConfirmation confirmation, @Nonnull Assertion assertion, @Nonnull ValidationContext context) throws AssertionValidationException Confirms theSubject
by means of the givenSubjectConfirmation
.- Specified by:
validate
in 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
protected ValidationResult validateInResponseTo(@Nonnull SubjectConfirmation confirmation, @Nonnull Assertion assertion, @Nonnull ValidationContext context, boolean required) throws AssertionValidationException Validates theInResponseTo
condition 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 theNotBefore
condition 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 theNotOnOrAfter
condition 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 theRecipient
condition 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 theAddress
condition 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
-