Source:
protected void validateSubject(final Subject subject, final ExtendedSAMLMessageContext context, final Decrypter decrypter) { boolean satisfied = false; NameID nameIdFromSubject = subject.getNameID(); final BaseID baseIdFromSubject = subject.getBaseID(); final EncryptedID encryptedIdFromSubject = subject.getEncryptedID(); final NameID decryptedNameIdFromSubject = decryptEncryptedId(encryptedIdFromSubject, decrypter); if (decryptedNameIdFromSubject != null) { nameIdFromSubject = decryptedNameIdFromSubject; } if ((nameIdFromSubject != null) || (baseIdFromSubject != null)) { context.setSubjectNameIdentifier(nameIdFromSubject); context.setBaseID(baseIdFromSubject); satisfied = true; } else { for (SubjectConfirmation confirmation : subject.getSubjectConfirmations()) { if (SubjectConfirmation.METHOD_BEARER.equals(confirmation.getMethod())) { if (isValidBearerSubjectConfirmationData(confirmation.getSubjectConfirmationData(), context)) { context.getSubjectConfirmations().add(confirmation); NameID nameIDFromConfirmation = confirmation.getNameID(); final BaseID baseIDFromConfirmation = confirmation.getBaseID(); final EncryptedID encryptedIDFromConfirmation = confirmation.getEncryptedID(); final NameID decryptedNameIdFromConfirmation = decryptEncryptedId(encryptedIDFromConfirmation, decrypter); if (decryptedNameIdFromConfirmation != null) { nameIDFromConfirmation = decryptedNameIdFromConfirmation; } if ((nameIDFromConfirmation != null) || (baseIDFromConfirmation != null)) { context.setSubjectNameIdentifier(nameIDFromConfirmation); context.setBaseID(baseIDFromConfirmation); satisfied = true; } } } } } if (!satisfied) { logger.warn("Could not find any Subject NameID/BaseID/EnryptedID, neither directly in the Subject nor in any Subject Confirmation. However, this may still be a valid assertion."); } }

Target:
protected void validateSubject(final Subject subject, final ExtendedSAMLMessageContext context, final Decrypter decrypter) { boolean satisfied = false; NameID nameIdFromSubject = subject.getNameID(); final BaseID baseIdFromSubject = subject.getBaseID(); final EncryptedID encryptedIdFromSubject = subject.getEncryptedID(); final NameID decryptedNameIdFromSubject = decryptEncryptedId(encryptedIdFromSubject, decrypter); if (decryptedNameIdFromSubject != null) { nameIdFromSubject = decryptedNameIdFromSubject; } if (nameIdFromSubject != null || baseIdFromSubject != null) { context.setSubjectNameIdentifier(nameIdFromSubject); context.setBaseID(baseIdFromSubject); satisfied = true; } else { for (SubjectConfirmation confirmation : subject.getSubjectConfirmations()) { if (SubjectConfirmation.METHOD_BEARER.equals(confirmation.getMethod())) { if (isValidBearerSubjectConfirmationData(confirmation.getSubjectConfirmationData(), context)) { NameID nameIDFromConfirmation = confirmation.getNameID(); final BaseID baseIDFromConfirmation = confirmation.getBaseID(); final EncryptedID encryptedIDFromConfirmation = confirmation.getEncryptedID(); final NameID decryptedNameIdFromConfirmation = decryptEncryptedId(encryptedIDFromConfirmation, decrypter); if (decryptedNameIdFromConfirmation != null) { nameIDFromConfirmation = decryptedNameIdFromConfirmation; } if ((nameIDFromConfirmation != null) || (baseIDFromConfirmation != null)) { context.setSubjectNameIdentifier(nameIDFromConfirmation); context.setBaseID(baseIDFromConfirmation); context.getSubjectConfirmations().add(confirmation); satisfied = true; } } } } } if (!satisfied) { logger.warn("Could not find any Subject NameID/BaseID/EnryptedID, neither directly in the Subject nor in any Subject Confirmation."); throw new SamlException("Subject confirmation validation failed"); } }