本文整理了Java中org.opensaml.saml.saml1.core.Attribute
类的一些代码示例,展示了Attribute
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attribute
类的具体详情如下:
包路径:org.opensaml.saml.saml1.core.Attribute
类名称:Attribute
[英]This interface defines how the object representing a SAML 1 Attribute
element behaves.
[中]此接口定义表示SAML 1Attribute
元素的对象的行为方式。
代码示例来源:origin: apache/cxf
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;
}
}
代码示例来源:origin: org.apache.wss4j/wss4j-ws-security-common
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);
代码示例来源:origin: apache/cxf
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();
代码示例来源:origin: org.opensaml/opensaml-saml-impl
/** {@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);
}
}
}
代码示例来源:origin: org.apache.cxf.services.sts/cxf-services-sts-core
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();
代码示例来源:origin: org.apereo.cas/cas-server-support-wsfederation
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);
代码示例来源:origin: org.apache.cxf/cxf-rt-ws-security
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;
}
}
代码示例来源:origin: org.jasig.cas/cas-server-support-saml
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));
代码示例来源:origin: org.jasig.cas/cas-server-support-wsfederation
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);
代码示例来源:origin: org.apache.wss4j/wss4j-ws-security-policy-stax
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";
}
}
代码示例来源:origin: net.shibboleth.idp/idp-cas-impl
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));
代码示例来源:origin: apache/cxf
: 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();
代码示例来源:origin: apache/cxf
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);
代码示例来源:origin: org.apache.cxf.services.sts/cxf-services-sts-core
: 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();
内容来源于网络,如有侵权,请联系作者删除!