/** {@inheritDoc} */ protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject) throws UnmarshallingException { SubjectConfirmation subjectConfirmation = (SubjectConfirmation) parentSAMLObject; if (childSAMLObject instanceof ConfirmationMethod) { subjectConfirmation.getConfirmationMethods().add((ConfirmationMethod) childSAMLObject); } else if (childSAMLObject instanceof KeyInfo) { subjectConfirmation.setKeyInfo((KeyInfo)childSAMLObject); } else { subjectConfirmation.setSubjectConfirmationData(childSAMLObject); } } }
/** * Create an efficient field-wise copy of a {@link SubjectConfirmation}. * * @param confirmation the object to clone * * @return the copy */ @Nonnull private SubjectConfirmation cloneConfirmation(@Nonnull final SubjectConfirmation confirmation) { final SubjectConfirmation clone = confirmationBuilder.buildObject(); for (final ConfirmationMethod method : confirmation.getConfirmationMethods()) { final ConfirmationMethod newMethod = confirmationMethodBuilder.buildObject(); newMethod.setConfirmationMethod(method.getConfirmationMethod()); clone.getConfirmationMethods().add(newMethod); } return clone; }
/** * Build a new subject. * * @param identifier subject identifier * @return new subject */ @Nonnull private Subject newSubject(final String identifier) { final SubjectConfirmation confirmation = newSAMLObject( SubjectConfirmation.class, SubjectConfirmation.DEFAULT_ELEMENT_NAME); final ConfirmationMethod method = newSAMLObject( ConfirmationMethod.class, ConfirmationMethod.DEFAULT_ELEMENT_NAME); method.setConfirmationMethod(ConfirmationMethod.METHOD_ARTIFACT); confirmation.getConfirmationMethods().add(method); final NameIdentifier nameIdentifier = newSAMLObject(NameIdentifier.class, NameIdentifier.DEFAULT_ELEMENT_NAME); nameIdentifier.setValue(identifier); final Subject subject = newSAMLObject(Subject.class, Subject.DEFAULT_ELEMENT_NAME); subject.setNameIdentifier(nameIdentifier); subject.setSubjectConfirmation(confirmation); return subject; }
confirmation.getConfirmationMethods(); for (ConfirmationMethod confirmationMethod : confirmationMethods) { methods.add(confirmationMethod.getConfirmationMethod());
confirmation.getConfirmationMethods().add(newMethod);
/** * New subject element with given confirmation method. * * @param identifier the identifier * @param confirmationMethod the confirmation method * @return the subject */ public Subject newSubject(final String identifier, final String confirmationMethod) { final SubjectConfirmation confirmation = newSamlObject(SubjectConfirmation.class); final ConfirmationMethod method = newSamlObject(ConfirmationMethod.class); method.setConfirmationMethod(confirmationMethod); confirmation.getConfirmationMethods().add(method); final NameIdentifier nameIdentifier = newSamlObject(NameIdentifier.class); nameIdentifier.setNameIdentifier(identifier); final Subject subject = newSamlObject(Subject.class); subject.setNameIdentifier(nameIdentifier); subject.setSubjectConfirmation(confirmation); return subject; }
subjectConfirmation.getConfirmationMethods().add(confirmationMethod); if (subjectBean.getKeyInfo() != null) { KeyInfo keyInfo = createKeyInfo(subjectBean.getKeyInfo());