SamlUtil { public static Map<String, List<Serializable>> getAttributesMap( List<Attribute> attributes, Properties attributeMappingsProperties) { Map<String, List<Serializable>> attributesMap = new HashMap<>(); for (Attribute attribute : attributes) { String key = attributeMappingsProperties.getProperty( attribute.getName()); if (Validator.isNull(key) && Validator.isNotNull(attribute.getFriendlyName())) { key = attributeMappingsProperties.getProperty( attribute.getFriendlyName()); } if (Validator.isNull(key)) { key = attribute.getName(); } List<XMLObject> xmlValues = attribute.getAttributeValues(); List<Serializable> values = attributesMap.get(key); if (values == null) { values = new ArrayList<>(xmlValues.size()); } for (XMLObject xmlObject : xmlValues) { Serializable value = getXMLObjectValue(xmlObject); if (value != null) { values.add(value); } } attributesMap.put(key, values); } return attributesMap; }  static AssertionConsumerService getAssertionConsumerServiceForBinding(
				SPSSODescriptor spSSODescriptor, String binding); static Attribute getAttribute(
		List<Attribute> attributes, String attributeName); static Map<String, List<Serializable>> getAttributesMap(
		List<Attribute> attributes, Properties attributeMappingsProperties); static AuthnRequest getAuthnRequest(
		MessageContext<?> messageContext); static EntityDescriptor getEntityDescriptorById(
		String entityId, EntitiesDescriptor descriptor); static EntityDescriptor getEntityDescriptorById(
		String entityId, XMLObject metadata); static String getNameIdFormat(NameID nameID); static SingleLogoutService getSingleLogoutServiceForBinding(
			SSODescriptor ssoDescriptor, String binding); static SingleSignOnService getSingleSignOnServiceForBinding(
			IDPSSODescriptor idpSSODescriptor, String binding); static Date getValueAsDate(
		String key, Map<String, List<Serializable>> attributesMap); static DateTime getValueAsDateTime(
		String key, Map<String, List<Serializable>> attributesMap); static String getValueAsString(Attribute attribute); static String getValueAsString(
		String key, Map<String, List<Serializable>> attributesMap); static String getValueAsString(XMLObject xmlObject); static Serializable getXMLObjectValue(XMLObject xmlObject); static AssertionConsumerService resolverAssertionConsumerService(
		MessageContext<?> messageContext, String binding); static SingleLogoutService resolveSingleLogoutService(
		SSODescriptor ssoDescriptor, String preferredBinding); static SingleSignOnService resolveSingleSignOnService(
		IDPSSODescriptor idpSSODescriptor, String preferredBinding);  }
@Test public void testGetAttributesMap() { List<Attribute> attributes = new ArrayList<>(); attributes.add( OpenSamlUtil.buildAttribute("emailAddress", "test@liferay.com")); attributes.add( OpenSamlUtil.buildAttribute("firstName", "TestFirstName")); attributes.add(OpenSamlUtil.buildAttribute("lastName", "TestLastName")); attributes.add(OpenSamlUtil.buildAttribute("screenName", "test")); Map<String, List<Serializable>> attributesMap = SamlUtil.getAttributesMap(attributes, new Properties()); Assert.assertEquals( "test@liferay.com", SamlUtil.getValueAsString("emailAddress", attributesMap)); Assert.assertEquals( "TestFirstName", SamlUtil.getValueAsString("firstName", attributesMap)); Assert.assertEquals( "TestLastName", SamlUtil.getValueAsString("lastName", attributesMap)); Assert.assertEquals( "test", SamlUtil.getValueAsString("screenName", attributesMap)); }