本文整理汇总了Java中org.opensaml.xml.schema.impl.XSStringBuilder类的典型用法代码示例。如果您正苦于以下问题:Java XSStringBuilder类的具体用法?Java XSStringBuilder怎么用?Java XSStringBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XSStringBuilder类属于org.opensaml.xml.schema.impl包,在下文中一共展示了XSStringBuilder类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: buildAttributeStatement
import org.opensaml.xml.schema.impl.XSStringBuilder; //导入依赖的package包/类
/**
* Build Attribute Statement
*
* @param claims
* @return AttributeStatement
*/
private AttributeStatement buildAttributeStatement(Map<String, String> claims) {
AttributeStatement attStmt = null;
if (claims != null) {
attStmt = new AttributeStatementBuilder().buildObject();
Iterator<String> ite = claims.keySet().iterator();
for (int i = 0; i < claims.size(); i++) {
Attribute attrib = new AttributeBuilder().buildObject();
String claimUri = ite.next();
attrib.setName(claimUri);
// look
// https://wiki.shibboleth.net/confluence/display/OpenSAML/OSTwoUsrManJavaAnyTypes
XSStringBuilder stringBuilder =
(XSStringBuilder) Configuration.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;
}
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:32,代码来源:SAMLResponseBuilder.java
示例2: createAttributeStatement
import org.opensaml.xml.schema.impl.XSStringBuilder; //导入依赖的package包/类
private AttributeStatement createAttributeStatement(HashMap<String, List<String>> attributes) {
// create authenticationstatement object
AttributeStatementBuilder attributeStatementBuilder = new AttributeStatementBuilder();
AttributeStatement attributeStatement = attributeStatementBuilder.buildObject();
AttributeBuilder attributeBuilder = new AttributeBuilder();
if (attributes != null) {
for (Map.Entry<String, List<String>> entry : attributes.entrySet()) {
Attribute attribute = attributeBuilder.buildObject();
attribute.setName(entry.getKey());
for (String value : entry.getValue()) {
XSStringBuilder stringBuilder = new XSStringBuilder();
XSString attributeValue = stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
attributeValue.setValue(value);
attribute.getAttributeValues().add(attributeValue);
}
attributeStatement.getAttributes().add(attribute);
}
}
return attributeStatement;
}
开发者ID:rackerlabs,项目名称:saml-generator,代码行数:25,代码来源:SamlAssertionProducer.java
示例3: buildAttributeStatement
import org.opensaml.xml.schema.impl.XSStringBuilder; //导入依赖的package包/类
private AttributeStatement buildAttributeStatement() {
AttributeStatement attributeStatement = OpenSAMLUtils.buildSAMLObject(AttributeStatement.class);
Attribute attributeUserName = OpenSAMLUtils.buildSAMLObject(Attribute.class);
XSStringBuilder stringBuilder = (XSStringBuilder)Configuration.getBuilderFactory().getBuilder(XSString.TYPE_NAME);
XSString userNameValue = stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
userNameValue.setValue("bob");
attributeUserName.getAttributeValues().add(userNameValue);
attributeUserName.setName("username");
attributeStatement.getAttributes().add(attributeUserName);
Attribute attributeLevel = OpenSAMLUtils.buildSAMLObject(Attribute.class);
XSString levelValue = stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
levelValue.setValue("999999999");
attributeLevel.getAttributeValues().add(levelValue);
attributeLevel.setName("telephone");
attributeStatement.getAttributes().add(attributeLevel);
return attributeStatement;
}
开发者ID:rasmusson,项目名称:webprofile-ref-project,代码行数:25,代码来源:ArtifactResolutionServlet.java
示例4: buildAttributeStatement
import org.opensaml.xml.schema.impl.XSStringBuilder; //导入依赖的package包/类
private AttributeStatement buildAttributeStatement() throws IllegalAccessException {
AttributeStatement attributeStatement = buildXMLObjectDefaultName(AttributeStatement.class);
Attribute attributeUserName = buildXMLObjectDefaultName(Attribute.class);
XSStringBuilder stringBuilder = (XSStringBuilder)Configuration.getBuilderFactory().getBuilder(XSString.TYPE_NAME);
XSString userNameValue = stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
userNameValue.setValue(MockIDPAuthnReq.userId);
attributeUserName.getAttributeValues().add(userNameValue);
attributeUserName.setName("uid");
attributeStatement.getAttributes().add(attributeUserName);
Attribute attributeLevel = buildXMLObjectDefaultName(Attribute.class);
XSString levelValue = stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
levelValue.setValue(MockIDPAuthnReq.secLevel);
attributeLevel.getAttributeValues().add(levelValue);
attributeLevel.setName("SecurityLevel");
attributeStatement.getAttributes().add(attributeLevel);
return attributeStatement;
}
开发者ID:rasmusson,项目名称:MockIDP,代码行数:25,代码来源:MockIDPArtifactResolve.java
示例5: populateRequiredData
import org.opensaml.xml.schema.impl.XSStringBuilder; //导入依赖的package包/类
/** {@inheritDoc} */
protected void populateRequiredData() {
super.populateRequiredData();
Attribute attribute = (Attribute) target;
XSStringBuilder attributeValueBuilder = (XSStringBuilder) builderFactory.getBuilder(XSString.TYPE_NAME);
attribute.getAttributeValues().add(attributeValueBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME));
}
开发者ID:apigee,项目名称:java-opensaml2,代码行数:10,代码来源:AttributeSchemaTest.java
示例6: testChildElementsMarshall
import org.opensaml.xml.schema.impl.XSStringBuilder; //导入依赖的package包/类
/** {@inheritDoc} */
public void testChildElementsMarshall(){
Attribute attribute = (Attribute) buildXMLObject(qname);
XSStringBuilder attributeValueBuilder = (XSStringBuilder) builderFactory.getBuilder(XSString.TYPE_NAME);
attribute.getAttributeValues().add(attributeValueBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME));
attribute.getAttributeValues().add(attributeValueBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME));
attribute.getAttributeValues().add(attributeValueBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME));
attribute.getAttributeValues().add(attributeValueBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME));
assertEquals(expectedChildElementsDOM, attribute);
}
开发者ID:apigee,项目名称:java-opensaml2,代码行数:14,代码来源:AttributeTest.java
示例7: createStatement
import org.opensaml.xml.schema.impl.XSStringBuilder; //导入依赖的package包/类
@Override
public void createStatement(GenericIdentityProviderData ipData, RahasData rahasData)
throws IdentityProviderException {
if (log.isDebugEnabled()) {
log.debug("Begin SAML statement creation.");
}
attributeStmt = (AttributeStatement) buildXMLObject(AttributeStatement.DEFAULT_ELEMENT_NAME);
Map<String, RequestedClaimData> mapClaims = ipData.getRequestedClaims();
if (rahasData.getAppliesToAddress() != null) {
appilesTo = rahasData.getAppliesToAddress();
}
Iterator<RequestedClaimData> ite = mapClaims.values().iterator();
while (ite.hasNext()) {
RequestedClaimData claim = ite.next();
String uri = claim.getUri();
int index = uri.lastIndexOf("/");
String attrName = uri.substring(index + 1, uri.length());
String attrNamespace = uri.substring(0, index);
Attribute attribute = (Attribute) buildXMLObject(Attribute.DEFAULT_ELEMENT_NAME);
attribute.setName(attrName);
attribute.setNameFormat(attrNamespace);
XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
// TODO remove this else if condition after WSO2 IS supports claim
// types properly
if (claim.getUri().equals(IdentityConstants.CLAIM_PPID)) {
XSBase64BinaryBuilder ppidValueBuilder = (XSBase64BinaryBuilder) builderFactory
.getBuilder(XSBase64Binary.TYPE_NAME);
XSBase64Binary ppidValue = ppidValueBuilder.buildObject(
AttributeValue.DEFAULT_ELEMENT_NAME, XSBase64Binary.TYPE_NAME);
ppidValue.setValue(claim.getValue());
attribute.getAttributeValues().add(ppidValue);
} else {
XSStringBuilder attributeValueBuilder = (XSStringBuilder) builderFactory
.getBuilder(XSString.TYPE_NAME);
XSString stringValue = attributeValueBuilder.buildObject(
AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
stringValue.setValue(claim.getValue());
attribute.getAttributeValues().add(stringValue);
}
attributeStmt.getAttributes().add(attribute);
}
}
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:52,代码来源:SAML2TokenBuilder.java
示例8: createStatement
import org.opensaml.xml.schema.impl.XSStringBuilder; //导入依赖的package包/类
@Override
public void createStatement(GenericIdentityProviderData ipData, RahasData rahasData)
throws IdentityProviderException {
if (log.isDebugEnabled()) {
log.debug("Begin SAML statement creation.");
}
attributeStmt = (AttributeStatement) buildXMLObject(AttributeStatement.DEFAULT_ELEMENT_NAME);
Subject subject = (Subject) buildXMLObject(Subject.DEFAULT_ELEMENT_NAME);
SubjectConfirmation subjectConf =
(SubjectConfirmation) buildXMLObject(SubjectConfirmation.DEFAULT_ELEMENT_NAME);
ConfirmationMethod confMethod = (ConfirmationMethod) buildXMLObject(ConfirmationMethod.DEFAULT_ELEMENT_NAME);
confMethod.setConfirmationMethod(CONF_KEY);
subjectConf.getConfirmationMethods().add(confMethod);
subject.setSubjectConfirmation(subjectConf);
attributeStmt.setSubject(subject);
Map<String, RequestedClaimData> mapClaims = ipData.getRequestedClaims();
if (rahasData.getAppliesToAddress() != null) {
appilesTo = rahasData.getAppliesToAddress();
}
Iterator<RequestedClaimData> ite = mapClaims.values().iterator();
while (ite.hasNext()) {
RequestedClaimData claim = ite.next();
String uri = claim.getUri();
int index = uri.lastIndexOf("/");
String attrName = uri.substring(index + 1, uri.length());
String attrNamespace = uri.substring(0, index);
Attribute attribute = (Attribute) buildXMLObject(Attribute.DEFAULT_ELEMENT_NAME);
attribute.setAttributeName(attrName);
attribute.setAttributeNamespace(attrNamespace);
XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
XSStringBuilder attributeValueBuilder = (XSStringBuilder) builderFactory.getBuilder(XSString.TYPE_NAME);
XSString stringValue =
attributeValueBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
stringValue.setValue(claim.getValue());
attribute.getAttributeValues().add(stringValue);
attributeStmt.getAttributes().add(attribute);
}
}
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:50,代码来源:SAML1TokenBuilder.java
示例9: buildAttributeStatement
import org.opensaml.xml.schema.impl.XSStringBuilder; //导入依赖的package包/类
private AttributeStatement buildAttributeStatement(Map<String, String> claims) {
String claimSeparator = claims.get(IdentityCoreConstants.MULTI_ATTRIBUTE_SEPARATOR);
if (StringUtils.isNotBlank(claimSeparator)) {
userAttributeSeparator = claimSeparator;
}
claims.remove(IdentityCoreConstants.MULTI_ATTRIBUTE_SEPARATOR);
AttributeStatement attStmt = new AttributeStatementBuilder().buildObject();
Iterator<Map.Entry<String, String>> iterator = claims.entrySet().iterator();
boolean atLeastOneNotEmpty = false;
for (int i = 0; i < claims.size(); i++) {
Map.Entry<String, String> claimEntry = iterator.next();
String claimUri = claimEntry.getKey();
String claimValue = claimEntry.getValue();
if (claimUri != null && !claimUri.trim().isEmpty() && claimValue != null && !claimValue.trim().isEmpty()) {
atLeastOneNotEmpty = true;
Attribute attribute = new AttributeBuilder().buildObject();
attribute.setName(claimUri);
//setting NAMEFORMAT attribute value to basic attribute profile
attribute.setNameFormat(SAMLSSOConstants.NAME_FORMAT_BASIC);
// look
// https://wiki.shibboleth.net/confluence/display/OpenSAML/OSTwoUsrManJavaAnyTypes
XSStringBuilder stringBuilder = (XSStringBuilder) Configuration.getBuilderFactory().
getBuilder(XSString.TYPE_NAME);
XSString stringValue;
//Need to check if the claim has multiple values
if (userAttributeSeparator != null && claimValue.contains(userAttributeSeparator)) {
StringTokenizer st = new StringTokenizer(claimValue, userAttributeSeparator);
while (st.hasMoreElements()) {
String attValue = st.nextElement().toString();
if (attValue != null && attValue.trim().length() > 0) {
stringValue = stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
stringValue.setValue(attValue);
attribute.getAttributeValues().add(stringValue);
}
}
} else {
stringValue = stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
stringValue.setValue(claimValue);
attribute.getAttributeValues().add(stringValue);
}
attStmt.getAttributes().add(attribute);
}
}
if (atLeastOneNotEmpty) {
return attStmt;
} else {
return null;
}
}
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:54,代码来源:DefaultSAMLAssertionBuilder.java
注:本文中的org.opensaml.xml.schema.impl.XSStringBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论