use of org.opensaml.core.xml.schema.XSString in project cas by apereo.
the class SamlMetadataUIInfo method getStringValues.
/**
* Gets string values from the list of mdui objects.
*
* @param items the items
* @return the string values
*/
private static Collection<String> getStringValues(final List<?> items) {
val list = new ArrayList<String>(items.size());
items.forEach(d -> {
if (d instanceof XSURI) {
list.add(((XSURI) d).getURI());
} else if (d instanceof XSString) {
list.add(((XSString) d).getValue());
}
});
return list;
}
use of org.opensaml.core.xml.schema.XSString in project cas by apereo.
the class SamlMetadataUIInfo method getLocalizedValues.
/**
* Gets localized values.
*
* @param locale browser preferred language
* @param items the items
* @return the string value
*/
private static String getLocalizedValues(final String locale, final List<?> items) {
val foundLocale = findLocale(StringUtils.defaultString(locale, "en"), items);
if (foundLocale.isPresent()) {
return foundLocale.get();
}
if (!items.isEmpty()) {
val item = items.get(0);
var value = StringUtils.EMPTY;
if (item instanceof LocalizedName) {
value = ((LocalizedName) item).getValue();
}
if (item instanceof LocalizedURI) {
value = ((LocalizedURI) item).getURI();
}
if (item instanceof XSString) {
value = ((XSString) item).getValue();
}
LOGGER.trace("Loading first available locale [{}]", value);
return value;
}
return null;
}
use of org.opensaml.core.xml.schema.XSString in project spring-security by spring-projects.
the class TestOpenSamlObjects method attribute.
static Attribute attribute(String name, String value) {
Attribute attribute = build(Attribute.DEFAULT_ELEMENT_NAME);
attribute.setName(name);
XSString xsValue = new XSStringBuilder().buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
xsValue.setValue(value);
attribute.getAttributeValues().add(xsValue);
return attribute;
}
Aggregations