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


Java Request.setIssueInstant方法代码示例

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


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

示例1: testEncoding

import org.opensaml.saml1.core.Request; //导入方法依赖的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

示例2: testSingleElementOptionalAttributesMarshall

import org.opensaml.saml1.core.Request; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementOptionalAttributesMarshall() {
    
    Request request = (Request) buildXMLObject(qname);

    request.setID(expectedID);
    request.setIssueInstant(expectedIssueInstant);
    assertEquals(expectedOptionalAttributesDOM, request);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:10,代码来源:RequestTest.java


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