本文整理了Java中org.opensaml.saml.saml2.core.Attribute.setName()
方法的一些代码示例,展示了Attribute.setName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attribute.setName()
方法的具体详情如下:
包路径:org.opensaml.saml.saml2.core.Attribute
类名称:Attribute
方法名:setName
[英]Sets the name of this attribute.
[中]设置此属性的名称。
代码示例来源:origin: org.opensaml/opensaml-saml-impl
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
Attribute attrib = (Attribute) samlObject;
if (attribute.getLocalName().equals(Attribute.NAME_ATTTRIB_NAME)) {
attrib.setName(attribute.getValue());
} else if (attribute.getLocalName().equals(Attribute.NAME_FORMAT_ATTRIB_NAME)) {
attrib.setNameFormat(attribute.getValue());
} else if (attribute.getLocalName().equals(Attribute.FRIENDLY_NAME_ATTRIB_NAME)) {
attrib.setFriendlyName(attribute.getValue());
} else {
processUnknownAttribute(attrib, attribute);
}
}
}
代码示例来源:origin: org.wso2.carbon.identity.inbound.auth.saml2/org.wso2.carbon.identity.query.saml
/**
* This method is used to build Attribute Statement including user attributes
*
* @param claims List of requested claims
* @return AttributeStatement set of attributes contain inside attribute statement
* @throws IdentitySAML2QueryException If unable to filter attributes from Map
*/
public static AttributeStatement buildAttributeStatement(Map<String, String> claims) throws IdentitySAML2QueryException {
AttributeStatement attStmt = null;
if (claims != null) {
attStmt = new AttributeStatementBuilder().buildObject();
Iterator<String> iterator = claims.keySet().iterator();
for (int i = 0; i < claims.size(); i++) {
Attribute attrib = new AttributeBuilder().buildObject();
String claimUri = iterator.next();
attrib.setName(claimUri);
XSStringBuilder stringBuilder =
(XSStringBuilder) XMLObjectProviderRegistrySupport.getBuilderFactory()
.getBuilder(XSString.TYPE_NAME);
XSString stringValue =
stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME,
XSString.TYPE_NAME);
stringValue.setValue(claims.get(claimUri));
attrib.getAttributeValues().add(stringValue);
attStmt.getAttributes().add(attrib);
}
}
return attStmt;
}
代码示例来源:origin: org.apache.wss4j/wss4j-ws-security-common
/**
* Create an Attribute object.
*
* @param friendlyName of type String
* @param name of type String
* @param nameFormat of type String
* @return an Attribute object
*/
@SuppressWarnings("unchecked")
public static Attribute createAttribute(String friendlyName, String name, String nameFormat) {
if (attributeBuilder == null) {
attributeBuilder = (SAMLObjectBuilder<Attribute>)
builderFactory.getBuilder(Attribute.DEFAULT_ELEMENT_NAME);
}
Attribute attribute = attributeBuilder.buildObject();
attribute.setFriendlyName(friendlyName);
if (nameFormat == null) {
attribute.setNameFormat(SAML2Constants.ATTRNAME_FORMAT_URI);
} else {
attribute.setNameFormat(nameFormat);
}
attribute.setName(name);
return attribute;
}
代码示例来源:origin: net.shibboleth.idp/idp-saml-impl
/**
* Add Liberty SSOS service Endpoint Reference (EPR) attribute to Assertion's AttributeStatement.
*
* @param requestContext the current request context
* @param assertion the delegated assertion being issued
*/
private void addLibertySSOSEPRAttribute(@Nonnull final ProfileRequestContext requestContext,
@Nonnull final Assertion assertion) {
final Attribute attribute = (Attribute) XMLObjectSupport.buildXMLObject(Attribute.DEFAULT_ELEMENT_NAME);
attribute.setName(LibertyConstants.SERVICE_TYPE_SSOS);
attribute.setNameFormat(Attribute.URI_REFERENCE);
attribute.getAttributeValues().add(buildLibertSSOSEPRAttributeValue(requestContext, assertion));
final List<AttributeStatement> attributeStatements = assertion.getAttributeStatements();
AttributeStatement attributeStatement = null;
if (attributeStatements.isEmpty()) {
attributeStatement =
(AttributeStatement) XMLObjectSupport.buildXMLObject(AttributeStatement.DEFAULT_ELEMENT_NAME);
assertion.getAttributeStatements().add(attributeStatement);
} else {
attributeStatement = attributeStatements.get(0);
}
attributeStatement.getAttributes().add(attribute);
}
代码示例来源:origin: spring-projects/spring-security-saml
org.opensaml.saml.saml2.core.Attribute attribute =
buildSAMLObject(org.opensaml.saml.saml2.core.Attribute.class);
attribute.setName(attr.getName());
attribute.setFriendlyName(attr.getFriendlyName());
attribute.setNameFormat(attr.getNameFormat().toString());
内容来源于网络,如有侵权,请联系作者删除!