@SuppressWarnings("unchecked")
public static SubjectConfirmationData createSubjectConfirmationData(
SubjectConfirmationDataBean subjectConfirmationDataBean,
KeyInfoBean keyInfoBean
) throws org.opensaml.xml.security.SecurityException, WSSecurityException {
SubjectConfirmationData subjectConfirmationData = null;
KeyInfo keyInfo = null;
if (keyInfoBean == null) {
if (subjectConfirmationDataBuilder == null) {
subjectConfirmationDataBuilder = (SAMLObjectBuilder<SubjectConfirmationData>)
builderFactory.getBuilder(SubjectConfirmationData.DEFAULT_ELEMENT_NAME);
}
subjectConfirmationData = subjectConfirmationDataBuilder.buildObject();
} else {
if (keyInfoConfirmationDataBuilder == null) {
keyInfoConfirmationDataBuilder = (SAMLObjectBuilder<KeyInfoConfirmationDataType>)
builderFactory.getBuilder(KeyInfoConfirmationDataType.TYPE_NAME);
}
subjectConfirmationData = keyInfoConfirmationDataBuilder.buildObject();
keyInfo = SAML1ComponentBuilder.createKeyInfo(keyInfoBean);
((KeyInfoConfirmationDataType)subjectConfirmationData).getKeyInfos().add(keyInfo);
}
if (subjectConfirmationDataBean != null) {
if (subjectConfirmationDataBean.getInResponseTo() != null) {
subjectConfirmationData.setInResponseTo(subjectConfirmationDataBean.getInResponseTo());
}
if (subjectConfirmationDataBean.getRecipient() != null) {
subjectConfirmationData.setRecipient(subjectConfirmationDataBean.getRecipient());
}
if (subjectConfirmationDataBean.getAddress() != null) {
subjectConfirmationData.setAddress(subjectConfirmationDataBean.getAddress());
}
if (subjectConfirmationDataBean.getNotAfter() != null) {
subjectConfirmationData.setNotOnOrAfter(subjectConfirmationDataBean.getNotAfter());
}
if (subjectConfirmationDataBean.getNotBefore() != null) {
subjectConfirmationData.setNotBefore(subjectConfirmationDataBean.getNotBefore());
}
}
return subjectConfirmationData;
}