public class AssertionValidator extends AbstractSignableObjectValidator<Assertion>
Assertion
objects.
Supports the following ValidationContext
static parameters:
AbstractSignableObjectValidator
.CoreValidatorParameters.STRICT_VALIDATION
: Optional. If not supplied, defaults to 'false'. Tells whether
strict validation should be performed.CoreValidatorParameters.ALLOWED_CLOCK_SKEW
: Optional. Gives the number of milliseconds that is the
maximum allowed clock skew. If not given AbstractObjectValidator.DEFAULT_ALLOWED_CLOCK_SKEW
is used.CoreValidatorParameters.MAX_AGE_MESSAGE
: Optional. Gives the maximum age (difference between issuance
time and the validation time). If not given, the AbstractObjectValidator.DEFAULT_MAX_AGE_RECEIVED_MESSAGE
is
used.CoreValidatorParameters.RECEIVE_INSTANT
: Optional. Gives the timestamp (milliseconds since epoch) for
when the response message was received. If not given the current time is used.CoreValidatorParameters.AUTHN_REQUEST
: Optional. If supplied will be used in a number of validations when
information from the corresponding AuthnRequest
is needed. If not supplied, other, more detailed parameters
must be given.CoreValidatorParameters.AUTHN_REQUEST_ID
: Required if the CoreValidatorParameters.AUTHN_REQUEST
is not assigned. Is used when validating the InResponseTo
attribute of the response.CoreValidatorParameters.RECEIVE_URL
: Required. A String holding the URL on which we received the response
message. Is used when the Destination
attribute is validated.CoreValidatorParameters.EXPECTED_ISSUER
: Optional. If set, is used when the issuer of the response is
validated. If not set, the issuer from the CoreValidatorParameters.AUTHN_REQUEST
is used (if available).RESPONSE_ISSUE_INSTANT
: Optional. If set, the IssueInstant of the Assertion being validated is compared
with the corresponding response issue instant.
Supports the following ValidationContext
dynamic parameters:
SAML2AssertionValidationParameters.CONFIRMED_SUBJECT_CONFIRMATION
: Optional. Will be present after
validation if subject confirmation was successfully performed.
Note: Also check the validation context parameters defined by the SubjectConfirmationValidator
and
ConditionValidator
instances that are installed.
Modifier and Type | Field and Description |
---|---|
protected Map<QName,ConditionValidator> |
conditionValidators
Registered
Condition validators. |
static String |
RESPONSE_ISSUE_INSTANT
Carries a
Long holding the issue instant of the Response that contained the assertion being validated. |
protected Map<String,SubjectConfirmationValidator> |
subjectConfirmationValidators
Registered
SubjectConfirmation validators. |
signaturePrevalidator, trustEngine
DEFAULT_ALLOWED_CLOCK_SKEW, DEFAULT_MAX_AGE_RECEIVED_MESSAGE
Constructor and Description |
---|
AssertionValidator(SignatureTrustEngine trustEngine,
SignaturePrevalidator signaturePrevalidator,
Collection<SubjectConfirmationValidator> confirmationValidators,
Collection<ConditionValidator> conditionValidators,
Collection<StatementValidator> statementValidators)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected String |
getID(Assertion signableObject)
Returns the Assertion ID.
|
protected String |
getIssuer(Assertion signableObject)
Returns the Assertion issuer.
|
protected String |
getObjectName()
Returns the name of the object being validated, e.g.
|
ValidationResult |
validate(Assertion assertion,
ValidationContext context)
Validates the assertion.
|
protected ValidationResult |
validateConditions(Assertion assertion,
ValidationContext context)
Validates the
Conditions elements of the assertion. |
protected ValidationResult |
validateConditionsTimeBounds(Assertion assertion,
ValidationContext context)
Validates the NotBefore and NotOnOrAfter Conditions constraints on the assertion.
|
protected ValidationResult |
validateID(Assertion assertion,
ValidationContext context)
Validates that the
Assertion object has an ID attribute. |
protected ValidationResult |
validateIssueInstant(Assertion assertion,
ValidationContext context)
Validates that the
Assertion object has a IssueInstant attribute and checks that its value is OK. |
protected ValidationResult |
validateIssuer(Assertion assertion,
ValidationContext context)
Ensures that the
Issuer element is present and matches the expected issuer (if set in the context under the
CoreValidatorParameters.EXPECTED_ISSUER key). |
protected ValidationResult |
validateStatements(Assertion assertion,
ValidationContext context)
Validates the statements of the assertion using the registered
StatementValidator instance. |
protected ValidationResult |
validateSubject(Assertion assertion,
ValidationContext context)
Validates the
Subject element of the assertion. |
protected ValidationResult |
validateSubjectConfirmations(Assertion assertion,
List<SubjectConfirmation> subjectConfirmations,
ValidationContext context)
Validates the subject confirmations and for the one that is confirmed, it is saved in the validation context under
the
SAML2AssertionValidationParameters.CONFIRMED_SUBJECT_CONFIRMATION key. |
protected ValidationResult |
validateVersion(Assertion assertion,
ValidationContext context)
Validates that the
Response object has a valid Version attribute. |
getSignatureValidationCriteriaSet, performSignatureValidation, validateSignature
getAllowedClockSkew, getMaxAgeReceivedMessage, getReceiveInstant, isStrictValidation
public static final String RESPONSE_ISSUE_INSTANT
Long
holding the issue instant of the Response that contained the assertion being validated.protected Map<String,SubjectConfirmationValidator> subjectConfirmationValidators
SubjectConfirmation
validators.protected Map<QName,ConditionValidator> conditionValidators
Condition
validators.public AssertionValidator(SignatureTrustEngine trustEngine, SignaturePrevalidator signaturePrevalidator, Collection<SubjectConfirmationValidator> confirmationValidators, Collection<ConditionValidator> conditionValidators, Collection<StatementValidator> statementValidators)
trustEngine
- the trust used to validate the object's signaturesignaturePrevalidator
- the signature pre-validator used to pre-validate the object's signatureconfirmationValidators
- validators used to validate SubjectConfirmation
methods within the assertionconditionValidators
- validators used to validate the Condition
elements within the assertionstatementValidators
- validators used to validate Statement
s within the assertionpublic ValidationResult validate(Assertion assertion, ValidationContext context)
assertion
- object to be evaluatedcontext
- current validation contextprotected ValidationResult validateID(Assertion assertion, ValidationContext context)
Assertion
object has an ID attribute.assertion
- the assertioncontext
- the validation contextprotected ValidationResult validateVersion(Assertion assertion, ValidationContext context)
Response
object has a valid Version attribute.assertion
- the assertioncontext
- the validation contextprotected ValidationResult validateIssueInstant(Assertion assertion, ValidationContext context)
Assertion
object has a IssueInstant attribute and checks that its value is OK. If the
response that contained the assertion was previously validated the static context parameter
RESPONSE_ISSUE_INSTANT
should be passed. If so, the method checks that the assertion issue instant is not
after the response issue instant. Otherwise the method checks that the IssueInstant is not too old given the
CoreValidatorParameters.MAX_AGE_MESSAGE
and CoreValidatorParameters.RECEIVE_INSTANT
context
parameters.assertion
- the responsecontext
- the validation contextprotected ValidationResult validateIssuer(Assertion assertion, ValidationContext context)
Issuer
element is present and matches the expected issuer (if set in the context under the
CoreValidatorParameters.EXPECTED_ISSUER
key).assertion
- the assertioncontext
- the validation contextprotected ValidationResult validateSubject(Assertion assertion, ValidationContext context)
Subject
element of the assertion. The default implementation returns
ValidationResult.VALID
if there is no Subject
element since it is optional according to the SAML
2.0 Core specifications.assertion
- the assertioncontext
- the validation contextprotected ValidationResult validateSubjectConfirmations(Assertion assertion, List<SubjectConfirmation> subjectConfirmations, ValidationContext context)
SAML2AssertionValidationParameters.CONFIRMED_SUBJECT_CONFIRMATION
key.assertion
- the assertionsubjectConfirmations
- the subject confirmationscontext
- the validation contextprotected ValidationResult validateConditions(Assertion assertion, ValidationContext context)
Conditions
elements of the assertion.assertion
- the assertioncontext
- the validation contextprotected ValidationResult validateConditionsTimeBounds(Assertion assertion, ValidationContext context)
assertion
- the assertion whose conditions will be validatedcontext
- current validation contextprotected ValidationResult validateStatements(Assertion assertion, ValidationContext context)
StatementValidator
instance.assertion
- the assertion to validatecontext
- the validation contextprotected String getIssuer(Assertion signableObject)
getIssuer
in class AbstractSignableObjectValidator<Assertion>
signableObject
- the object being verifiedprotected String getID(Assertion signableObject)
getID
in class AbstractSignableObjectValidator<Assertion>
signableObject
- the object being verifiedprotected String getObjectName()
getObjectName
in class AbstractSignableObjectValidator<Assertion>
Copyright © 2018 Litsec AB. All rights reserved.