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


Java IDPSSODescriptor.addSupportedProtocol方法代码示例

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


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

示例1: buildIDPSSODescriptor

import org.opensaml.saml2.metadata.IDPSSODescriptor; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private IDPSSODescriptor buildIDPSSODescriptor(final SAMLConfig configuration) {
       SAMLObjectBuilder<IDPSSODescriptor> builder = (SAMLObjectBuilder<IDPSSODescriptor>) builderFactory.getBuilder(IDPSSODescriptor.DEFAULT_ELEMENT_NAME);
       IDPSSODescriptor idpDescriptor = builder.buildObject();
       idpDescriptor.setWantAuthnRequestsSigned(false);
       idpDescriptor.addSupportedProtocol(SAMLConstants.SAML20P_NS);

       idpDescriptor.getSingleSignOnServices().add(getSingleSignOnService(configuration, SAMLConstants.SAML2_REDIRECT_BINDING_URI));
       idpDescriptor.getSingleLogoutServices().add(getSingleLogoutService(configuration, SAMLConstants.SAML2_REDIRECT_BINDING_URI));

       return idpDescriptor;

   }
 
开发者ID:italia,项目名称:spid-spring,代码行数:14,代码来源:IdpMetadataGenerator.java

示例2: testSingleElementMarshall

import org.opensaml.saml2.metadata.IDPSSODescriptor; //导入方法依赖的package包/类
public void testSingleElementMarshall() {
    QName qname = new QName(SAMLConstants.SAML20MD_NS, IDPSSODescriptor.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20MD_PREFIX);
    IDPSSODescriptor descriptor = (IDPSSODescriptor) buildXMLObject(qname);

    for (String protocol : expectedSupportedProtocol) {
        descriptor.addSupportedProtocol(protocol);
    }
    descriptor.setWantAuthnRequestsSigned(expectedWantAuthnReqSigned);

    assertEquals(expectedDOM, descriptor);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:12,代码来源:IDPSSODescriptorTest.java

示例3: testSingleElementOptionalAttributesMarshall

import org.opensaml.saml2.metadata.IDPSSODescriptor; //导入方法依赖的package包/类
public void testSingleElementOptionalAttributesMarshall() {
    QName qname = new QName(SAMLConstants.SAML20MD_NS, IDPSSODescriptor.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20MD_PREFIX);
    IDPSSODescriptor descriptor = (IDPSSODescriptor) buildXMLObject(qname);

    for (String protocol : expectedSupportedProtocol) {
        descriptor.addSupportedProtocol(protocol);
    }

    descriptor.setCacheDuration(expectedCacheDuration);
    descriptor.setValidUntil(expectedValidUntil);
    descriptor.setErrorURL(expectedErrorURL);
    descriptor.setWantAuthnRequestsSigned(expectedWantAuthnReqSigned);

    assertEquals(expectedOptionalAttributesDOM, descriptor);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:16,代码来源:IDPSSODescriptorTest.java

示例4: generateIdPDescriptor

import org.opensaml.saml2.metadata.IDPSSODescriptor; //导入方法依赖的package包/类
private EntityDescriptor generateIdPDescriptor(String stsEntityId, String stsLocation, String stsLogoutLocation, byte[] stsKeystore) {
	EntityDescriptor descriptor = SAMLUtil.buildXMLObject(EntityDescriptor.class);
	descriptor.setEntityID(stsEntityId);

	IDPSSODescriptor desc = SAMLUtil.buildXMLObject(IDPSSODescriptor.class);
	desc.addSupportedProtocol("http://schemas.xmlsoap.org/ws/2006/12/federation");
	
	KeyDescriptor signingDescriptor = SAMLUtil.buildXMLObject(KeyDescriptor.class);
	signingDescriptor.setUse(UsageType.SIGNING);
	KeyDescriptor encryptionDescriptor = SAMLUtil.buildXMLObject(KeyDescriptor.class);
	encryptionDescriptor.setUse(UsageType.ENCRYPTION);

	try {
		CertificateFactory cf = CertificateFactory.getInstance("X.509");
		X509Certificate cert = (X509Certificate) cf.generateCertificate(new ByteArrayInputStream(stsKeystore));
		BasicX509Credential credential = new BasicX509Credential();
		credential.setEntityCertificate(cert);
		
		KeyInfoGenerator gen = SecurityHelper.getKeyInfoGenerator(credential, org.opensaml.xml.Configuration.getGlobalSecurityConfiguration(), null);
		signingDescriptor.setKeyInfo(gen.generate(credential));
		encryptionDescriptor.setKeyInfo(gen.generate(credential));
	} catch (SecurityException e1) {
		throw new WrappedException(Layer.BUSINESS, e1);
	} catch (CertificateException e) {
		throw new WrappedException(Layer.BUSINESS, e);
	}
	desc.getKeyDescriptors().add(signingDescriptor);
	desc.getKeyDescriptors().add(encryptionDescriptor);
	
	SingleSignOnService sso = SAMLUtil.buildXMLObject(SingleSignOnService.class);
	sso.setBinding("http://schemas.xmlsoap.org/ws/2006/12/federation");
	sso.setLocation(stsLocation);
	desc.getSingleSignOnServices().add(sso);

	//TODO: Check that the location should be the same
	SingleLogoutService slo = SAMLUtil.buildXMLObject(SingleLogoutService.class);
	slo.setBinding("http://schemas.xmlsoap.org/ws/2006/12/federation");
	slo.setLocation(stsLogoutLocation);
	desc.getSingleLogoutServices().add(slo);
	
	descriptor.getRoleDescriptors().add(desc);
	return descriptor;
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:44,代码来源:ConfigurationHandler.java


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