本文整理汇总了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());
}
示例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);
}