/** {@inheritDoc} */ protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException { Subject subject = (Subject) parentObject; if (childObject instanceof BaseID) { subject.setBaseID((BaseID) childObject); } else if (childObject instanceof NameID) { subject.setNameID((NameID) childObject); } else if (childObject instanceof EncryptedID) { subject.setEncryptedID((EncryptedID) childObject); } else if (childObject instanceof SubjectConfirmation) { subject.getSubjectConfirmations().add((SubjectConfirmation) childObject); } else { super.processChildElement(parentObject, childObject); } } }
subject.setEncryptedID(encryptedId);
if (decrypted != null) { subject.setNameID(decrypted); subject.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); } } } }