/** {@inheritDoc} */ protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException { SubjectConfirmation subjectConfirmation = (SubjectConfirmation) parentObject; if (childObject instanceof BaseID) { subjectConfirmation.setBaseID((BaseID) childObject); } else if (childObject instanceof NameID) { subjectConfirmation.setNameID((NameID) childObject); } else if (childObject instanceof EncryptedID) { subjectConfirmation.setEncryptedID((EncryptedID) childObject); } else if (childObject instanceof SubjectConfirmationData) { subjectConfirmation.setSubjectConfirmationData((SubjectConfirmationData) childObject); } else { super.processChildElement(parentObject, childObject); } }
subject.getSubjectConfirmations().forEach(c -> c.setEncryptedID(encryptedConfId));
if (decrypted != null) { sc.setNameID(decrypted); sc.setEncryptedID(null);
/** * Encrypt any {@link NameID}s found in a subject and replace them with the result. * * @param subject subject to operate on * * @throws EncryptionException if an error occurs */ private void processSubject(@Nullable final Subject subject) throws EncryptionException { if (subject != null) { if (shouldEncrypt(subject.getNameID())) { log.debug("{} Encrypt NameID in Subject", getLogPrefix()); final EncryptedID encrypted = getEncrypter().encrypt(subject.getNameID()); subject.setEncryptedID(encrypted); subject.setNameID(null); } for (final SubjectConfirmation sc : subject.getSubjectConfirmations()) { if (shouldEncrypt(sc.getNameID())) { log.debug("{} Encrypt NameID in SubjectConfirmation", getLogPrefix()); final EncryptedID encrypted = getEncrypter().encrypt(sc.getNameID()); sc.setEncryptedID(encrypted); sc.setNameID(null); } } } }