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


Java SPSSODescriptor类代码示例

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


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

示例1: marshallAttributes

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

    if (descriptor.isAuthnRequestsSignedXSBoolean() != null) {
        domElement.setAttributeNS(null, SPSSODescriptor.AUTH_REQUESTS_SIGNED_ATTRIB_NAME, descriptor
                .isAuthnRequestsSignedXSBoolean().toString());
    }

    if (descriptor.getWantAssertionsSignedXSBoolean() != null) {
        domElement.setAttributeNS(null, SPSSODescriptor.WANT_ASSERTIONS_SIGNED_ATTRIB_NAME, descriptor
                .getWantAssertionsSignedXSBoolean().toString());
    }

    super.marshallAttributes(samlObject, domElement);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:SPSSODescriptorMarshaller.java

示例2: createSamlMessageContext

import org.opensaml.saml2.metadata.SPSSODescriptor; //导入依赖的package包/类
public SAMLMessageContext createSamlMessageContext(final HttpServletRequest request, final HttpServletResponse response)
		throws ServletException, MetadataProviderException {
	SAMLMessageContext context = messageContextProvider.getLocalAndPeerEntity(request, response);

	SPSSODescriptor spDescriptor = (SPSSODescriptor) context.getLocalEntityRoleMetadata();

	String responseURL = request.getRequestURL().toString();
	spDescriptor.getDefaultAssertionConsumerService().setResponseLocation(responseURL);
	for (AssertionConsumerService service : spDescriptor.getAssertionConsumerServices()) {
		service.setResponseLocation(responseURL);
	}

	spDescriptor.setAuthnRequestsSigned(true);
	context.setCommunicationProfileId(SAMLConstants.SAML2_WEBSSO_PROFILE_URI);

	return context;
}
 
开发者ID:italia,项目名称:spid-spring,代码行数:18,代码来源:SAMLContext.java

示例3: marshallAttributes

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

    if (descriptor.isAuthnRequestsSignedXSBoolean() != null) {
        domElement.setAttributeNS(null, SPSSODescriptor.AUTH_REQUESTS_SIGNED_ATTRIB_NAME,
                descriptor.isAuthnRequestsSignedXSBoolean().toString());
    }

    if (descriptor.getWantAssertionsSignedXSBoolean() != null) {
        domElement.setAttributeNS(null, SPSSODescriptor.WANT_ASSERTIONS_SIGNED_ATTRIB_NAME,
                descriptor.getWantAssertionsSignedXSBoolean().toString());
    }

    super.marshallAttributes(samlObject, domElement);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:17,代码来源:SPSSODescriptorMarshaller.java

示例4: setUp

