当前位置: 首页>>代码示例>>Java>>正文


Java AttributeStatement类代码示例

本文整理汇总了Java中org.opensaml.saml1.core.AttributeStatement的典型用法代码示例。如果您正苦于以下问题:Java AttributeStatement类的具体用法?Java AttributeStatement怎么用?Java AttributeStatement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AttributeStatement类属于org.opensaml.saml1.core包,在下文中一共展示了AttributeStatement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testChildElementsMarshall

import org.opensaml.saml1.core.AttributeStatement; //导入依赖的package包/类
/**
 * Test an XML file with Children
 * @throws MarshallingException 
 */

public void testChildElementsMarshall() {
    Assertion assertion = (Assertion) buildXMLObject(qname);
    
    assertion.setConditions((Conditions) buildXMLObject(Conditions.DEFAULT_ELEMENT_NAME));
    assertion.setAdvice((Advice) buildXMLObject(Advice.DEFAULT_ELEMENT_NAME));

    QName authenticationQname = AuthenticationStatement.DEFAULT_ELEMENT_NAME;
    QName authorizationQname = AuthorizationDecisionStatement.DEFAULT_ELEMENT_NAME;
    QName attributeQname = AttributeStatement.DEFAULT_ELEMENT_NAME;
    
    assertion.getStatements().add((Statement) buildXMLObject(authenticationQname));
    assertion.getStatements().add((Statement) buildXMLObject(authorizationQname));
    assertion.getStatements().add((Statement) buildXMLObject(attributeQname));
    assertion.getStatements().add((Statement) buildXMLObject(authenticationQname));
    assertion.getStatements().add((Statement) buildXMLObject(authorizationQname));
    assertion.getStatements().add((Statement) buildXMLObject(attributeQname));
    assertion.getStatements().add((Statement) buildXMLObject(authorizationQname));
    assertion.getStatements().add((Statement) buildXMLObject(attributeQname));

    assertEquals(expectedChildElementsDOM, assertion);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:27,代码来源:AssertionTest.java

示例2: testChildElementsUnmarshall

import org.opensaml.saml1.core.AttributeStatement; //导入依赖的package包/类
/** {@inheritDoc} */

    public void testChildElementsUnmarshall() {
        AttributeStatement attributeStatement = (AttributeStatement) unmarshallElement(childElementsFile);

        assertNotNull("<Subject> element not present", attributeStatement.getSubject());
        assertNotNull("<AuthorityBinding> elements not present", attributeStatement.getAttributes());
        assertEquals("count of <AuthorityBinding> elements", 5, attributeStatement.getAttributes().size());

        Attribute attribute = attributeStatement.getAttributes().get(0);
        attributeStatement.getAttributes().remove(attribute);
        assertEquals("count of <AttributeStatement> elements after single remove", 4, attributeStatement
                .getAttributes().size());

        ArrayList<Attribute> list = new ArrayList<Attribute>(2);

        list.add(attributeStatement.getAttributes().get(0));
        list.add(attributeStatement.getAttributes().get(2));

        attributeStatement.getAttributes().removeAll(list);

        assertEquals("count of <AttributeStatement> elements after double remove", 2, attributeStatement
                .getAttributes().size());
    }
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:25,代码来源:AttributeStatementTest.java

示例3: validate

import org.opensaml.saml1.core.AttributeStatement; //导入依赖的package包/类
/** {@inheritDoc} */
public void validate(AttributeStatement attributeStatement) throws ValidationException {        
    super.validate(attributeStatement);

    if (attributeStatement.getAttributes().size() == 0) {
        throw new ValidationException("No Attribute Element present");
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:AttributeStatementSchemaValidator.java

示例4: processChildElement

import org.opensaml.saml1.core.AttributeStatement; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
        throws UnmarshallingException {

    AttributeStatement attributeStatement = (AttributeStatement) parentSAMLObject;

    if (childSAMLObject instanceof Attribute) {
        attributeStatement.getAttributes().add((Attribute) childSAMLObject);
    } else {
        super.processChildElement(parentSAMLObject, childSAMLObject);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:AttributeStatementUnmarshaller.java

示例5: AttributeStatementSchemaTest

import org.opensaml.saml1.core.AttributeStatement; //导入依赖的package包/类
/** Constructor */
public AttributeStatementSchemaTest() {
    super();
    targetQName = new QName(SAMLConstants.SAML1_NS, AttributeStatement.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
    validator = new AttributeStatementSchemaValidator();

}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:8,代码来源:AttributeStatementSchemaTest.java

示例6: populateRequiredData

import org.opensaml.saml1.core.AttributeStatement; //导入依赖的package包/类
/** {@inheritDoc} */
protected void populateRequiredData() {
    super.populateRequiredData();

    AttributeStatement attributeStatement = (AttributeStatement) target;
 
    QName qname = new QName(SAMLConstants.SAML1_NS, Attribute.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
    attributeStatement.getAttributes().add((Attribute)buildXMLObject(qname));
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:10,代码来源:AttributeStatementSchemaTest.java

示例7: setupRequiredData

import org.opensaml.saml1.core.AttributeStatement; //导入依赖的package包/类
/**
 * Common setup method (populateRequiredData & the first test
 */
private void setupRequiredData() {
    
    Assertion assertion = (Assertion) target;
    assertion.setIssuer("Issuer");
    assertion.setID("ident");
    assertion.setIssueInstant(new DateTime());
    QName name = new QName(SAMLConstants.SAML1_NS, AttributeStatement.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
    assertion.getStatements().add((AttributeStatement)buildXMLObject(name));
    
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:14,代码来源:AssertionSchemaTest.java

示例8: populateRequiredData

import org.opensaml.saml1.core.AttributeStatement; //导入依赖的package包/类
/** {@inheritDoc} */
protected void populateRequiredData() {
    super.populateRequiredData();
    Assertion assertion = (Assertion) target;
    assertion.setIssuer("Issuer");
    assertion.setID("ident");
    assertion.setIssueInstant(new DateTime());
    QName name = new QName(SAMLConstants.SAML1_NS, AttributeStatement.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
    assertion.getStatements().add((AttributeStatement)buildXMLObject(name));
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:11,代码来源:AssertionSpecTest.java

示例9: testDOMIDResolutionMarshall

import org.opensaml.saml1.core.AttributeStatement; //导入依赖的package包/类
public void testDOMIDResolutionMarshall() throws MarshallingException {
    Assertion assertion = (Assertion) buildXMLObject(Assertion.DEFAULT_ELEMENT_NAME);
    assertion.setID(expectedID);
    assertion.getAttributeStatements().add((AttributeStatement) buildXMLObject(AttributeStatement.DEFAULT_ELEMENT_NAME));
    
    marshallerFactory.getMarshaller(assertion).marshall(assertion);
    
    Document document = assertion.getStatements().get(0).getDOM().getOwnerDocument();
    Element idElem = assertion.getDOM();
    
    assertNotNull("DOM ID resolution returned null", document.getElementById(expectedID));
    assertTrue("DOM elements were not equal", idElem.isSameNode(document.getElementById(expectedID)));
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:14,代码来源:AssertionTest.java

示例10: RespondWithTest

import org.opensaml.saml1.core.AttributeStatement; //导入依赖的package包/类
/**
 * Constructor.
 *
 */
public RespondWithTest() {
    super();
    singleElementFile = "/data/org/opensaml/saml1/impl/RespondWith.xml";
    
    expectedQName = AttributeStatement.DEFAULT_ELEMENT_NAME;
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:11,代码来源:RespondWithTest.java

示例11: AttributeStatementTest

import org.opensaml.saml1.core.AttributeStatement; //导入依赖的package包/类
/**
 * Constructor
 */
public AttributeStatementTest() {
    super();
    singleElementFile = "/data/org/opensaml/saml1/impl/singleAttributeStatement.xml";
    childElementsFile = "/data/org/opensaml/saml1/impl/AttributeStatementWithChildren.xml";
    qname = new QName(SAMLConstants.SAML1_NS, AttributeStatement.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:10,代码来源:AttributeStatementTest.java

示例12: testSingleElementUnmarshall

import org.opensaml.saml1.core.AttributeStatement; //导入依赖的package包/类
/** {@inheritDoc} */

    public void testSingleElementUnmarshall() {
        AttributeStatement attributeStatement = (AttributeStatement) unmarshallElement(singleElementFile);

        assertNull("<Subject> element present", attributeStatement.getSubject());
        assertEquals("Non zero count of <Attribute> elements", 0, attributeStatement.getAttributes().size());
    }
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:9,代码来源:AttributeStatementTest.java

示例13: getAttributeStatements

import org.opensaml.saml1.core.AttributeStatement; //导入依赖的package包/类
/** {@inheritDoc} */
public List<AttributeStatement> getAttributeStatements() {
    QName statementQName = new QName(SAMLConstants.SAML1_NS, AttributeStatement.DEFAULT_ELEMENT_LOCAL_NAME);
    return (List<AttributeStatement>) statements.subList(statementQName);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:AssertionImpl.java

示例14: buildObject

import org.opensaml.saml1.core.AttributeStatement; //导入依赖的package包/类
/** {@inheritDoc} */
public AttributeStatement buildObject() {
    return buildObject(SAMLConstants.SAML1_NS, AttributeStatement.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:AttributeStatementBuilder.java

示例15: createStatement

import org.opensaml.saml1.core.AttributeStatement; //导入依赖的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


注:本文中的org.opensaml.saml1.core.AttributeStatement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。