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


Java Assertion.setSignature方法代码示例

本文整理汇总了Java中org.opensaml.saml2.core.Assertion.setSignature方法的典型用法代码示例。如果您正苦于以下问题:Java Assertion.setSignature方法的具体用法?Java Assertion.setSignature怎么用?Java Assertion.setSignature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opensaml.saml2.core.Assertion的用法示例。


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

示例1: processChildElement

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

    if (childObject instanceof Issuer) {
        assertion.setIssuer((Issuer) childObject);
    } else if (childObject instanceof Signature) {
        assertion.setSignature((Signature) childObject);
    } else if (childObject instanceof Subject) {
        assertion.setSubject((Subject) childObject);
    } else if (childObject instanceof Conditions) {
        assertion.setConditions((Conditions) childObject);
    } else if (childObject instanceof Advice) {
        assertion.setAdvice((Advice) childObject);
    } else if (childObject instanceof Statement) {
        assertion.getStatements().add((Statement) childObject);
    } else {
        super.processChildElement(parentObject, childObject);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:AssertionUnmarshaller.java

示例2: setUpTest

import org.opensaml.saml2.core.Assertion; //导入方法依赖的package包/类
@Before
public final void setUpTest() throws Exception {
	credential = credentialRepository.getCredential(getProperty("wsc.certificate"), getProperty("wsc.certificate.password"));
	assertion = (Assertion)SAMLUtil.unmarshallElement(getClass().getResourceAsStream("assertion.xml"));
	epr = SAMLUtil.buildXMLObject(EndpointReference.class);
	
	Address address = SAMLUtil.buildXMLObject(Address.class);
	address.setValue(getProperty("sts"));
	epr.setAddress(address);
	
	Metadata md = SAMLUtil.buildXMLObject(Metadata.class);
	epr.setMetadata(md);

	SecurityContext ctx = SAMLUtil.buildXMLObject(SecurityContext.class);
	md.getUnknownXMLObjects().add(ctx);

	assertion.getSubject().getSubjectConfirmations().get(0).getSubjectConfirmationData().setNotOnOrAfter(new DateTime().plusMinutes(5));
	assertion.getConditions().setNotOnOrAfter(new DateTime().plusMinutes(5));
	assertion.getConditions().getAudienceRestrictions().get(0).getAudiences().get(0).setAudienceURI("tri-test1.trifork.com");
	assertion.setSignature(null);
	new OIOAssertion(assertion).sign(credential);
	
	Token token = new Token();
	token.setUsage("urn:liberty:security:tokenusage:2006-08:SecurityToken");
	ctx.getTokens().add(token);
	token.setAssertion(assertion);

	stsCredential = credentialRepository.getCredential(getProperty("sts.certificate"), getProperty("sts.certificate.password"));
	client = new TrustClient(epr, credential, stsCredential.getPublicKey());
	client.setAppliesTo(getProperty("endpoint"));
	client.setUseReferenceForDelegateToken(false);
	client.setUseActAs(true);
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:34,代码来源:AbstractTests.java

示例3: setUp

import org.opensaml.saml2.core.Assertion; //导入方法依赖的package包/类
@Before
public void setUp() throws UnmarshallingException, CertificateEncodingException, InvalidKeyException, NoSuchAlgorithmException, NoSuchProviderException, SignatureException {
	credential = TestHelper.getCredential();
	assertion = (Assertion)SAMLUtil.unmarshallElement(getClass().getResourceAsStream("assertion.xml"));
	epr = SAMLUtil.buildXMLObject(EndpointReference.class);
	
	Address address = SAMLUtil.buildXMLObject(Address.class);
	address.setValue(ADDRESS);
	epr.setAddress(address);
	
	Metadata md = SAMLUtil.buildXMLObject(Metadata.class);
	epr.setMetadata(md);

	SecurityContext ctx = SAMLUtil.buildXMLObject(SecurityContext.class);
	md.getUnknownXMLObjects().add(ctx);

	assertion.getSubject().getSubjectConfirmations().get(0).getSubjectConfirmationData().setNotOnOrAfter(new DateTime().plusMinutes(5));
	assertion.getConditions().setNotOnOrAfter(new DateTime().plusMinutes(5));
	assertion.getConditions().getAudienceRestrictions().get(0).getAudiences().get(0).setAudienceURI("tri-test1.trifork.com");
	assertion.setSignature(null);
	new OIOAssertion(assertion).sign(credential);
	
	Token token = new Token();
	token.setUsage("urn:liberty:security:tokenusage:2006-08:SecurityToken");
	ctx.getTokens().add(token);
	token.setAssertion(assertion);
	
	stsCredential = TestHelper.getCredential();
	client = new TrustClient(epr, credential, stsCredential.getPublicKey());
	soapClient = context.mock(SOAPClient.class);
	client.setSOAPClient(soapClient);
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:33,代码来源:TokenClientTest.java

示例4: testVerifySignature

import org.opensaml.saml2.core.Assertion; //导入方法依赖的package包/类
@Test
public void testVerifySignature() throws Exception {
	Assertion a = (Assertion) SAMLUtil.unmarshallElementFromString("<saml:Assertion Version=\"2.0\" xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\"></saml:Assertion>");
	
	Credential cred = TestHelper.getCredential();
	
	assertFalse(new OIOSamlObject(a).verifySignature(cred.getPublicKey()));
	
	Signature signature = SAMLUtil.createSignature("test");
	signature.setSigningCredential(cred);
	signature.setSignatureAlgorithm(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1);
	signature.setCanonicalizationAlgorithm(SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
	a.setSignature(signature);

	Configuration.getMarshallerFactory().getMarshaller(a).marshall(a);
	Signer.signObject(signature);
	
	assertTrue(new OIOSamlObject(a).verifySignature(cred.getPublicKey()));

	Credential cred2 = TestHelper.getCredential();
	assertFalse(new OIOSamlObject(a).verifySignature(cred2.getPublicKey()));
	
	
	a.setSubject(SAMLUtil.createSubject("test", "test", new DateTime()));
	Configuration.getMarshallerFactory().getMarshaller(a).marshall(a);

	assertFalse(new OIOSamlObject(a).verifySignature(cred.getPublicKey()));
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:29,代码来源:OIOSamlObjectTest.java


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