SubjectConfirmationType subjectConfirmation = assertionObjectFactory.createSubjectConfirmationType();
subject.getContent().add(assertionObjectFactory.createSubjectConfirmation(subjectConfirmation));
subjectConfirmation.setMethod(SamlConstants.CONFIRMATION_METHOD_BEARER);
subjectConfirmation.setNameID(nameID);
SubjectConfirmationDataType subjectConfirmationData = assertionObjectFactory.createSubjectConfirmationDataType();
subjectConfirmation.setSubjectConfirmationData(subjectConfirmationData);
subjectConfirmationData.setRecipient(externalSamlEndpoint.getLocation());
subjectConfirmationData.setNotOnOrAfter(SamlUtils.getXMLGregorianCalendarNowPlusDuration(GregorianCalendar.MINUTE, ASSERTION_VALIDITY_IN_MINUTES));
subjectConfirmationData.setInResponseTo(samlDialogue.get().getExternalProviderMessageId());
ConditionsType conditions = assertionObjectFactory.createConditionsType();
assertion.setConditions(conditions);
AudienceRestrictionType audienceRestriction = assertionObjectFactory.createAudienceRestrictionType();
conditions.getConditionOrAudienceRestrictionOrOneTimeUse().add(audienceRestriction);