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


Java SubjectConfirmationData类代码示例

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


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

示例1: processChildElement

import org.opensaml.saml2.core.SubjectConfirmationData; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException {
    SubjectConfirmation subjectConfirmation = (SubjectConfirmation) parentObject;

    if (childObject instanceof BaseID) {
        subjectConfirmation.setBaseID((BaseID) childObject);
    } else if (childObject instanceof NameID) {
        subjectConfirmation.setNameID((NameID) childObject);
    } else if (childObject instanceof EncryptedID) {
        subjectConfirmation.setEncryptedID((EncryptedID) childObject);
    } else if (childObject instanceof SubjectConfirmationData) {
        subjectConfirmation.setSubjectConfirmationData((SubjectConfirmationData) childObject);
    } else {
        super.processChildElement(parentObject, childObject);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:SubjectConfirmationUnmarshaller.java

示例2: processAttribute

import org.opensaml.saml2.core.SubjectConfirmationData; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
    SubjectConfirmationData subjectCD = (SubjectConfirmationData) samlObject;

    if (attribute.getLocalName().equals(SubjectConfirmationData.NOT_BEFORE_ATTRIB_NAME)
            && !DatatypeHelper.isEmpty(attribute.getValue())) {
        subjectCD.setNotBefore(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
    } else if (attribute.getLocalName().equals(SubjectConfirmationData.NOT_ON_OR_AFTER_ATTRIB_NAME)
            && !DatatypeHelper.isEmpty(attribute.getValue())) {
        subjectCD.setNotOnOrAfter(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
    } else if (attribute.getLocalName().equals(SubjectConfirmationData.RECIPIENT_ATTRIB_NAME)) {
        subjectCD.setRecipient(attribute.getValue());
    } else if (attribute.getLocalName().equals(SubjectConfirmationData.IN_RESPONSE_TO_ATTRIB_NAME)) {
        subjectCD.setInResponseTo(attribute.getValue());
    } else if (attribute.getLocalName().equals(SubjectConfirmationData.ADDRESS_ATTRIB_NAME)) {
        subjectCD.setAddress(attribute.getValue());
    } else {
        QName attribQName = XMLHelper.getNodeQName(attribute);
        if (attribute.isId()) {
            subjectCD.getUnknownAttributes().registerID(attribQName);
        }
        subjectCD.getUnknownAttributes().put(attribQName, attribute.getValue());
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:SubjectConfirmationDataUnmarshaller.java

示例3: checkRecipient

import org.opensaml.saml2.core.SubjectConfirmationData; //导入依赖的package包/类
/**
 * Check whether an assertion contains an assertionConsumerURL
 * within a subjectConfirmationData having the
 * subjectConfirmationMethod=urn:oasis:names:tc:SAML:2.0:cm:bearer
 * 
 * @return <code>true</code>, if the assertion contains the
 *         assertionConsumerURL. <code>false</code>
 *         otherwise.
 */
public boolean checkRecipient(String assertionConsumerURL) {
	if (assertionConsumerURL == null) return false;
	if (assertion.getSubject() == null) return false;
	if (assertion.getSubject().getSubjectConfirmations() == null) return false;
	
	
	for (SubjectConfirmation subjectConfirmation : assertion.getSubject().getSubjectConfirmations()) {
		if (!OIOSAMLConstants.METHOD_BEARER.equals(subjectConfirmation.getMethod())) continue;

		SubjectConfirmationData subjectConfirmationData = subjectConfirmation.getSubjectConfirmationData();
		if (subjectConfirmationData == null) continue;
		
		if (assertionConsumerURL.equals(subjectConfirmationData.getRecipient())) {
			return true;
		}
	}
	return false;
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:28,代码来源:OIOAssertion.java

示例4: testSingleElementOptionalAttributesUnmarshall

import org.opensaml.saml2.core.SubjectConfirmationData; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementOptionalAttributesUnmarshall() {
    SubjectConfirmationData subjectCD = (SubjectConfirmationData) unmarshallElement(singleElementOptionalAttributesFile);

    DateTime notBefore = subjectCD.getNotBefore();
    assertEquals("NotBefore was " + notBefore + ", expected " + expectedNotBefore, expectedNotBefore, notBefore);

    DateTime notOnOrAfter = subjectCD.getNotOnOrAfter();
    assertEquals("NotOnOrAfter was " + notOnOrAfter + ", expected " + expectedNotOnOrAfter, expectedNotOnOrAfter,
            notOnOrAfter);

    String recipient = subjectCD.getRecipient();
    assertEquals("Recipient was " + recipient + ", expected " + expectedRecipient, expectedRecipient, recipient);

    String inResponseTo = subjectCD.getInResponseTo();
    assertEquals("InResponseTo was " + inResponseTo + ", expected " + expectedInResponseTo, expectedInResponseTo,
            inResponseTo);

    String address = subjectCD.getAddress();
    assertEquals("Address was " + address + ", expected " + expectedAddress, expectedAddress, address);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:22,代码来源:SubjectConfirmationDataTest.java

示例5: getSAMLBuilder

import org.opensaml.saml2.core.SubjectConfirmationData; //导入依赖的package包/类
private static XMLObjectBuilderFactory getSAMLBuilder() throws ConfigurationException {

	if (builderFactory == null) {
	    // OpenSAML 2.3
	    DefaultBootstrap.bootstrap();
	    builderFactory = Configuration.getBuilderFactory();
	    nameIdBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(NameID.DEFAULT_ELEMENT_NAME);
	    confirmationMethodBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(SubjectConfirmationData.DEFAULT_ELEMENT_NAME);
	    subjectConfirmationBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(SubjectConfirmation.DEFAULT_ELEMENT_NAME);
	    subjectBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(Subject.DEFAULT_ELEMENT_NAME);
	    attrStatementBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AttributeStatement.DEFAULT_ELEMENT_NAME);
	    audienceRestrictionnBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AudienceRestriction.DEFAULT_ELEMENT_NAME);
	    audienceBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(Audience.DEFAULT_ELEMENT_NAME);
	    authStatementBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AuthnStatement.DEFAULT_ELEMENT_NAME);
	    authContextBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AuthnContext.DEFAULT_ELEMENT_NAME);
	    authContextClassRefBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AuthnContextClassRef.DEFAULT_ELEMENT_NAME);
	    issuerBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(Issuer.DEFAULT_ELEMENT_NAME);
	    assertionBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(Assertion.DEFAULT_ELEMENT_NAME);

	}

	return builderFactory;
    }
 
开发者ID:mwdb,项目名称:OA2C,代码行数:24,代码来源:LocalSamlTokenFactory.java

示例6: processChildElement

import org.opensaml.saml2.core.SubjectConfirmationData; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException {
    SubjectConfirmation sc = (SubjectConfirmation) parentObject;

    if (childObject instanceof SubjectConfirmationData) {
        sc.setSubjectConfirmationData((SubjectConfirmationData) childObject);
    } else {
        super.processChildElement(parentObject, childObject);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:SubjectConfirmationUnmarshaller.java

示例7: marshallAttributes

import org.opensaml.saml2.core.SubjectConfirmationData; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
    SubjectConfirmationData subjectCD = (SubjectConfirmationData) samlObject;

    if (subjectCD.getNotBefore() != null) {
        String notBeforeStr = Configuration.getSAMLDateFormatter().print(subjectCD.getNotBefore());
        domElement.setAttributeNS(null, SubjectConfirmationData.NOT_BEFORE_ATTRIB_NAME, notBeforeStr);
    }

    if (subjectCD.getNotOnOrAfter() != null) {
        String notOnOrAfterStr = Configuration.getSAMLDateFormatter().print(subjectCD.getNotOnOrAfter());
        domElement.setAttributeNS(null, SubjectConfirmationData.NOT_ON_OR_AFTER_ATTRIB_NAME, notOnOrAfterStr);
    }

    if (subjectCD.getRecipient() != null) {
        domElement.setAttributeNS(null, SubjectConfirmationData.RECIPIENT_ATTRIB_NAME, subjectCD.getRecipient());
    }

    if (subjectCD.getInResponseTo() != null) {
        domElement.setAttributeNS(null, SubjectConfirmationData.IN_RESPONSE_TO_ATTRIB_NAME, subjectCD
                .getInResponseTo());
    }

    if (subjectCD.getAddress() != null) {
        domElement.setAttributeNS(null, SubjectConfirmationData.ADDRESS_ATTRIB_NAME, subjectCD.getAddress());
    }

    Attr attribute;
    for (Entry<QName, String> entry : subjectCD.getUnknownAttributes().entrySet()) {
        attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey());
        attribute.setValue(entry.getValue());
        domElement.setAttributeNodeNS(attribute);
        if (Configuration.isIDAttribute(entry.getKey())
                || subjectCD.getUnknownAttributes().isIDAttribute(entry.getKey())) {
            attribute.getOwnerElement().setIdAttributeNode(attribute, true);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:39,代码来源:SubjectConfirmationDataMarshaller.java

示例8: processChildElement

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

    subjectCD.getUnknownXMLObjects().add(childSAMLObject);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:SubjectConfirmationDataUnmarshaller.java

示例9: getConfirmationTime

import org.opensaml.saml2.core.SubjectConfirmationData; //导入依赖的package包/类
public DateTime getConfirmationTime() {
	if (assertion.getSubject() == null) return null;
	if (assertion.getSubject().getSubjectConfirmations() == null || 
			assertion.getSubject().getSubjectConfirmations().isEmpty()) return null;

	for (SubjectConfirmation subjectConfirmation : assertion.getSubject().getSubjectConfirmations()) {
		SubjectConfirmationData data = subjectConfirmation.getSubjectConfirmationData();

		if (data != null && data.getNotOnOrAfter() != null) {
			return data.getNotOnOrAfter();
		}
	}
	return null;
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:15,代码来源:OIOAssertion.java

示例10: createSubject

import org.opensaml.saml2.core.SubjectConfirmationData; //导入依赖的package包/类
/**
 * Create a subject with a given nameID value.
 * 
 * The subject is given a confirmation with method bearer.
 * 
 * @param nameIDValue
 *            The value of the nameID
 * @return The SAML subject with the given nameId
 */
public static Subject createSubject(String nameIDValue,
		String recipient, DateTime notOnOrAfter) {
	Subject subject = buildXMLObject(Subject.class);
	subject.setNameID(createNameID(nameIDValue));
	SubjectConfirmation subjectConfirmation = buildXMLObject(SubjectConfirmation.class);
	subjectConfirmation.setMethod(OIOSAMLConstants.METHOD_BEARER);
	SubjectConfirmationData subjectConfirmationData = buildXMLObject(SubjectConfirmationData.class);
	subjectConfirmationData.setRecipient(recipient);
	subjectConfirmationData.setNotOnOrAfter(notOnOrAfter);
	subjectConfirmation.setSubjectConfirmationData(subjectConfirmationData);
	subject.getSubjectConfirmations().add(subjectConfirmation);
	return subject;
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:23,代码来源:SAMLUtil.java

示例11: checkRecipient

import org.opensaml.saml2.core.SubjectConfirmationData; //导入依赖的package包/类
@Test
public void checkRecipient() {
	String requiredMethodBearer = "urn:oasis:names:tc:SAML:2.0:cm:bearer";

	assertFalse(assertion.checkRecipient(null));
	assertFalse(new OIOAssertion(new AssertionStubImpl()).checkRecipient(""));

	Assertion localAssertion = new AssertionStubImpl();
	localAssertion.setSubject(new SubjectStubImpl());

	assertFalse(assertion.checkRecipient(""));


	SubjectConfirmation subjectConfirmation = new SubjectConfirmationStubImpl();
	subjectConfirmation.setMethod(requiredMethodBearer);

	SubjectConfirmationData subConfData = new SubjectConfirmationDataStubImpl();
	String expectedRecipient = "recipient";
	subConfData.setRecipient(expectedRecipient);
	subjectConfirmation.setSubjectConfirmationData(subConfData);

	Subject subject = new SubjectStubImpl(Collections.singletonList(subjectConfirmation));
	localAssertion.setSubject(subject);
	OIOAssertion la = new OIOAssertion(localAssertion);

	assertTrue(la.checkRecipient(expectedRecipient));

	subConfData.setRecipient("something else");
	assertFalse(la.checkRecipient(expectedRecipient));

	subjectConfirmation.setMethod("not requiredBearer");
	assertFalse(la.checkRecipient(expectedRecipient));

	assertTrue(assertion.checkRecipient(assertionConsumerURL));
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:36,代码来源:OIOAssertionTest.java

示例12: testChildElementsMarshall

import org.opensaml.saml2.core.SubjectConfirmationData; //导入依赖的package包/类
/** {@inheritDoc} */
public void testChildElementsMarshall() {
    QName qname = new QName(SAMLConstants.SAML20_NS, SubjectConfirmation.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
    SubjectConfirmation subjectConfirmation = (SubjectConfirmation) buildXMLObject(qname);

    QName nameIDQName = new QName(SAMLConstants.SAML20_NS, NameID.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
    subjectConfirmation.setNameID((NameID) buildXMLObject(nameIDQName));
    
    QName subjectConfirmationDataQName = new QName(SAMLConstants.SAML20_NS, SubjectConfirmationData.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
    subjectConfirmation.setSubjectConfirmationData((SubjectConfirmationData) buildXMLObject(subjectConfirmationDataQName));

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

示例13: testChildElementsWithEncryptedIDMarshall

import org.opensaml.saml2.core.SubjectConfirmationData; //导入依赖的package包/类
/** {@inheritDoc} 
 * @throws XMLParserException */
public void testChildElementsWithEncryptedIDMarshall() throws XMLParserException {
    QName qname = new QName(SAMLConstants.SAML20_NS, SubjectConfirmation.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
    SubjectConfirmation subjectConfirmation = (SubjectConfirmation) buildXMLObject(qname);

    QName encryptedIDQName = new QName(SAMLConstants.SAML20_NS, EncryptedID.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
    subjectConfirmation.setEncryptedID((EncryptedID) buildXMLObject(encryptedIDQName));
    
    QName subjectConfirmationDataQName = new QName(SAMLConstants.SAML20_NS, SubjectConfirmationData.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
    subjectConfirmation.setSubjectConfirmationData((SubjectConfirmationData) buildXMLObject(subjectConfirmationDataQName));
    
    Document expectedChildElementsWithEncryptedID = parser.parse(SubjectConfirmationTest.class
            .getResourceAsStream(childElementsWithEncryptedIDFile));
    assertEquals(expectedChildElementsWithEncryptedID, subjectConfirmation);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:17,代码来源:SubjectConfirmationTest.java

示例14: testSingleElementUnmarshall

import org.opensaml.saml2.core.SubjectConfirmationData; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementUnmarshall() {
    SubjectConfirmationData subjectCD = (SubjectConfirmationData) unmarshallElement(singleElementFile);

    DateTime notBefore = subjectCD.getNotBefore();
    assertEquals("NotBefore was " + notBefore + ", expected " + expectedNotBefore, expectedNotBefore, notBefore);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:8,代码来源:SubjectConfirmationDataTest.java

示例15: testSingleElementMarshall

import org.opensaml.saml2.core.SubjectConfirmationData; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementMarshall() {
    QName qname = new QName(SAMLConstants.SAML20_NS, SubjectConfirmationData.DEFAULT_ELEMENT_LOCAL_NAME,
            SAMLConstants.SAML20_PREFIX);
    SubjectConfirmationData subjectCD = (SubjectConfirmationData) buildXMLObject(qname);

    subjectCD.setNotBefore(expectedNotBefore);
    assertEquals(expectedDOM, subjectCD);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:10,代码来源:SubjectConfirmationDataTest.java


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