import org.opensaml.saml2.metadata.SPSSODescriptor; //导入依赖的package包/类
/** {@inheritDoc} */
protected void setUp() throws Exception {
    super.setUp();
    
    // Trust engine setup
    issuer = "SomeCoolIssuer";
    
    trustedCredentials = new ArrayList<Credential>();
    trustedCredentials.add(otherCred1);
    
    credResolver = new CollectionCredentialResolver(trustedCredentials);
    
    KeyInfoCredentialResolver kiResolver = SecurityTestHelper.buildBasicInlineKeyInfoResolver();
    SignatureTrustEngine engine = new ExplicitKeySignatureTrustEngine(credResolver, kiResolver);
    
    rule = new SAML2HTTPRedirectDeflateSignatureRule(engine);
    
    messageContext.setInboundMessageIssuer(issuer);
    ((SAMLMessageContext) messageContext).setInboundSAMLMessageAuthenticated(false);
    messageContext.setPeerEntityRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:22,代码来源:SAML2HTTPRedirectDeflateSignatureSecurityPolicyRuleTest.java

示例5: setUp

import org.opensaml.saml2.metadata.SPSSODescriptor; //导入依赖的package包/类
/** {@inheritDoc} */
protected void setUp() throws Exception {
    super.setUp();
    
    // Trust engine setup
    issuer = "SomeCoolIssuer";
    
    trustedCredentials = new ArrayList<Credential>();
    trustedCredentials.add(otherCred1);
    
    credResolver = new CollectionCredentialResolver(trustedCredentials);
    
    KeyInfoCredentialResolver kiResolver = SecurityTestHelper.buildBasicInlineKeyInfoResolver();
    SignatureTrustEngine engine = new ExplicitKeySignatureTrustEngine(credResolver, kiResolver);
    
    rule = new SAML2HTTPPostSimpleSignRule(engine, parser, kiResolver);
    
    messageContext.setInboundMessageIssuer(issuer);
    ((SAMLMessageContext) messageContext).setInboundSAMLMessageAuthenticated(false);
    messageContext.setPeerEntityRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:22,代码来源:SAML2HTTPPostSimpleSignSecurityPolicyRuleTest.java

示例6: testChildElementsUnmarshall

import org.opensaml.saml2.metadata.SPSSODescriptor; //导入依赖的package包/类
/** {@inheritDoc} */
public void testChildElementsUnmarshall() {
    EntityDescriptor descriptor = (EntityDescriptor) unmarshallElement(childElementsFile);

    assertNotNull("Extensions child", descriptor.getExtensions());
    assertNotNull("Signature child", descriptor.getSignature());
    assertEquals("IDPSSODescriptor count", 2, descriptor.getRoleDescriptors(IDPSSODescriptor.DEFAULT_ELEMENT_NAME).size());
    assertEquals("SPSSODescriptor count", 3, descriptor.getRoleDescriptors(SPSSODescriptor.DEFAULT_ELEMENT_NAME).size());
    assertEquals("AuthnAuthorityDescriptor count", 2, descriptor.getRoleDescriptors(AuthnAuthorityDescriptor.DEFAULT_ELEMENT_NAME).size());
    assertEquals("AttributeAuthorityDescriptor count", 1, descriptor.getRoleDescriptors(AttributeAuthorityDescriptor.DEFAULT_ELEMENT_NAME).size());
    assertEquals("PDPDescriptor count", 2, descriptor.getRoleDescriptors(PDPDescriptor.DEFAULT_ELEMENT_NAME).size());
    assertNotNull("AffiliationDescriptor ", descriptor.getAffiliationDescriptor());
    assertNotNull("Organization ", descriptor.getOrganization());
    assertEquals("ContactPerson count", 1, descriptor.getContactPersons().size());
    assertEquals("AdditionalMetadataLocation count", 3, descriptor.getAdditionalMetadataLocations().size());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:17,代码来源:EntityDescriptorTest.java

示例7: testChildElementsUnmarshall

import org.opensaml.saml2.metadata.SPSSODescriptor; //导入依赖的package包/类
/** {@inheritDoc} */
public void testChildElementsUnmarshall() {
    SPSSODescriptor descriptor = (SPSSODescriptor) unmarshallElement(childElementsFile);

    assertNotNull("Extensions", descriptor.getExtensions());
    assertEquals("KeyDescriptor", 0, descriptor.getKeyDescriptors().size());
    assertNotNull("Organization child", descriptor.getOrganization());
    assertEquals("ContactPerson count", 2, descriptor.getContactPersons().size());

    assertEquals("ArtifactResolutionService count", 1, descriptor.getArtifactResolutionServices().size());
    assertEquals("SingleLogoutService count", 2, descriptor.getSingleLogoutServices().size());
    assertEquals("ManageNameIDService count", 4, descriptor.getManageNameIDServices().size());
    assertEquals("NameIDFormat count", 1, descriptor.getNameIDFormats().size());

    assertEquals("AssertionConsumerService count", 2, descriptor.getAssertionConsumerServices().size());
    assertEquals("AttributeConsumingService", 1, descriptor.getAttributeConsumingServices().size());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:18,代码来源:SPSSODescriptorTest.java

示例8: 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

示例9: getSPSSODescriptor

import org.opensaml.saml2.metadata.SPSSODescriptor; //导入依赖的package包/类
/** {@inheritDoc} */
public SPSSODescriptor getSPSSODescriptor(String supportedProtocol) {
    List<RoleDescriptor> descriptors = getRoleDescriptors(SPSSODescriptor.DEFAULT_ELEMENT_NAME, supportedProtocol);
    if (descriptors.size() > 0) {
        return (SPSSODescriptor) descriptors.get(0);
    }

    return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:EntityDescriptorImpl.java

示例10: processChildElement

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

    if (childSAMLObject instanceof AssertionConsumerService) {
        descriptor.getAssertionConsumerServices().add((AssertionConsumerService) childSAMLObject);
    } else if (childSAMLObject instanceof AttributeConsumingService) {
        descriptor.getAttributeConsumingServices().add((AttributeConsumingService) childSAMLObject);
    } else {
        super.processChildElement(parentSAMLObject, childSAMLObject);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:SPSSODescriptorUnmarshaller.java

示例11: 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

示例12: 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

示例13: setUp

import org.opensaml.saml2.metadata.SPSSODescriptor; //导入依赖的package包/类
/** {@inheritDoc} */
protected void setUp() throws Exception {
    super.setUp();
    
    issuer = "SomeCoolIssuer";
    
    signingCert = SecurityTestHelper.buildJavaX509Cert(signingCertBase64);
    //signingPrivateKey = SecurityTestHelper.buildJavaRSAPrivateKey(signingPrivateKeyBase64);
    
    signingX509Cred = new BasicX509Credential();
    signingX509Cred.setEntityCertificate(signingCert);
    signingX509Cred.setPrivateKey(signingPrivateKey);
    signingX509Cred.setEntityId(issuer);
    
    otherCert1 = SecurityTestHelper.buildJavaX509Cert(otherCert1Base64);
    
    BasicX509Credential otherCred1 = new BasicX509Credential();
    otherCred1.setEntityCertificate(otherCert1);
    otherCred1.setEntityId("other-1");
    
    trustedCredentials = new ArrayList<Credential>();
    trustedCredentials.add(otherCred1);
    
    credResolver = new CollectionCredentialResolver(trustedCredentials);
    
    //KeyInfoCredentialResolver kiResolver = new StaticKeyInfoCredentialResolver(new ArrayList<Credential>());
    //Testing with inline cert
    KeyInfoCredentialResolver kiResolver = SecurityTestHelper.buildBasicInlineKeyInfoResolver();
    TrustEngine<Signature> engine = new ExplicitKeySignatureTrustEngine(credResolver, kiResolver);
    
    rule = new SAMLProtocolMessageXMLSignatureSecurityPolicyRule(engine);
    
    messageContext.setInboundMessageIssuer(issuer);
    ((SAMLMessageContext) messageContext).setInboundSAMLMessageAuthenticated(false);
    messageContext.setPeerEntityRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:37,代码来源:SAMLProtocolMessageXMLSignatureSecurityPolicyRuleTest.java

示例14: populateRequiredData

import org.opensaml.saml2.metadata.SPSSODescriptor; //导入依赖的package包/类
/** {@inheritDoc} */
protected void populateRequiredData() {
    super.populateRequiredData();
    SPSSODescriptor spssoDescriptor = (SPSSODescriptor) target;
    AttributeConsumingService attributeConsumingService = (AttributeConsumingService) buildXMLObject(new QName(SAMLConstants.SAML20MD_NS,
            AttributeConsumingService.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20MD_PREFIX));
    spssoDescriptor.getAttributeConsumingServices().add(attributeConsumingService);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:9,代码来源:SPSSODescriptorSchemaTest.java

示例15: testAttributeConsumingServiceFailure

import org.opensaml.saml2.metadata.SPSSODescriptor; //导入依赖的package包/类
/**
 * Tests for AttributeConsumingService failure.
 * 
 * @throws ValidationException
 */
public void testAttributeConsumingServiceFailure() throws ValidationException {
    SPSSODescriptor spssoDescriptor = (SPSSODescriptor) target;

    spssoDescriptor.getAttributeConsumingServices().clear();
    assertValidationFail("AttributeConsumingService list was empty, should raise a Validation Exception.");
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:12,代码来源:SPSSODescriptorSchemaTest.java


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