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


Java AssertionConsumerService类代码示例

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


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

示例1: createSamlMessageContext

import org.opensaml.saml2.metadata.AssertionConsumerService; //导入依赖的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

示例2: getDefaultAssertionConsumerService

import org.opensaml.saml2.metadata.AssertionConsumerService; //导入依赖的package包/类
/** {@inheritDoc} */
public AssertionConsumerService getDefaultAssertionConsumerService() {
    for (AssertionConsumerService service : assertionConsumerServices) {
        if (service.isDefault()) {
            return service;
        }
    }

    if (assertionConsumerServices.size() > 0) {
        return assertionConsumerServices.get(0);
    } else {
        System.err.println("FOOBAR");
    }

    return null;
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:17,代码来源:SPSSODescriptorImpl.java

示例3: testXSBooleanAttributes

import org.opensaml.saml2.metadata.AssertionConsumerService; //导入依赖的package包/类
/**
 * Test the proper behavior of the XSBooleanValue attributes.
 */
public void testXSBooleanAttributes() {
    AssertionConsumerService acs = 
        (AssertionConsumerService) buildXMLObject(AssertionConsumerService.DEFAULT_ELEMENT_NAME);
    
    // isDefault attribute
    acs.setIsDefault(Boolean.TRUE);
    assertEquals("Unexpected value for boolean attribute found", Boolean.TRUE, acs.isDefault());
    assertNotNull("XSBooleanValue was null", acs.isDefaultXSBoolean());
    assertEquals("XSBooleanValue was unexpected value", new XSBooleanValue(Boolean.TRUE, false),
            acs.isDefaultXSBoolean());
    assertEquals("XSBooleanValue string was unexpected value", "true", acs.isDefaultXSBoolean().toString());
    
    acs.setIsDefault(Boolean.FALSE);
    assertEquals("Unexpected value for boolean attribute found", Boolean.FALSE, acs.isDefault());
    assertNotNull("XSBooleanValue was null", acs.isDefaultXSBoolean());
    assertEquals("XSBooleanValue was unexpected value", new XSBooleanValue(Boolean.FALSE, false),
            acs.isDefaultXSBoolean());
    assertEquals("XSBooleanValue string was unexpected value", "false", acs.isDefaultXSBoolean().toString());
    
    acs.setIsDefault((Boolean) null);
    assertEquals("Unexpected default value for boolean attribute found", Boolean.FALSE, acs.isDefault());
    assertNull("XSBooleanValue was not null", acs.isDefaultXSBoolean());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:27,代码来源:AssertionConsumerServiceTest.java

示例4: getEndpoints

import org.opensaml.saml2.metadata.AssertionConsumerService; //导入依赖的package包/类
/** {@inheritDoc} */
public List<Endpoint> getEndpoints(QName type) {
    if(type.equals(AssertionConsumerService.DEFAULT_ELEMENT_NAME)){
        return Collections.unmodifiableList(new ArrayList<Endpoint>(assertionConsumerServices));
    }else{
        return super.getEndpoints(type);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:SPSSODescriptorImpl.java

示例5: processChildElement

import org.opensaml.saml2.metadata.AssertionConsumerService; //导入依赖的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

示例6: getDefaultAssertionConsumerService

import org.opensaml.saml2.metadata.AssertionConsumerService; //导入依赖的package包/类
/**
 * Get the default assertion consumer service. If there is no default, the
 * first is selected.
 */
public AssertionConsumerService getDefaultAssertionConsumerService() {
	AssertionConsumerService service = spSSODescriptor.getDefaultAssertionConsumerService();
	if (service != null)
		return service;
	if (spSSODescriptor.getAssertionConsumerServices().isEmpty())
		throw new IllegalStateException("No AssertionConsumerServices defined in SP metadata");
	return spSSODescriptor.getAssertionConsumerServices().get(0);
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:13,代码来源:SPMetadata.java

示例7: getAssertionConsumerServiceLocation

import org.opensaml.saml2.metadata.AssertionConsumerService; //导入依赖的package包/类
/**
 * 
 * @param index
 * @return The location (URL) of {@link AssertionConsumerService} no.
 *         <code>index</code> at the service provider
 */
public String getAssertionConsumerServiceLocation(int index) {
	if (spSSODescriptor.getAssertionConsumerServices().size() > index) {
		AssertionConsumerService consumerService = spSSODescriptor.getAssertionConsumerServices().get(index);
		return consumerService.getLocation();
	}
	return null;
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:14,代码来源:SPMetadata.java

示例8: createAssertionConsumerService

import org.opensaml.saml2.metadata.AssertionConsumerService; //导入依赖的package包/类
/**
 * Create a SAML assertion consumer service.
 */
public static AssertionConsumerService createAssertionConsumerService(String location, String binding, int index, boolean isDefault) {
	AssertionConsumerService acs = buildXMLObject(AssertionConsumerService.class);
	acs.setBinding(binding);
	acs.setIndex(index);
	acs.setLocation(location);
	acs.setIsDefault(isDefault);
	return acs;
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:12,代码来源:SAMLUtil.java

示例9: testEncoding

import org.opensaml.saml2.metadata.AssertionConsumerService; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testEncoding() throws Exception {
    SAMLObjectBuilder<Response> requestBuilder = (SAMLObjectBuilder<Response>) builderFactory
            .getBuilder(Response.DEFAULT_ELEMENT_NAME);
    Response samlMessage = requestBuilder.buildObject();
    samlMessage.setID("foo");
    samlMessage.setIssueInstant(new DateTime(0));
    samlMessage.setVersion(SAMLVersion.VERSION_11);

    SAMLObjectBuilder<Endpoint> endpointBuilder = (SAMLObjectBuilder<Endpoint>) builderFactory
            .getBuilder(AssertionConsumerService.DEFAULT_ELEMENT_NAME);
    Endpoint samlEndpoint = endpointBuilder.buildObject();
    samlEndpoint.setLocation("http://example.org");
    samlEndpoint.setResponseLocation("http://example.org/response");

    HTTPPostEncoder encoder = new HTTPPostEncoder(velocityEngine,
    "/templates/saml1-post-binding.vm");

    MockHttpServletResponse response = new MockHttpServletResponse();
    BasicSAMLMessageContext messageContext = new BasicSAMLMessageContext();
    messageContext.setOutboundMessageTransport(new HttpServletResponseAdapter(response, false));
    messageContext.setPeerEntityEndpoint(samlEndpoint);
    messageContext.setOutboundSAMLMessage(samlMessage);
    messageContext.setRelayState("relay");
    
    encoder.encode(messageContext);

    assertEquals("Unexpected content type", "text/html", response.getContentType());
    assertEquals("Unexpected character encoding", response.getCharacterEncoding(), "UTF-8");
    assertEquals("Unexpected cache controls", "no-cache, no-store", response.getHeader("Cache-control"));
    assertEquals(-608085328, response.getContentAsString().hashCode());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:33,代码来源:HTTPPostEncoderTest.java

示例10: testEncoding

import org.opensaml.saml2.metadata.AssertionConsumerService; //导入依赖的package包/类
/** Tests encoding a simple SAML message. */
@SuppressWarnings("unchecked")
public void testEncoding() throws Exception {
    SAMLObjectBuilder<Request> requestBuilder = (SAMLObjectBuilder<Request>) builderFactory
            .getBuilder(Request.DEFAULT_ELEMENT_NAME);
    Request request = requestBuilder.buildObject();
    request.setID("foo");
    request.setIssueInstant(new DateTime(0));
    request.setVersion(SAMLVersion.VERSION_11);

    SAMLObjectBuilder<Endpoint> endpointBuilder = (SAMLObjectBuilder<Endpoint>) builderFactory
            .getBuilder(AssertionConsumerService.DEFAULT_ELEMENT_NAME);
    Endpoint samlEndpoint = endpointBuilder.buildObject();
    samlEndpoint.setLocation("http://example.org");
    samlEndpoint.setResponseLocation("http://example.org/response");

    MockHttpServletResponse response = new MockHttpServletResponse();
    BasicSAMLMessageContext messageContext = new BasicSAMLMessageContext();
    messageContext.setOutboundMessageTransport(new HttpServletResponseAdapter(response, false));
    messageContext.setPeerEntityEndpoint(samlEndpoint);
    messageContext.setOutboundSAMLMessage(request);
    messageContext.setRelayState("relay");
    
    HTTPSOAP11Encoder encoder = new HTTPSOAP11Encoder();
    encoder.encode(messageContext);

    assertEquals("Unexpected content type", "text/xml", response.getContentType());
    assertEquals("Unexpected character encoding", response.getCharacterEncoding(), "UTF-8");
    assertEquals("Unexpected cache controls", "no-cache, no-store", response.getHeader("Cache-control"));
    assertEquals("http://www.oasis-open.org/committees/security", response.getHeader("SOAPAction"));
    assertEquals(-280457420, response.getContentAsString().hashCode());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:33,代码来源:HTTPSOAP11EncoderTest.java

示例11: testRequestEncoding

import org.opensaml.saml2.metadata.AssertionConsumerService; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testRequestEncoding() throws Exception {
    SAMLObjectBuilder<AuthnRequest> responseBuilder = (SAMLObjectBuilder<AuthnRequest>) builderFactory
            .getBuilder(AuthnRequest.DEFAULT_ELEMENT_NAME);
    AuthnRequest samlMessage = responseBuilder.buildObject();
    samlMessage.setID("foo");
    samlMessage.setVersion(SAMLVersion.VERSION_20);
    samlMessage.setIssueInstant(new DateTime(0));

    SAMLObjectBuilder<Endpoint> endpointBuilder = (SAMLObjectBuilder<Endpoint>) builderFactory
            .getBuilder(AssertionConsumerService.DEFAULT_ELEMENT_NAME);
    Endpoint samlEndpoint = endpointBuilder.buildObject();
    samlEndpoint.setLocation("http://example.org");
    samlEndpoint.setResponseLocation("http://example.org/response");

    MockHttpServletResponse response = new MockHttpServletResponse();
    HttpServletResponseAdapter outTransport = new HttpServletResponseAdapter(response, false);
    
    BasicSAMLMessageContext messageContext = new BasicSAMLMessageContext();
    messageContext.setOutboundMessageTransport(outTransport);
    messageContext.setPeerEntityEndpoint(samlEndpoint);
    messageContext.setOutboundSAMLMessage(samlMessage);
    messageContext.setRelayState("relay");

    HTTPPostEncoder encoder = new HTTPPostEncoder(velocityEngine,
    "/templates/saml2-post-binding.vm");
    encoder.encode(messageContext);

    assertEquals("Unexpected content type", "text/html", response.getContentType());
    assertEquals("Unexpected character encoding", response.getCharacterEncoding(), "UTF-8");
    assertEquals("Unexpected cache controls", "no-cache, no-store", response.getHeader("Cache-control"));
    assertEquals(-243324550, response.getContentAsString().hashCode());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:34,代码来源:HTTPPostEncoderTest.java

示例12: testRequestEncoding

import org.opensaml.saml2.metadata.AssertionConsumerService; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testRequestEncoding() throws Exception {
    SAMLObjectBuilder<AuthnRequest> responseBuilder = (SAMLObjectBuilder<AuthnRequest>) builderFactory
            .getBuilder(AuthnRequest.DEFAULT_ELEMENT_NAME);
    AuthnRequest samlMessage = responseBuilder.buildObject();
    samlMessage.setID("foo");
    samlMessage.setVersion(SAMLVersion.VERSION_20);
    samlMessage.setIssueInstant(new DateTime(0));

    SAMLObjectBuilder<Endpoint> endpointBuilder = (SAMLObjectBuilder<Endpoint>) builderFactory
            .getBuilder(AssertionConsumerService.DEFAULT_ELEMENT_NAME);
    Endpoint samlEndpoint = endpointBuilder.buildObject();
    samlEndpoint.setLocation("http://example.org");
    samlEndpoint.setResponseLocation("http://example.org/response");

    MockHttpServletResponse response = new MockHttpServletResponse();
    HttpServletResponseAdapter outTransport = new HttpServletResponseAdapter(response, false);
    
    BasicSAMLMessageContext messageContext = new BasicSAMLMessageContext();
    messageContext.setOutboundMessageTransport(outTransport);
    messageContext.setPeerEntityEndpoint(samlEndpoint);
    messageContext.setOutboundSAMLMessage(samlMessage);
    messageContext.setRelayState("relay");

    HTTPPostSimpleSignEncoder encoder = new HTTPPostSimpleSignEncoder(velocityEngine,
    "/templates/saml2-post-simplesign-binding.vm");
    encoder.encode(messageContext);

    assertEquals("Unexpected content type", "text/html", response.getContentType());
    assertEquals("Unexpected character encoding", response.getCharacterEncoding(), "UTF-8");
    assertEquals("Unexpected cache controls", "no-cache, no-store", response.getHeader("Cache-control"));
    assertEquals(-1110321790, response.getContentAsString().hashCode());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:34,代码来源:HTTPPostSimpleSignEncoderTest.java

示例13: testSingleElementUnmarshall

import org.opensaml.saml2.metadata.AssertionConsumerService; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementUnmarshall() {
    AssertionConsumerService service = (AssertionConsumerService) unmarshallElement(singleElementFile);
    
    assertEquals("Binding URI was not expected value", expectedBinding, service.getBinding());
    assertEquals("Location was not expected value", expectedLocation, service.getLocation());
    assertEquals("Index was not expected value", expectedIndex, service.getIndex());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:9,代码来源:AssertionConsumerServiceTest.java

示例14: testSingleElementOptionalAttributesUnmarshall

import org.opensaml.saml2.metadata.AssertionConsumerService; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementOptionalAttributesUnmarshall() {
    AssertionConsumerService service = (AssertionConsumerService) unmarshallElement(singleElementOptionalAttributesFile);
    
    assertEquals("Binding URI was not expected value", expectedBinding, service.getBinding());
    assertEquals("Location was not expected value", expectedLocation, service.getLocation());
    assertEquals("Index was not expected value", expectedIndex, service.getIndex());
    assertEquals("ResponseLocation was not expected value", expectedResponseLocation, service.getResponseLocation());
    assertEquals("isDefault was not expected value", expectedIsDefault, service.isDefaultXSBoolean());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:11,代码来源:AssertionConsumerServiceTest.java

示例15: testSingleElementMarshall

import org.opensaml.saml2.metadata.AssertionConsumerService; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementMarshall() {
    QName qname = new QName(SAMLConstants.SAML20MD_NS, AssertionConsumerService.DEFAULT_ELEMENT_LOCAL_NAME);
    AssertionConsumerService service = (AssertionConsumerService) buildXMLObject(qname);
    
    service.setBinding(expectedBinding);
    service.setLocation(expectedLocation);
    service.setIndex(expectedIndex);

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


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