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


Java SPSSODescriptor.setWantAssertionsSigned方法代码示例

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


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

示例1: testSingleElementOptionalAttributesMarshall

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

    descriptor.setAuthnRequestsSigned(expectedAuthnRequestSigned);
    descriptor.setWantAssertionsSigned(expectedWantAssertionsSigned);

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

    descriptor.setCacheDuration(expectedCacheDuration);
    descriptor.setValidUntil(expectedValidUntil);

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

示例2: processAttribute

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

    if (attribute.getLocalName().equals(SPSSODescriptor.AUTH_REQUESTS_SIGNED_ATTRIB_NAME)) {
        descriptor.setAuthnRequestsSigned(XSBooleanValue.valueOf(attribute.getValue()));
    } else if (attribute.getLocalName().equals(SPSSODescriptor.WANT_ASSERTIONS_SIGNED_ATTRIB_NAME)) {
        descriptor.setWantAssertionsSigned(XSBooleanValue.valueOf(attribute.getValue()));
    } else {
        super.processAttribute(samlObject, attribute);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:SPSSODescriptorUnmarshaller.java

示例3: generateSPDescriptor

import org.opensaml.saml2.metadata.SPSSODescriptor; //导入方法依赖的package包/类
protected EntityDescriptor generateSPDescriptor(String baseUrl, Credential credential, List<?> parameters) {
	String url = baseUrl + "/WSFedConsumer";
	
	EntityDescriptor descriptor = SAMLUtil.buildXMLObject(EntityDescriptor.class);
	descriptor.setEntityID(url);
	
	SPSSODescriptor spDescriptor = SAMLUtil.buildXMLObject(SPSSODescriptor.class);
	spDescriptor.setAuthnRequestsSigned(true);
	spDescriptor.setWantAssertionsSigned(true);
	
	KeyDescriptor signingDescriptor = SAMLUtil.buildXMLObject(KeyDescriptor.class);
	signingDescriptor.setUse(UsageType.SIGNING);
	KeyDescriptor encryptionDescriptor = SAMLUtil.buildXMLObject(KeyDescriptor.class);
	encryptionDescriptor.setUse(UsageType.ENCRYPTION);

	try {
		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);
	}
	spDescriptor.getKeyDescriptors().add(signingDescriptor);
	spDescriptor.getKeyDescriptors().add(encryptionDescriptor);
	
	spDescriptor.addSupportedProtocol("http://schemas.xmlsoap.org/ws/2006/12/federation");
	spDescriptor.getAssertionConsumerServices().add(SAMLUtil.createAssertionConsumerService(url, "http://schemas.xmlsoap.org/ws/2006/12/federation", 0, true));
	
	spDescriptor.getSingleLogoutServices().add(SAMLUtil.createSingleLogoutService(url, url, "http://schemas.xmlsoap.org/ws/2006/12/federation"));
	
	
	descriptor.getRoleDescriptors().add(spDescriptor);
	return descriptor;
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:35,代码来源:ConfigurationHandler.java

示例4: generateSPDescriptor

import org.opensaml.saml2.metadata.SPSSODescriptor; //导入方法依赖的package包/类
protected EntityDescriptor generateSPDescriptor(String baseUrl, String entityId, Credential credential, String orgName, String orgUrl, String email, boolean enableArtifact, boolean enableRedirect, boolean enableSoap, boolean enablePostSLO, boolean supportOCESAttributes) {
	EntityDescriptor descriptor = SAMLUtil.buildXMLObject(EntityDescriptor.class);
	descriptor.setEntityID(entityId);
	
	SPSSODescriptor spDescriptor = SAMLUtil.buildXMLObject(SPSSODescriptor.class);
	spDescriptor.setAuthnRequestsSigned(true);
	spDescriptor.setWantAssertionsSigned(true);
	
	ContactPerson contact = SAMLUtil.buildXMLObject(ContactPerson.class);
	contact.getEmailAddresses().add(SAMLUtil.createEmail(email));
	contact.setCompany(SAMLUtil.createCompany(orgName));
	contact.setType(ContactPersonTypeEnumeration.TECHNICAL);
	
	descriptor.getContactPersons().add(contact);
	descriptor.setOrganization(SAMLUtil.createOrganization(orgName, orgName, orgUrl));
	
	KeyDescriptor signingDescriptor = SAMLUtil.buildXMLObject(KeyDescriptor.class);
	signingDescriptor.setUse(UsageType.SIGNING);
	KeyDescriptor encryptionDescriptor = SAMLUtil.buildXMLObject(KeyDescriptor.class);
	encryptionDescriptor.setUse(UsageType.ENCRYPTION);

	try {
		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);
	}
	spDescriptor.getKeyDescriptors().add(signingDescriptor);
	spDescriptor.getKeyDescriptors().add(encryptionDescriptor);
	
	spDescriptor.addSupportedProtocol(SAMLConstants.SAML20P_NS);
	spDescriptor.getAssertionConsumerServices().add(SAMLUtil.createAssertionConsumerService(baseUrl + "/SAMLAssertionConsumer", SAMLConstants.SAML2_POST_BINDING_URI, 0, true));
	if (enableArtifact) {
		spDescriptor.getAssertionConsumerServices().add(SAMLUtil.createAssertionConsumerService(baseUrl + "/SAMLAssertionConsumer", SAMLConstants.SAML2_ARTIFACT_BINDING_URI, 1, false));
	}
	if (enableRedirect) {
		spDescriptor.getAssertionConsumerServices().add(SAMLUtil.createAssertionConsumerService(baseUrl + "/SAMLAssertionConsumer", SAMLConstants.SAML2_REDIRECT_BINDING_URI, 2, false));
	}
	
	spDescriptor.getSingleLogoutServices().add(SAMLUtil.createSingleLogoutService(baseUrl + "/LogoutServiceHTTPRedirect", baseUrl + "/LogoutServiceHTTPRedirectResponse", SAMLConstants.SAML2_REDIRECT_BINDING_URI));
	
	if (enableSoap) {
		spDescriptor.getSingleLogoutServices().add(SAMLUtil.createSingleLogoutService(baseUrl + "/LogoutServiceSOAP", null, SAMLConstants.SAML2_SOAP11_BINDING_URI));
	}
	
	if(enablePostSLO) {
           spDescriptor.getSingleLogoutServices().add(SAMLUtil.createSingleLogoutService(baseUrl + "/LogoutServiceHTTPPost", baseUrl + "/LogoutServiceHTTPRedirectResponse", SAMLConstants.SAML2_POST_BINDING_URI));
	}
	
       NameIDFormat x509SubjectNameIDFormat = SAMLUtil.createNameIDFormat(OIOSAMLConstants.NAMEIDFORMAT_X509SUBJECTNAME);
       List<NameIDFormat> nameIDFormats = spDescriptor.getNameIDFormats();
       nameIDFormats.add(x509SubjectNameIDFormat);

       if (enableArtifact) {
		spDescriptor.getArtifactResolutionServices().add(SAMLUtil.createArtifactResolutionService(baseUrl + "/SAMLAssertionConsumer"));
	}
	
	if (supportOCESAttributes) {
		addAttributeConsumerService(spDescriptor, entityId);
	}
	
	descriptor.getRoleDescriptors().add(spDescriptor);
	return descriptor;
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:66,代码来源:ConfigurationHandler.java

示例5: testXSBooleanAttributes

import org.opensaml.saml2.metadata.SPSSODescriptor; //导入方法依赖的package包/类
/**
 * Test the proper behavior of the XSBooleanValue attributes.
 */
public void testXSBooleanAttributes() {
    SPSSODescriptor descriptor = (SPSSODescriptor) buildXMLObject(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
    
    // AuthnRequestsSigned
    descriptor.setAuthnRequestsSigned(Boolean.TRUE);
    assertEquals("Unexpected value for boolean attribute found", Boolean.TRUE, descriptor.isAuthnRequestsSigned());
    assertNotNull("XSBooleanValue was null", descriptor.isAuthnRequestsSignedXSBoolean());
    assertEquals("XSBooleanValue was unexpected value", new XSBooleanValue(Boolean.TRUE, false),
            descriptor.isAuthnRequestsSignedXSBoolean());
    assertEquals("XSBooleanValue string was unexpected value", "true",
            descriptor.isAuthnRequestsSignedXSBoolean().toString());
    
    descriptor.setAuthnRequestsSigned(Boolean.FALSE);
    assertEquals("Unexpected value for boolean attribute found", Boolean.FALSE, descriptor.isAuthnRequestsSigned());
    assertNotNull("XSBooleanValue was null", descriptor.isAuthnRequestsSignedXSBoolean());
    assertEquals("XSBooleanValue was unexpected value", new XSBooleanValue(Boolean.FALSE, false),
            descriptor.isAuthnRequestsSignedXSBoolean());
    assertEquals("XSBooleanValue string was unexpected value", "false",
            descriptor.isAuthnRequestsSignedXSBoolean().toString());
    
    descriptor.setAuthnRequestsSigned((Boolean) null);
    assertEquals("Unexpected default value for boolean attribute found", Boolean.FALSE, descriptor.isAuthnRequestsSigned());
    assertNull("XSBooleanValue was not null", descriptor.isAuthnRequestsSignedXSBoolean());
    
    
    
    // WantAssertionsSigned
    descriptor.setWantAssertionsSigned(Boolean.TRUE);
    assertEquals("Unexpected value for boolean attribute found", Boolean.TRUE, descriptor.getWantAssertionsSigned());
    assertNotNull("XSBooleanValue was null", descriptor.getWantAssertionsSignedXSBoolean());
    assertEquals("XSBooleanValue was unexpected value", new XSBooleanValue(Boolean.TRUE, false),
            descriptor.getWantAssertionsSignedXSBoolean());
    assertEquals("XSBooleanValue string was unexpected value", "true",
            descriptor.getWantAssertionsSignedXSBoolean().toString());
    
    descriptor.setWantAssertionsSigned(Boolean.FALSE);
    assertEquals("Unexpected value for boolean attribute found", Boolean.FALSE, descriptor.getWantAssertionsSigned());
    assertNotNull("XSBooleanValue was null", descriptor.getWantAssertionsSignedXSBoolean());
    assertEquals("XSBooleanValue was unexpected value", new XSBooleanValue(Boolean.FALSE, false),
            descriptor.getWantAssertionsSignedXSBoolean());
    assertEquals("XSBooleanValue string was unexpected value", "false",
            descriptor.getWantAssertionsSignedXSBoolean().toString());
    
    descriptor.setWantAssertionsSigned((Boolean) null);
    assertEquals("Unexpected default value for boolean attribute found", Boolean.FALSE, descriptor.getWantAssertionsSigned());
    assertNull("XSBooleanValue was not null", descriptor.getWantAssertionsSignedXSBoolean());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:51,代码来源:SPSSODescriptorTest.java


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