private boolean findClaimInAssertion(org.opensaml.saml.saml1.core.Assertion assertion, URI claimURI) { List<org.opensaml.saml.saml1.core.AttributeStatement> attributeStatements = assertion.getAttributeStatements(); if (attributeStatements == null || attributeStatements.isEmpty()) { return false; } for (org.opensaml.saml.saml1.core.AttributeStatement statement : attributeStatements) { List<org.opensaml.saml.saml1.core.Attribute> attributes = statement.getAttributes(); for (org.opensaml.saml.saml1.core.Attribute attribute : attributes) { URI attributeNamespace = URI.create(attribute.getAttributeNamespace()); String desiredRole = attributeNamespace.relativize(claimURI).toString(); if (attribute.getAttributeName().equals(desiredRole) && attribute.getAttributeValues() != null && !attribute.getAttributeValues().isEmpty()) { return true; } } } return false; } }
attribute.setAttributeName(attributeName); attribute.setAttributeNamespace(attributeUrn); stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME); attribute1.setValue((String)value); attribute.getAttributeValues().add(attribute1); } else if (value instanceof XMLObject) { attribute.getAttributeValues().add((XMLObject)value);
for (org.opensaml.saml.saml1.core.Attribute attribute : attributes) { if (LOG.isLoggable(Level.FINEST)) { LOG.finest("parsing attribute: " + attribute.getAttributeName()); c.setClaimType(URI.create(attribute.getAttributeName())); try { c.setClaimType(new URI(attribute.getAttributeName())); } catch (URISyntaxException e) { LOG.warning("Invalid attribute name in attributestatement: " + e.getMessage()); continue; for (XMLObject attributeValue : attribute.getAttributeValues()) { Element attributeValueElement = attributeValue.getDOM(); String value = attributeValueElement.getTextContent();
/** {@inheritDoc} */ protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject) throws UnmarshallingException { Attribute attribute = (Attribute) parentSAMLObject; QName childQName = childSAMLObject.getElementQName(); if ("AttributeValue".equals(childQName.getLocalPart()) && childQName.getNamespaceURI().equals(SAMLConstants.SAML1_NS)) { attribute.getAttributeValues().add(childSAMLObject); } else { super.processChildElement(parentSAMLObject, childSAMLObject); } } }
for (org.opensaml.saml.saml1.core.Attribute attribute : attributes) { if (LOG.isLoggable(Level.FINEST)) { LOG.finest("parsing attribute: " + attribute.getAttributeName()); c.setClaimType(URI.create(attribute.getAttributeName())); try { c.setClaimType(new URI(attribute.getAttributeName())); } catch (URISyntaxException e) { LOG.warning("Invalid attribute name in attributestatement: " + e.getMessage()); continue; for (XMLObject attributeValue : attribute.getAttributeValues()) { Element attributeValueElement = attributeValue.getDOM(); String value = attributeValueElement.getTextContent();
LOGGER.debug("Processed attribute: [{}]", item.getAttributeName()); final List<Object> itemList = item.getAttributeValues().stream() .map(xmlObject -> ((XSAny) xmlObject).getTextContent()) .collect(Collectors.toList()); if (!itemList.isEmpty()) { attributes.put(item.getAttributeName(), itemList);
private boolean findClaimInAssertion(org.opensaml.saml.saml1.core.Assertion assertion, URI claimURI) { List<org.opensaml.saml.saml1.core.AttributeStatement> attributeStatements = assertion.getAttributeStatements(); if (attributeStatements == null || attributeStatements.isEmpty()) { return false; } for (org.opensaml.saml.saml1.core.AttributeStatement statement : attributeStatements) { List<org.opensaml.saml.saml1.core.Attribute> attributes = statement.getAttributes(); for (org.opensaml.saml.saml1.core.Attribute attribute : attributes) { URI attributeNamespace = URI.create(attribute.getAttributeNamespace()); String desiredRole = attributeNamespace.relativize(claimURI).toString(); if (attribute.getAttributeName().equals(desiredRole) && attribute.getAttributeValues() != null && !attribute.getAttributeValues().isEmpty()) { return true; } } } return false; } }
attribute.setAttributeName(e.getKey()); attribute.setAttributeNamespace(attributeNamespace); if (e.getValue() instanceof Collection<?>) { final Collection<?> c = (Collection<?>) e.getValue(); for (final Object value : c) { attribute.getAttributeValues().add(newAttributeValue(value, AttributeValue.DEFAULT_ELEMENT_NAME)); attribute.getAttributeValues().add(newAttributeValue(e.getValue(), AttributeValue.DEFAULT_ELEMENT_NAME));
for (final AttributeStatement attributeStatement : assertion.getAttributeStatements()) { for (final Attribute item : attributeStatement.getAttributes()) { LOGGER.debug("Processed attribute: {}", item.getAttributeName()); for (int i = 0; i < item.getAttributeValues().size(); i++) { itemList.add(((XSAny) item.getAttributeValues().get(i)).getTextContent()); attributes.put(item.getAttributeName(), itemList);
protected String findClaimInAssertion(org.opensaml.saml.saml1.core.Assertion assertion, URI claimURI) { List<org.opensaml.saml.saml1.core.AttributeStatement> attributeStatements = assertion.getAttributeStatements(); if (attributeStatements == null || attributeStatements.isEmpty()) { return "Attribute " + claimURI + " not found in the SAMLAssertion"; } for (org.opensaml.saml.saml1.core.AttributeStatement statement : attributeStatements) { List<org.opensaml.saml.saml1.core.Attribute> attributes = statement.getAttributes(); for (org.opensaml.saml.saml1.core.Attribute attribute : attributes) { URI attributeNamespace = URI.create(attribute.getAttributeNamespace()); String desiredRole = attributeNamespace.relativize(claimURI).toString(); if (attribute.getAttributeName().equals(desiredRole) && attribute.getAttributeValues() != null && !attribute.getAttributeValues().isEmpty()) { return null; } } } return "Attribute " + claimURI + " not found in the SAMLAssertion"; } }
for (final String attrName : ticketResponse.getAttributes().keySet()) { final Attribute attribute = newSAMLObject(Attribute.class, Attribute.DEFAULT_ELEMENT_NAME); attribute.setAttributeName(attrName); attribute.setAttributeNamespace(NAMESPACE); for (final String value : ticketResponse.getAttributes().get(attrName)) { attribute.getAttributeValues().add(newAttributeValue(value));
: wrapper.getSaml1().getAttributeStatements()) { for (org.opensaml.saml.saml1.core.Attribute attribute : attributeStatement.getAttributes()) { if ("ActAs".equals(attribute.getAttributeName())) { for (XMLObject attributeValue : attribute.getAttributeValues()) { Element attributeValueElement = attributeValue.getDOM(); String text = attributeValueElement.getTextContent();
SAMLClaim claim = new SAMLClaim(); String claimType = atr.getAttributeName(); if (atr.getAttributeNamespace() != null) { claimType = atr.getAttributeNamespace() + "/" + claimType; claim.setName(atr.getAttributeName()); claim.setNameFormat(atr.getAttributeNamespace()); for (XMLObject o : atr.getAttributeValues()) { String attrValue = o.getDOM().getTextContent(); claim.getValues().add(attrValue);
: wrapper.getSaml1().getAttributeStatements()) { for (org.opensaml.saml.saml1.core.Attribute attribute : attributeStatement.getAttributes()) { if ("ActAs".equals(attribute.getAttributeName())) { for (XMLObject attributeValue : attribute.getAttributeValues()) { Element attributeValueElement = attributeValue.getDOM(); String text = attributeValueElement.getTextContent();