Source:
protected List<Claim> parseClaimsInAssertion( org.opensaml.saml.saml2.core.Assertion assertion) { List<org.opensaml.saml.saml2.core.AttributeStatement> attributeStatements = assertion .getAttributeStatements(); if (attributeStatements == null || attributeStatements.isEmpty()) { LOG.debug("No attribute statements found"); return Collections.emptyList(); } List<Claim> collection = new ArrayList<>(); Map<String, Claim> claimsMap = new HashMap<>(); for (org.opensaml.saml.saml2.core.AttributeStatement statement : attributeStatements) { LOG.debug("parsing statement: {}", statement.getElementQName()); List<org.opensaml.saml.saml2.core.Attribute> attributes = statement .getAttributes(); for (org.opensaml.saml.saml2.core.Attribute attribute : attributes) { LOG.debug("parsing attribute: {}", attribute.getName()); Claim c = new Claim(); String attributeName; try { attributeName = URLEncoder.encode(attribute.getName(), "UTF-8"); } catch (UnsupportedEncodingException e) { attributeName = attribute.getName(); } URI attrName = URI.create(attributeName); if (ClaimTypes.URI_BASE.toString().equals(attribute.getNameFormat()) && !attrName.isAbsolute()) { c.setClaimType(URI.create(ClaimTypes.URI_BASE + "/" + attributeName)); } else { c.setClaimType(attrName); } c.setIssuer(assertion.getIssuer().getNameQualifier()); List<String> valueList = new ArrayList<>(); for (XMLObject attributeValue : attribute.getAttributeValues()) { Element attributeValueElement = attributeValue.getDOM(); String value = attributeValueElement.getTextContent(); LOG.debug(" [{}]", value); valueList.add(value); } mergeClaimToMap(claimsMap, c, valueList); } } collection.addAll(claimsMap.values()); return collection; }

Target:
protected List<Claim> parseClaimsInAssertion( org.opensaml.saml.saml2.core.Assertion assertion) { List<org.opensaml.saml.saml2.core.AttributeStatement> attributeStatements = assertion .getAttributeStatements(); if (attributeStatements == null || attributeStatements.isEmpty()) { LOG.debug("No attribute statements found"); return Collections.emptyList(); } List<Claim> collection = new ArrayList<>(); Map<String, Claim> claimsMap = new HashMap<>(); for (org.opensaml.saml.saml2.core.AttributeStatement statement : attributeStatements) { LOG.debug("parsing statement: {}", statement.getElementQName()); List<org.opensaml.saml.saml2.core.Attribute> attributes = statement .getAttributes(); for (org.opensaml.saml.saml2.core.Attribute attribute : attributes) { LOG.debug("parsing attribute: {}", attribute.getName()); Claim c = new Claim(); URI attrName = parseAttributeName(attribute.getName()); if (ClaimTypes.URI_BASE.toString().equals(attribute.getNameFormat()) && !attrName.isAbsolute()) { c.setClaimType(URI.create(ClaimTypes.URI_BASE + "/" + attrName.toString())); } else { c.setClaimType(attrName); } c.setIssuer(assertion.getIssuer().getNameQualifier()); List<String> valueList = new ArrayList<>(); for (XMLObject attributeValue : attribute.getAttributeValues()) { Element attributeValueElement = attributeValue.getDOM(); String value = attributeValueElement.getTextContent(); LOG.debug(" [{}]", value); valueList.add(value); } mergeClaimToMap(claimsMap, c, valueList); } } collection.addAll(claimsMap.values()); return collection; }