throws org.opensaml.xml.security.SecurityException, WSSecurityException {
if (subjectBuilder == null) {
subjectBuilder = (SAMLObjectBuilder<Subject>)
builderFactory.getBuilder(Subject.DEFAULT_ELEMENT_NAME);
}
Subject subject = subjectBuilder.buildObject();
NameID nameID = SAML2ComponentBuilder.createNameID(subjectBean);
subject.setNameID(nameID);
SubjectConfirmationData subjectConfData = null;
if (subjectBean.getKeyInfo() != null || subjectBean.getSubjectConfirmationData() != null) {
subjectConfData =
SAML2ComponentBuilder.createSubjectConfirmationData(
subjectBean.getSubjectConfirmationData(),
subjectBean.getKeyInfo()
);
}
String confirmationMethodStr = subjectBean.getSubjectConfirmationMethod();
if (confirmationMethodStr == null) {
confirmationMethodStr = SAML2Constants.CONF_SENDER_VOUCHES;
}
SubjectConfirmation subjectConfirmation =
SAML2ComponentBuilder.createSubjectConfirmation(
confirmationMethodStr, subjectConfData
);
subject.getSubjectConfirmations().add(subjectConfirmation);
return subject;
}