/** {@inheritDoc} */ protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException { AttributeStatement attributeStatement = (AttributeStatement) parentObject; if (childObject instanceof Attribute) { attributeStatement.getAttributes().add((Attribute) childObject); } else if (childObject instanceof EncryptedAttribute) { attributeStatement.getEncryptedAttributes().add((EncryptedAttribute) childObject); } else { super.processChildElement(parentObject, childObject); } } }
@Override @SneakyThrows public void build(final AttributeStatement attrStatement, final Attribute attribute) { if (!service.isEncryptAttributes() || !shouldEncryptAttribute(attribute)) { LOGGER.debug("Service [{}] is configured to not encrypt attributes for [{}]", service.getName(), attribute.getName()); super.build(attrStatement, attribute); return; } val encryptedAttribute = samlObjectEncrypter.encode(attribute, service, adaptor); LOGGER.debug("Encrypted attribute [{}] for service [{}]", attribute.getName(), service.getName()); attrStatement.getEncryptedAttributes().add(encryptedAttribute); }
final Iterator<EncryptedAttribute> i = s.getEncryptedAttributes().iterator(); while (i.hasNext()) { log.debug("{} Decrypting EncryptedAttribute in AttributeStatement", getLogPrefix());
statement.getEncryptedAttributes().addAll(accumulator); statement.getAttributes().clear();
protected List<Attribute> getAttributes( List<AttributeStatement> attributeStatements, List<SimpleKey> localKeys ) { List<Attribute> result = new LinkedList<>(); for (AttributeStatement stmt : ofNullable(attributeStatements).orElse(emptyList())) { for (org.opensaml.saml.saml2.core.Attribute a : ofNullable(stmt.getAttributes()).orElse(emptyList())) { result.add( new Attribute() .setFriendlyName(a.getFriendlyName()) .setName(a.getName()) .setNameFormat(AttributeNameFormat.fromUrn(a.getNameFormat())) .setValues(getJavaValues(a.getAttributeValues())) ); } for (EncryptedAttribute encryptedAttribute : ofNullable(stmt.getEncryptedAttributes()).orElse(emptyList())) { org.opensaml.saml.saml2.core.Attribute a = (org.opensaml.saml.saml2.core.Attribute) decrypt (encryptedAttribute, localKeys); result.add( new Attribute() .setFriendlyName(a.getFriendlyName()) .setName(a.getName()) .setNameFormat(AttributeNameFormat.fromUrn(a.getNameFormat())) .setValues(getJavaValues(a.getAttributeValues())) ); } } return result; }
response, casAssertion, service, adaptor, binding, messageContext); if (!attrStatement.getAttributes().isEmpty() || !attrStatement.getEncryptedAttributes().isEmpty()) { statements.add(attrStatement);
attributes.add(attribute); if (!attributeStatement.getEncryptedAttributes().isEmpty()) { if (decrypter == null) { logger.warn("Encrypted attributes returned, but no keystore was provided."); } else { for (final EncryptedAttribute encryptedAttribute : attributeStatement.getEncryptedAttributes()) { try { attributes.add(decrypter.decrypt(encryptedAttribute));