if (response.getEncryptedAssertions().isEmpty()) { assertions = response.getAssertions(); } else { for (final EncryptedAssertion encryptedAssertion : response.getEncryptedAssertions()) { builder.add(decryptAssertion(encryptedAssertion, idp.encryptionCredential()));
/** {@inheritDoc} */ protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject) throws UnmarshallingException { Response resp = (Response) parentSAMLObject; if (childSAMLObject instanceof Assertion) { resp.getAssertions().add((Assertion) childSAMLObject); } else if (childSAMLObject instanceof EncryptedAssertion) { resp.getEncryptedAssertions().add((EncryptedAssertion) childSAMLObject); } else { super.processChildElement(parentSAMLObject, childSAMLObject); } }
/** * Decrypt encrypted assertions and add them to the assertions list of the response. * * @param response the response * @param decrypter the decrypter */ protected final void decryptEncryptedAssertions(final Response response, final Decrypter decrypter) { for (final EncryptedAssertion encryptedAssertion : response.getEncryptedAssertions()) { try { final Assertion decryptedAssertion = decrypter.decrypt(encryptedAssertion); response.getAssertions().add(decryptedAssertion); } catch (final DecryptionException e) { logger.error("Decryption of assertion failed, continue with the next one", e); } } }
final Iterator<EncryptedAssertion> i = response.getEncryptedAssertions().iterator(); while (i.hasNext()) { log.debug("{} Decrypting EncryptedAssertion in Response", getLogPrefix());
/** {@inheritDoc} */ @Override protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) { final List<EncryptedAssertion> accumulator = new ArrayList<>(response.getAssertions().size()); for (final Assertion assertion : response.getAssertions()) { try { if (log.isDebugEnabled()) { try { final Element dom = XMLObjectSupport.marshall(assertion); log.debug("{} Assertion before encryption:\n{}", getLogPrefix(), SerializeSupport.prettyPrintXML(dom)); } catch (final MarshallingException e) { log.error("{} Unable to marshall message for logging purposes", getLogPrefix(), e); } } accumulator.add(getEncrypter().encrypt(assertion)); } catch (final EncryptionException e) { log.warn("{} Error encrypting assertion", getLogPrefix(), e); ActionSupport.buildEvent(profileRequestContext, EventIds.UNABLE_TO_ENCRYPT); return; } } response.getEncryptedAssertions().addAll(accumulator); response.getAssertions().clear(); }
.collect(Collectors.toList()) ); if (parsed.getEncryptedAssertions() != null && !parsed.getEncryptedAssertions().isEmpty()) { parsed .getEncryptedAssertions() .stream() .forEach(
samlResponse.getEncryptedAssertions().add(EncryptedAssertion.class.cast(finalAssertion)); } else { LOGGER.trace("Built assertion is not encrypted, so the response will add it to the assertions collection");
for (org.opensaml.saml.saml2.core.EncryptedAssertion assertion : samlResponse.getEncryptedAssertions()) {
if (response.getEncryptedAssertions().isEmpty()) { assertions = response.getAssertions(); } else { for (final EncryptedAssertion encryptedAssertion : response.getEncryptedAssertions()) { builder.add(decryptAssertion(encryptedAssertion, idp.encryptionCredential()));
List<EncryptedAssertion> encryptedAssertions = saml2Response.getEncryptedAssertions(); EncryptedAssertion encryptedAssertion; if (!((encryptedAssertions == null) || (encryptedAssertions.isEmpty()))) {
EncryptedAssertion encryptedAssertion = encryptAssertion(osAssertion, a.getEncryptionKey(), a.getKeyAlgorithm(), a.getDataAlgorithm()); result.getEncryptedAssertions().add(encryptedAssertion);