Class AuthnStatementValidator
java.lang.Object
org.opensaml.saml.saml2.assertion.impl.AuthnStatementValidator
se.swedenconnect.opensaml.saml2.assertion.validation.AuthnStatementValidator
- All Implemented Interfaces:
- StatementValidator
Core statement validator for 
AuthnStatements.
 
 Supports the following ValidationContext static parameters:
 
- CoreValidatorParameters.AUTHN_REQUEST: Optional. If supplied will be used in a number of validations when information from the corresponding- AuthnRequestis needed. If not supplied, other, more detailed parameters must be given.
- AUTHN_REQUEST_FORCE_AUTHN: If the above- CoreValidatorParameters.AUTHN_REQUESTis not assigned, this parameter gives the- ForceAuthnflag. This is used to determine if a valid assertion was issued based on SSO/non-SSO.
- AUTHN_REQUEST_ISSUE_INSTANT: If the above- CoreValidatorParameters.AUTHN_REQUESTis not assigned, this parameter gives the issue instant of the authentication request. This is used to determine if a valid assertion was issued based on SSO/non-SSO.
- MAX_ACCEPTED_SSO_SESSION_TIME: For SSO, we may want to assert that the authentication is not too old. If so, this parameter gives the maximum accepted session time.
- Author:
- Martin Lindström (martin@idsec.se)
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected static InstantGets the issue instant of theAuthnRequestfrom the validation context.protected static BooleangetForceAuthnFlag(ValidationContext context) Gets theForceAuthnflag from the validation context.protected static DurationGets the maximum time we allow for SSO sessions.protected ValidationResultvalidate(AuthnStatement statement, Assertion assertion, ValidationContext context) Validates theAuthnStatement.final ValidationResultvalidate(Statement statement, Assertion assertion, ValidationContext context) protected ValidationResultvalidateAuthnContext(AuthnStatement statement, Assertion assertion, ValidationContext context) Default implementation will only assert that theAuthnContextelement is present.protected ValidationResultvalidateAuthnInstant(AuthnStatement statement, Assertion assertion, ValidationContext context) Validates theAuthnInstantof theAuthnStatement.protected ValidationResultvalidateSessionIndex(AuthnStatement statement, Assertion assertion, ValidationContext context) Default implementation does not perform any checks and returnsValidationResult.VALID.protected ValidationResultvalidateSessionNotOnOrAfter(AuthnStatement statement, Assertion assertion, ValidationContext context) Default implementation does not perform any checks and returnsValidationResult.VALID.protected ValidationResultvalidateSsoAndSession(Instant authnInstant, AuthnStatement statement, Assertion assertion, ValidationContext context) Makes checks for SSO and session lengths.Methods inherited from class org.opensaml.saml.saml2.assertion.impl.AuthnStatementValidatorgetServicedStatement, validateSubjectLocality
- 
Field Details- 
AUTHN_REQUEST_FORCE_AUTHNKey for a validation context parameter. Carries aBooleanholding the value of the ForceAuthn flag from the AuthnRequest.- See Also:
 
- 
AUTHN_REQUEST_ISSUE_INSTANTKey for a validation context parameter. Carries aInstantholding the issuance time for the AuthnRequest.- See Also:
 
- 
MAX_ACCEPTED_SSO_SESSION_TIMEKey for a validation context parameter. Carries aDurationholding the maximum session time that we can accept for SSO.- See Also:
 
 
- 
- 
Constructor Details- 
AuthnStatementValidatorpublic AuthnStatementValidator()
 
- 
- 
Method Details- 
validate@Nonnull public final ValidationResult validate(@Nonnull Statement statement, @Nonnull Assertion assertion, @Nonnull ValidationContext context) throws AssertionValidationException - Specified by:
- validatein interface- StatementValidator
- Overrides:
- validatein class- AuthnStatementValidator
- Throws:
- AssertionValidationException
 
- 
validateprotected ValidationResult validate(AuthnStatement statement, Assertion assertion, ValidationContext context) throws AssertionValidationException Validates theAuthnStatement.- Parameters:
- statement- the statement to validate
- assertion- the assertion containing the statement
- context- validation context
- Returns:
- validation result
- Throws:
- AssertionValidationException- for internal validation errors
 
- 
validateAuthnInstant@Nonnull protected ValidationResult validateAuthnInstant(@Nonnull AuthnStatement statement, @Nonnull Assertion assertion, @Nonnull ValidationContext context) Validates theAuthnInstantof theAuthnStatement.- Overrides:
- validateAuthnInstantin class- AuthnStatementValidator
- Parameters:
- statement- the statement
- assertion- the assertion containing the statement
- context- validation context
- Returns:
- validation result
 
- 
validateSsoAndSessionprotected ValidationResult validateSsoAndSession(Instant authnInstant, AuthnStatement statement, Assertion assertion, ValidationContext context) Makes checks for SSO and session lengths.- Parameters:
- authnInstant- the authentication instant
- statement- the statement
- assertion- the assertion containing the statement
- context- validation context
- Returns:
- validation result
 
- 
getMaxAcceptedSsoSessionTimeGets the maximum time we allow for SSO sessions.- Parameters:
- context- the validation context
- Returns:
- the max time, or null if the time is not set
 
- 
getForceAuthnFlagGets theForceAuthnflag from the validation context. The method primarily checks for theAUTHN_REQUEST_FORCE_AUTHNparameter, and that does not exist, tries with theCoreValidatorParameters.AUTHN_REQUESTparameter.- Parameters:
- context- the validation context
- Returns:
- the ForceAuthnflag ornullif this is not set
 
- 
getAuthnRequestIssueInstantGets the issue instant of theAuthnRequestfrom the validation context. The method primarily checks for theAUTHN_REQUEST_ISSUE_INSTANTparameter, and that does not exist, tries with theCoreValidatorParameters.AUTHN_REQUESTparameter.- Parameters:
- context- the validation context
- Returns:
- the issuance time or null if not set
 
- 
validateSessionIndexprotected ValidationResult validateSessionIndex(AuthnStatement statement, Assertion assertion, ValidationContext context) Default implementation does not perform any checks and returnsValidationResult.VALID.- Parameters:
- statement- the statement
- assertion- the assertion
- context- the validation context
- Returns:
- validation result
 
- 
validateSessionNotOnOrAfterprotected ValidationResult validateSessionNotOnOrAfter(AuthnStatement statement, Assertion assertion, ValidationContext context) Default implementation does not perform any checks and returnsValidationResult.VALID.- Parameters:
- statement- the statement
- assertion- the assertion
- context- the validation context
- Returns:
- validation result
 
- 
validateAuthnContext@Nonnull protected ValidationResult validateAuthnContext(@Nonnull AuthnStatement statement, @Nonnull Assertion assertion, @Nonnull ValidationContext context) Default implementation will only assert that theAuthnContextelement is present.- Overrides:
- validateAuthnContextin class- AuthnStatementValidator
- Parameters:
- statement- the statement
- assertion- the assertion
- context- the validation context
- Returns:
- validation result
 
 
-